aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/support
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/xfs/support
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'fs/xfs/support')
-rw-r--r--fs/xfs/support/debug.c115
-rw-r--r--fs/xfs/support/debug.h54
2 files changed, 0 insertions, 169 deletions
diff --git a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c
deleted file mode 100644
index 975aa10e1a47..000000000000
--- a/fs/xfs/support/debug.c
+++ /dev/null
@@ -1,115 +0,0 @@
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
28static char message[1024]; /* keep it off the stack */
29static DEFINE_SPINLOCK(xfs_err_lock);
30
31/* Translate from CE_FOO to KERN_FOO, err_level(CE_FOO) == KERN_FOO */
32#define XFS_MAX_ERR_LEVEL 7
33#define XFS_ERR_MASK ((1 << 3) - 1)
34static const char * const err_level[XFS_MAX_ERR_LEVEL+1] =
35 {KERN_EMERG, KERN_ALERT, KERN_CRIT,
36 KERN_ERR, KERN_WARNING, KERN_NOTICE,
37 KERN_INFO, KERN_DEBUG};
38
39void
40cmn_err(register int level, char *fmt, ...)
41{
42 char *fp = fmt;
43 int len;
44 ulong flags;
45 va_list ap;
46
47 level &= XFS_ERR_MASK;
48 if (level > XFS_MAX_ERR_LEVEL)
49 level = XFS_MAX_ERR_LEVEL;
50 spin_lock_irqsave(&xfs_err_lock,flags);
51 va_start(ap, fmt);
52 if (*fmt == '!') fp++;
53 len = vsnprintf(message, sizeof(message), fp, ap);
54 if (len >= sizeof(message))
55 len = sizeof(message) - 1;
56 if (message[len-1] == '\n')
57 message[len-1] = 0;
58 printk("%s%s\n", err_level[level], message);
59 va_end(ap);
60 spin_unlock_irqrestore(&xfs_err_lock,flags);
61 BUG_ON(level == CE_PANIC);
62}
63
64void
65xfs_fs_vcmn_err(
66 int level,
67 struct xfs_mount *mp,
68 char *fmt,
69 va_list ap)
70{
71 unsigned long flags;
72 int len = 0;
73
74 level &= XFS_ERR_MASK;
75 if (level > XFS_MAX_ERR_LEVEL)
76 level = XFS_MAX_ERR_LEVEL;
77
78 spin_lock_irqsave(&xfs_err_lock,flags);
79
80 if (mp) {
81 len = sprintf(message, "Filesystem \"%s\": ", mp->m_fsname);
82
83 /*
84 * Skip the printk if we can't print anything useful
85 * due to an over-long device name.
86 */
87 if (len >= sizeof(message))
88 goto out;
89 }
90
91 len = vsnprintf(message + len, sizeof(message) - len, fmt, ap);
92 if (len >= sizeof(message))
93 len = sizeof(message) - 1;
94 if (message[len-1] == '\n')
95 message[len-1] = 0;
96
97 printk("%s%s\n", err_level[level], message);
98 out:
99 spin_unlock_irqrestore(&xfs_err_lock,flags);
100
101 BUG_ON(level == CE_PANIC);
102}
103
104void
105assfail(char *expr, char *file, int line)
106{
107 printk("Assertion failed: %s, file: %s, line: %d\n", expr, file, line);
108 BUG();
109}
110
111void
112xfs_hex_dump(void *p, int length)
113{
114 print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1);
115}
diff --git a/fs/xfs/support/debug.h b/fs/xfs/support/debug.h
deleted file mode 100644
index d2d20462fd4f..000000000000
--- a/fs/xfs/support/debug.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * Copyright (c) 2000-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#ifndef __XFS_SUPPORT_DEBUG_H__
19#define __XFS_SUPPORT_DEBUG_H__
20
21#include <stdarg.h>
22
23#define CE_DEBUG 7 /* debug */
24#define CE_CONT 6 /* continuation */
25#define CE_NOTE 5 /* notice */
26#define CE_WARN 4 /* warning */
27#define CE_ALERT 1 /* alert */
28#define CE_PANIC 0 /* panic */
29
30extern void cmn_err(int, char *, ...)
31 __attribute__ ((format (printf, 2, 3)));
32extern void assfail(char *expr, char *f, int l);
33
34#define ASSERT_ALWAYS(expr) \
35 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
36
37#ifndef DEBUG
38#define ASSERT(expr) ((void)0)
39
40#ifndef STATIC
41# define STATIC static noinline
42#endif
43
44#else /* DEBUG */
45
46#define ASSERT(expr) \
47 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
48
49#ifndef STATIC
50# define STATIC noinline
51#endif
52
53#endif /* DEBUG */
54#endif /* __XFS_SUPPORT_DEBUG_H__ */