Blame view
fs/xfs/xfs_message.c
2.83 KB
10e38391c xfs: introduce ne... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
/* * Copyright (c) 2011 Red Hat, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" #include "xfs_fs.h" |
847f9f687 xfs: more info fr... |
20 |
#include "xfs_error.h" |
4fb6e8ade xfs: merge xfs_ag... |
21 |
#include "xfs_format.h" |
239880ef6 xfs: decouple log... |
22 23 |
#include "xfs_log_format.h" #include "xfs_trans_resv.h" |
10e38391c xfs: introduce ne... |
24 25 26 27 28 |
#include "xfs_mount.h" /* * XFS logging functions */ |
957935dcd xfs: fix xfs_debu... |
29 |
static void |
10e38391c xfs: introduce ne... |
30 31 32 33 34 |
__xfs_printk( const char *level, const struct xfs_mount *mp, struct va_format *vaf) { |
3eff12689 xfs: fix duplicat... |
35 |
if (mp && mp->m_fsname) { |
957935dcd xfs: fix xfs_debu... |
36 37 |
printk("%sXFS (%s): %pV ", level, mp->m_fsname, vaf); |
3eff12689 xfs: fix duplicat... |
38 39 |
return; } |
957935dcd xfs: fix xfs_debu... |
40 41 |
printk("%sXFS: %pV ", level, vaf); |
10e38391c xfs: introduce ne... |
42 |
} |
10e38391c xfs: introduce ne... |
43 |
#define define_xfs_printk_level(func, kern_level) \ |
957935dcd xfs: fix xfs_debu... |
44 |
void func(const struct xfs_mount *mp, const char *fmt, ...) \ |
10e38391c xfs: introduce ne... |
45 46 47 |
{ \ struct va_format vaf; \ va_list args; \ |
847f9f687 xfs: more info fr... |
48 |
int level; \ |
10e38391c xfs: introduce ne... |
49 50 51 52 53 54 |
\ va_start(args, fmt); \ \ vaf.fmt = fmt; \ vaf.va = &args; \ \ |
957935dcd xfs: fix xfs_debu... |
55 |
__xfs_printk(kern_level, mp, &vaf); \ |
10e38391c xfs: introduce ne... |
56 |
va_end(args); \ |
847f9f687 xfs: more info fr... |
57 58 59 60 61 |
\ if (!kstrtoint(kern_level, 0, &level) && \ level <= LOGLEVEL_ERR && \ xfs_error_level >= XFS_ERRLEVEL_HIGH) \ xfs_stack_trace(); \ |
10e38391c xfs: introduce ne... |
62 63 64 65 66 67 68 69 70 71 72 73 |
} \ define_xfs_printk_level(xfs_emerg, KERN_EMERG); define_xfs_printk_level(xfs_alert, KERN_ALERT); define_xfs_printk_level(xfs_crit, KERN_CRIT); define_xfs_printk_level(xfs_err, KERN_ERR); define_xfs_printk_level(xfs_warn, KERN_WARNING); define_xfs_printk_level(xfs_notice, KERN_NOTICE); define_xfs_printk_level(xfs_info, KERN_INFO); #ifdef DEBUG define_xfs_printk_level(xfs_debug, KERN_DEBUG); #endif |
957935dcd xfs: fix xfs_debu... |
74 |
void |
10e38391c xfs: introduce ne... |
75 76 77 78 79 80 81 |
xfs_alert_tag( const struct xfs_mount *mp, int panic_tag, const char *fmt, ...) { struct va_format vaf; va_list args; |
0c9ba9731 xfs: don't name v... |
82 |
int do_panic = 0; |
10e38391c xfs: introduce ne... |
83 84 |
if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) { |
e69522a8c xfs: kill off xfs... |
85 |
xfs_alert(mp, "Transforming an alert into a BUG."); |
0c9ba9731 xfs: don't name v... |
86 |
do_panic = 1; |
10e38391c xfs: introduce ne... |
87 88 89 90 91 92 |
} va_start(args, fmt); vaf.fmt = fmt; vaf.va = &args; |
957935dcd xfs: fix xfs_debu... |
93 |
__xfs_printk(KERN_ALERT, mp, &vaf); |
10e38391c xfs: introduce ne... |
94 |
va_end(args); |
0c9ba9731 xfs: don't name v... |
95 |
BUG_ON(do_panic); |
10e38391c xfs: introduce ne... |
96 |
} |
9130090b5 xfs: kill support... |
97 98 |
void |
742ae1e35 xfs: introduce CO... |
99 100 101 102 103 104 105 106 |
asswarn(char *expr, char *file, int line) { xfs_warn(NULL, "Assertion failed: %s, file: %s, line: %d", expr, file, line); WARN_ON(1); } void |
9130090b5 xfs: kill support... |
107 108 109 110 111 112 113 114 115 116 117 118 |
assfail(char *expr, char *file, int line) { xfs_emerg(NULL, "Assertion failed: %s, file: %s, line: %d", expr, file, line); BUG(); } void xfs_hex_dump(void *p, int length) { print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1); } |