Skip to content

Commit

Permalink
xfs: kill support/debug.[ch]
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dave Chinner authored and Dave Chinner committed Mar 6, 2011
1 parent 0b932cc commit 9130090
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 86 deletions.
4 changes: 1 addition & 3 deletions fs/xfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,4 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \
xfs_xattr.o)

# Objects in support/
xfs-y += $(addprefix support/, \
debug.o \
uuid.o)
xfs-y += support/uuid.o
22 changes: 21 additions & 1 deletion fs/xfs/linux-2.6/xfs_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <mrlock.h>
#include <time.h>

#include <support/debug.h>
#include <support/uuid.h>

#include <linux/semaphore.h>
Expand Down Expand Up @@ -281,4 +280,25 @@ static inline __uint64_t howmany_64(__uint64_t x, __uint32_t y)
#define __arch_pack
#endif

#define ASSERT_ALWAYS(expr) \
(unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))

#ifndef DEBUG
#define ASSERT(expr) ((void)0)

#ifndef STATIC
# define STATIC static noinline
#endif

#else /* DEBUG */

#define ASSERT(expr) \
(unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))

#ifndef STATIC
# define STATIC noinline
#endif

#endif /* DEBUG */

#endif /* __XFS_LINUX__ */
14 changes: 14 additions & 0 deletions fs/xfs/linux-2.6/xfs_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,17 @@ xfs_alert_tag(

return r;
}

void
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);
}
4 changes: 4 additions & 0 deletions fs/xfs/linux-2.6/xfs_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ extern int xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
#define xfs_debug(mp, fmt, ...) (0)
#endif

extern void assfail(char *expr, char *f, int l);

extern void xfs_hex_dump(void *p, int length);

#endif /* __XFS_MESSAGE_H */
33 changes: 0 additions & 33 deletions fs/xfs/support/debug.c

This file was deleted.

45 changes: 0 additions & 45 deletions fs/xfs/support/debug.h

This file was deleted.

4 changes: 0 additions & 4 deletions fs/xfs/xfs_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,4 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
#define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
#define XFS_PTAG_FSBLOCK_ZERO 0x00000080

struct xfs_mount;

extern void xfs_hex_dump(void *p, int length);

#endif /* __XFS_ERROR_H__ */

0 comments on commit 9130090

Please sign in to comment.