aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/Makefile4
-rw-r--r--fs/xfs/linux-2.6/xfs_linux.h22
-rw-r--r--fs/xfs/linux-2.6/xfs_message.c14
-rw-r--r--fs/xfs/linux-2.6/xfs_message.h4
-rw-r--r--fs/xfs/support/debug.c33
-rw-r--r--fs/xfs/support/debug.h45
-rw-r--r--fs/xfs/xfs_error.h4
7 files changed, 40 insertions, 86 deletions
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 077784ed6a7f..fee7901841e3 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -111,6 +111,4 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \
111 xfs_xattr.o) 111 xfs_xattr.o)
112 112
113# Objects in support/ 113# Objects in support/
114xfs-y += $(addprefix support/, \ 114xfs-y += support/uuid.o
115 debug.o \
116 uuid.o)
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h
index 1189bfcbcd3e..244be9cbfe78 100644
--- a/fs/xfs/linux-2.6/xfs_linux.h
+++ b/fs/xfs/linux-2.6/xfs_linux.h
@@ -39,7 +39,6 @@
39#include <mrlock.h> 39#include <mrlock.h>
40#include <time.h> 40#include <time.h>
41 41
42#include <support/debug.h>
43#include <support/uuid.h> 42#include <support/uuid.h>
44 43
45#include <linux/semaphore.h> 44#include <linux/semaphore.h>
@@ -281,4 +280,25 @@ static inline __uint64_t howmany_64(__uint64_t x, __uint32_t y)
281#define __arch_pack 280#define __arch_pack
282#endif 281#endif
283 282
283#define ASSERT_ALWAYS(expr) \
284 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
285
286#ifndef DEBUG
287#define ASSERT(expr) ((void)0)
288
289#ifndef STATIC
290# define STATIC static noinline
291#endif
292
293#else /* DEBUG */
294
295#define ASSERT(expr) \
296 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
297
298#ifndef STATIC
299# define STATIC noinline
300#endif
301
302#endif /* DEBUG */
303
284#endif /* __XFS_LINUX__ */ 304#endif /* __XFS_LINUX__ */
diff --git a/fs/xfs/linux-2.6/xfs_message.c b/fs/xfs/linux-2.6/xfs_message.c
index 6f3368eec25d..8fe8cf69d809 100644
--- a/fs/xfs/linux-2.6/xfs_message.c
+++ b/fs/xfs/linux-2.6/xfs_message.c
@@ -117,3 +117,17 @@ xfs_alert_tag(
117 117
118 return r; 118 return r;
119} 119}
120
121void
122assfail(char *expr, char *file, int line)
123{
124 xfs_emerg(NULL, "Assertion failed: %s, file: %s, line: %d",
125 expr, file, line);
126 BUG();
127}
128
129void
130xfs_hex_dump(void *p, int length)
131{
132 print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1);
133}
diff --git a/fs/xfs/linux-2.6/xfs_message.h b/fs/xfs/linux-2.6/xfs_message.h
index 8d2df0175304..e77ffa16745b 100644
--- a/fs/xfs/linux-2.6/xfs_message.h
+++ b/fs/xfs/linux-2.6/xfs_message.h
@@ -31,4 +31,8 @@ extern int xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
31#define xfs_debug(mp, fmt, ...) (0) 31#define xfs_debug(mp, fmt, ...) (0)
32#endif 32#endif
33 33
34extern void assfail(char *expr, char *f, int l);
35
36extern void xfs_hex_dump(void *p, int length);
37
34#endif /* __XFS_MESSAGE_H */ 38#endif /* __XFS_MESSAGE_H */
diff --git a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c
deleted file mode 100644
index 79fae3b33bdd..000000000000
--- a/fs/xfs/support/debug.c
+++ /dev/null
@@ -1,33 +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
21void
22assfail(char *expr, char *file, int line)
23{
24 printk(KERN_CRIT "Assertion failed: %s, file: %s, line: %d\n", expr,
25 file, line);
26 BUG();
27}
28
29void
30xfs_hex_dump(void *p, int length)
31{
32 print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1);
33}
diff --git a/fs/xfs/support/debug.h b/fs/xfs/support/debug.h
deleted file mode 100644
index db36be48a43e..000000000000
--- a/fs/xfs/support/debug.h
+++ /dev/null
@@ -1,45 +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
23extern void assfail(char *expr, char *f, int l);
24
25#define ASSERT_ALWAYS(expr) \
26 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
27
28#ifndef DEBUG
29#define ASSERT(expr) ((void)0)
30
31#ifndef STATIC
32# define STATIC static noinline
33#endif
34
35#else /* DEBUG */
36
37#define ASSERT(expr) \
38 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
39
40#ifndef STATIC
41# define STATIC noinline
42#endif
43
44#endif /* DEBUG */
45#endif /* __XFS_SUPPORT_DEBUG_H__ */
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index e8360514c250..079a367f44ee 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -158,8 +158,4 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
158#define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040 158#define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
159#define XFS_PTAG_FSBLOCK_ZERO 0x00000080 159#define XFS_PTAG_FSBLOCK_ZERO 0x00000080
160 160
161struct xfs_mount;
162
163extern void xfs_hex_dump(void *p, int length);
164
165#endif /* __XFS_ERROR_H__ */ 161#endif /* __XFS_ERROR_H__ */