Merge branch 'firewire-kernel-streaming' of git://git.alsa-project.org/alsa-kprivate
[firewire-audio.git] / fs / xfs / support / debug.c
blob0df88897ef8442da776f726960c6b2a9deece178
1 /*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
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.
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.
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
18 #include <xfs.h>
19 #include "debug.h"
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"
28 void
29 cmn_err(
30 const char *lvl,
31 const char *fmt,
32 ...)
34 struct va_format vaf;
35 va_list args;
37 va_start(args, fmt);
38 vaf.fmt = fmt;
39 vaf.va = &args;
41 printk("%s%pV", lvl, &vaf);
42 va_end(args);
44 BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
47 void
48 xfs_fs_cmn_err(
49 const char *lvl,
50 struct xfs_mount *mp,
51 const char *fmt,
52 ...)
54 struct va_format vaf;
55 va_list args;
57 va_start(args, fmt);
58 vaf.fmt = fmt;
59 vaf.va = &args;
61 printk("%sFilesystem %s: %pV", lvl, mp->m_fsname, &vaf);
62 va_end(args);
64 BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
67 /* All callers to xfs_cmn_err use CE_ALERT, so don't bother testing lvl */
68 void
69 xfs_cmn_err(
70 int panic_tag,
71 const char *lvl,
72 struct xfs_mount *mp,
73 const char *fmt,
74 ...)
76 struct va_format vaf;
77 va_list args;
78 int do_panic = 0;
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;
85 va_start(args, fmt);
86 vaf.fmt = fmt;
87 vaf.va = &args;
89 printk(KERN_ALERT "Filesystem %s: %pV", mp->m_fsname, &vaf);
90 va_end(args);
92 BUG_ON(do_panic);
95 void
96 assfail(char *expr, char *file, int line)
98 printk(KERN_CRIT "Assertion failed: %s, file: %s, line: %d\n", expr,
99 file, line);
100 BUG();
103 void
104 xfs_hex_dump(void *p, int length)
106 print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1);