at v2.6.38-rc4 107 lines 2.3 kB view raw
1/* 2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 * All Rights Reserved. 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it would be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write the Free Software Foundation, 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18#include <xfs.h> 19#include "debug.h" 20 21/* xfs_mount.h drags a lot of crap in, sorry.. */ 22#include "xfs_sb.h" 23#include "xfs_inum.h" 24#include "xfs_ag.h" 25#include "xfs_mount.h" 26#include "xfs_error.h" 27 28void 29cmn_err( 30 const char *lvl, 31 const char *fmt, 32 ...) 33{ 34 struct va_format vaf; 35 va_list args; 36 37 va_start(args, fmt); 38 vaf.fmt = fmt; 39 vaf.va = &args; 40 41 printk("%s%pV", lvl, &vaf); 42 va_end(args); 43 44 BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0); 45} 46 47void 48xfs_fs_cmn_err( 49 const char *lvl, 50 struct xfs_mount *mp, 51 const char *fmt, 52 ...) 53{ 54 struct va_format vaf; 55 va_list args; 56 57 va_start(args, fmt); 58 vaf.fmt = fmt; 59 vaf.va = &args; 60 61 printk("%sFilesystem %s: %pV", lvl, mp->m_fsname, &vaf); 62 va_end(args); 63 64 BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0); 65} 66 67/* All callers to xfs_cmn_err use CE_ALERT, so don't bother testing lvl */ 68void 69xfs_cmn_err( 70 int panic_tag, 71 const char *lvl, 72 struct xfs_mount *mp, 73 const char *fmt, 74 ...) 75{ 76 struct va_format vaf; 77 va_list args; 78 int do_panic = 0; 79 80 if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) { 81 printk(KERN_ALERT "XFS: Transforming an alert into a BUG."); 82 do_panic = 1; 83 } 84 85 va_start(args, fmt); 86 vaf.fmt = fmt; 87 vaf.va = &args; 88 89 printk(KERN_ALERT "Filesystem %s: %pV", mp->m_fsname, &vaf); 90 va_end(args); 91 92 BUG_ON(do_panic); 93} 94 95void 96assfail(char *expr, char *file, int line) 97{ 98 printk(KERN_CRIT "Assertion failed: %s, file: %s, line: %d\n", expr, 99 file, line); 100 BUG(); 101} 102 103void 104xfs_hex_dump(void *p, int length) 105{ 106 print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1); 107}