1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
/*
* Copyright (c) 2003-2006 Erez Zadok
* Copyright (c) 2003-2006 Charles P. Wright
* Copyright (c) 2005-2006 Josef Sipek
* Copyright (c) 2005 Arun M. Krishnakumar
* Copyright (c) 2005-2006 David P. Quigley
* Copyright (c) 2003-2004 Mohammad Nayyer Zubair
* Copyright (c) 2003 Puja Gupta
* Copyright (c) 2003 Harikesavan Krishnan
* Copyright (c) 2003-2006 Stony Brook University
* Copyright (c) 2003-2006 The Research Foundation of State University of New York
*
* For specific licensing information, see the COPYING file distributed with
* this package.
*
* This Copyright notice must be kept intact and distributed with all sources.
*/
/*
* $Id: unionfs_debug.h,v 1.3 2006/06/01 21:25:18 jsipek Exp $
*/
#ifndef __UNIONFS_H_
#error This file should only be included from unionfs.h!
#endif
#ifdef UNIONFS_DEBUG
#define DEFAULT_DEBUG_MASK 0
#else
#define DEFAULT_DEBUG_MASK (~0)
#endif
/* debug print levels */
#define PRINT_NONE 0x0000
#define PRINT_MAIN_ENTRY 0x0001
#define PRINT_MAIN_EXIT 0x0002
#define PRINT_UTILITY_ENTRY 0x0004
#define PRINT_UTILITY_EXIT 0x0008
#define PRINT_MISC_ENTRY 0x0010
#define PRINT_MISC_EXIT 0x0020
#define PRINT_DATA_DENTRY 0x0040
#define PRINT_DATA_FILE 0x0080
#define PRINT_DATA_INODE 0x0100
#define PRINT_DATA_SB 0x0200
#define PRINT_DEBUG 0x0400
#define __PRINT_DEBUG_XATTR 0x0800
#define PRINT_DEBUG_XATTR (PRINT_DEBUG | __PRINT_DEBUG_XATTR)
#define __PRINT_DEBUG_WHITEOUT 0x1000
#define PRINT_DEBUG_WHITEOUT (PRINT_DEBUG | __PRINT_DEBUG_WHITEOUT)
#define PRINT_MAX (0x2000 - 1)
#define PRINT_ALL (~PRINT_NONE)
extern unsigned int get_debug_mask(void);
extern int set_debug_mask(int val);
/* print inode */
extern void unionfs_print_inode(const unsigned int req, const char *prefix, const struct inode *inode);
/* check inode */
extern void unionfs_checkinode(const unsigned int req, const struct inode *inode, const char *msg);
/* prunt file */
extern void unionfs_print_file(const unsigned int req, const char *prefix, const struct file *file);
/* print dentry */
extern void unionfs_print_dentry(const unsigned int req, const char *prefix, const struct dentry *dentry);
extern void unionfs_print_dentry_nocheck(const unsigned int req, const char *prefix, const struct dentry *dentry);
/* print superblock */
extern void unionfs_print_sb(const unsigned int req, const char *prefix, const struct super_block *sb);
/* print message */
extern int unionfs_print(const unsigned int req, const char *fmt, ...);
/* forced print-debugging functions */
#define force_print_dentry(prefix, ptr) \
unionfs_print_dentry(PRINT_ALL, (prefix), (ptr))
#define force_print_dentry_nocheck(prefix, ptr) \
unionfs_print_dentry_nocheck(PRINT_ALL, (prefix), (ptr))
#define force_print_file(prefix, ptr) \
unionfs_print_file(PRINT_ALL, (prefix), (ptr))
#define force_print_inode(prefix, ptr) \
unionfs_print_inode(PRINT_ALL, (prefix), (ptr))
#define force_print_sb(prefix, ptr) \
unionfs_print_sb(PRINT_ALL, (prefix), (ptr))
#ifdef UNIONFS_DEBUG
/*
* Full-fledged debugging enabled
*/
#define print_dentry(prefix, ptr) \
unionfs_print_dentry(PRINT_DATA_DENTRY, (prefix), (ptr))
#define print_dentry_nocheck(prefix, ptr) \
unionfs_print_dentry_nocheck(PRINT_DATA_DENTRY, (prefix), (ptr))
#define print_file(prefix, ptr) \
unionfs_print_file(PRINT_DATA_FILE, (prefix), (ptr))
#define print_inode(prefix, ptr) \
unionfs_print_inode(PRINT_DATA_INODE, (prefix), (ptr))
#define print_sb(prefix, ptr) \
unionfs_print_sb(PRINT_DATA_SB, (prefix), (ptr))
#define dprint(req, fmt, args...) \
unionfs_print(req, fmt, ## args)
#define checkinode(ptr, msg) \
unionfs_checkinode(PRINT_DEBUG, (ptr), (msg))
#define __print_entryexit(req, ee, fmt, args...) \
unionfs_print((req), \
ee " %s %s:%d" fmt "\n", \
__FUNCTION__, \
__FILE__, \
__LINE__, \
##args)
#define print_entry(fmt, args...) \
__print_entryexit(PRINT_MAIN_ENTRY, \
"IN: ", " " fmt, ##args)
#define print_entry_location() \
__print_entryexit(PRINT_MAIN_ENTRY, \
"IN: ", "")
#define print_exit_location() \
__print_entryexit(PRINT_MAIN_EXIT, \
"OUT:", "")
#define print_exit_status(status) \
__print_entryexit(PRINT_MAIN_EXIT, \
"OUT:", ", STATUS: %d", status)
static inline void __print_exit_pointer(unsigned int req, void *status)
{
if (IS_ERR(status))
__print_entryexit(req, "OUT:", ", STATUS: %ld",
PTR_ERR(status));
else
__print_entryexit(req, "OUT:", ", STATUS: 0x%p",
status);
}
#define print_exit_pointer(status) \
__print_exit_pointer(PRINT_MAIN_EXIT, status)
#define print_util_entry(fmt, args...) \
__print_entryexit(PRINT_UTILITY_ENTRY, \
"IN: ", " " fmt, ##args)
#define print_util_entry_location() \
__print_entryexit(PRINT_UTILITY_ENTRY, \
"IN: ", "")
#define print_util_exit_location() \
__print_entryexit(PRINT_UTILITY_EXIT, \
"OUT:", "")
#define print_util_exit_status(status) \
__print_entryexit(PRINT_UTILITY_EXIT, \
"OUT:", ", STATUS: %d", status)
#define print_util_exit_pointer(status) \
__print_exit_pointer(PRINT_UTILITY_EXIT, status)
#else /* UNIONFS_DEBUG */
/*
* Full-fledged debugging disabled
*/
#define print_dentry(prefix, ptr)
#define print_dentry_nocheck(prefix, ptr)
#define print_file(prefix, ptr)
#define print_inode(prefix, ptr)
#define print_sb(prefix, ptr)
#define dprint(req, fmt, args...)
#define checkinode(ptr, msg)
#define print_entry(args...)
#define print_entry_location()
#define print_exit_location()
#define print_exit_status(status)
#define print_exit_pointer(status)
#define print_util_entry(args...)
#define print_util_entry_location()
#define print_util_exit_location()
#define print_util_exit_status(status)
#define print_util_exit_pointer(status)
#endif /* ! UNIONFS_DEBUG */
|