Commit 9130090b5f04f7e7bc29b944e0b1ba494fff3f98

Authored by Dave Chinner
Committed by Dave Chinner
1 parent 0b932cccbd

xfs: kill support/debug.[ch]

The remaining functionality in debug.[ch] is effectively just assert
handling, conditional debug definitions and hex dumping. The hex
dumping and assert function can be moved into the new printk module,
while the rest can be moved into top-level header files. This allows
fs/xfs/support/debug.[ch] to be completely removed from the
codebase.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>

Showing 7 changed files with 40 additions and 86 deletions Side-by-side Diff

... ... @@ -111,7 +111,5 @@
111 111 xfs_xattr.o)
112 112  
113 113 # Objects in support/
114   -xfs-y += $(addprefix support/, \
115   - debug.o \
116   - uuid.o)
  114 +xfs-y += support/uuid.o
fs/xfs/linux-2.6/xfs_linux.h
... ... @@ -39,7 +39,6 @@
39 39 #include <mrlock.h>
40 40 #include <time.h>
41 41  
42   -#include <support/debug.h>
43 42 #include <support/uuid.h>
44 43  
45 44 #include <linux/semaphore.h>
... ... @@ -280,6 +279,27 @@
280 279 #else
281 280 #define __arch_pack
282 281 #endif
  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 */
283 303  
284 304 #endif /* __XFS_LINUX__ */
fs/xfs/linux-2.6/xfs_message.c
... ... @@ -117,4 +117,18 @@
117 117  
118 118 return r;
119 119 }
  120 +
  121 +void
  122 +assfail(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 +
  129 +void
  130 +xfs_hex_dump(void *p, int length)
  131 +{
  132 + print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1);
  133 +}
fs/xfs/linux-2.6/xfs_message.h
... ... @@ -31,5 +31,9 @@
31 31 #define xfs_debug(mp, fmt, ...) (0)
32 32 #endif
33 33  
  34 +extern void assfail(char *expr, char *f, int l);
  35 +
  36 +extern void xfs_hex_dump(void *p, int length);
  37 +
34 38 #endif /* __XFS_MESSAGE_H */
fs/xfs/support/debug.c
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   -void
22   -assfail(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   -
29   -void
30   -xfs_hex_dump(void *p, int length)
31   -{
32   - print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1);
33   -}
fs/xfs/support/debug.h
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   -extern 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__ */
... ... @@ -158,9 +158,5 @@
158 158 #define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
159 159 #define XFS_PTAG_FSBLOCK_ZERO 0x00000080
160 160  
161   -struct xfs_mount;
162   -
163   -extern void xfs_hex_dump(void *p, int length);
164   -
165 161 #endif /* __XFS_ERROR_H__ */