*
* For licensing information, see the file 'LICENCE' in this directory.
*
- * $Id: debug.h,v 1.13 2005/08/17 13:42:06 dedekind Exp $
+ * $Id: debug.h,v 1.21 2005/11/07 11:14:39 gleixner Exp $
*
*/
#ifndef _JFFS2_DEBUG_H_
#define CONFIG_JFFS2_FS_DEBUG 0
#endif
-#if CONFIG_JFFS2_FS_DEBUG == 1
+#if CONFIG_JFFS2_FS_DEBUG > 0
/* Enable "paranoia" checks and dumps */
#define JFFS2_DBG_PARANOIA_CHECKS
#define JFFS2_DBG_DUMPS
+
+/*
+ * By defining/undefining the below macros one may select debugging messages
+ * fro specific JFFS2 subsystems.
+ */
#define JFFS2_DBG_READINODE_MESSAGES
#define JFFS2_DBG_FRAGTREE_MESSAGES
#define JFFS2_DBG_DENTLIST_MESSAGES
#define JFFS2_DBG_NODEREF_MESSAGES
#define JFFS2_DBG_INOCACHE_MESSAGES
+#define JFFS2_DBG_SUMMARY_MESSAGES
+#define JFFS2_DBG_FSBUILD_MESSAGES
#endif
-#if CONFIG_JFFS2_FS_DEBUG == 2
+#if CONFIG_JFFS2_FS_DEBUG > 1
#define JFFS2_DBG_FRAGTREE2_MESSAGES
+#define JFFS2_DBG_MEMALLOC_MESSAGES
#endif
/* Sanity checks are supposed to be light-weight and enabled by default */
#define JFFS2_DBG_SANITY_CHECKS
-/*
+/*
* Dx() are mainly used for debugging messages, they must go away and be
- * superseded by nicer JFFS2_DBG_XXX() macros...
+ * superseded by nicer dbg_xxx() macros...
*/
#if CONFIG_JFFS2_FS_DEBUG > 0
#define D1(x) x
#endif
/* The prefixes of JFFS2 messages */
-#define JFFS2_DBG_MSG_PREFIX "[JFFS2 DBG]"
-#define JFFS2_ERR_MSG_PREFIX "JFFS2 error:"
-#define JFFS2_WARN_MSG_PREFIX "JFFS2 warning:"
-#define JFFS2_NOTICE_MSG_PREFIX "JFFS2 notice:"
+#define JFFS2_DBG_PREFIX "[JFFS2 DBG]"
+#define JFFS2_ERR_PREFIX "JFFS2 error:"
+#define JFFS2_WARN_PREFIX "JFFS2 warning:"
+#define JFFS2_NOTICE_PREFIX "JFFS2 notice:"
-#define JFFS2_ERR_LVL KERN_ERR
-#define JFFS2_WARN_LVL KERN_WARNING
-#define JFFS2_NOTICE_LVL KERN_NOTICE
-#define JFFS2_DBG_LVL KERN_DEBUG
+#define JFFS2_ERR KERN_ERR
+#define JFFS2_WARN KERN_WARNING
+#define JFFS2_NOT KERN_NOTICE
+#define JFFS2_DBG KERN_DEBUG
+
+#define JFFS2_DBG_MSG_PREFIX JFFS2_DBG JFFS2_DBG_PREFIX
+#define JFFS2_ERR_MSG_PREFIX JFFS2_ERR JFFS2_ERR_PREFIX
+#define JFFS2_WARN_MSG_PREFIX JFFS2_WARN JFFS2_WARN_PREFIX
+#define JFFS2_NOTICE_MSG_PREFIX JFFS2_NOT JFFS2_NOTICE_PREFIX
/* JFFS2 message macros */
#define JFFS2_ERROR(fmt, ...) \
do { \
- printk(JFFS2_ERR_LVL JFFS2_ERR_MSG_PREFIX \
- " %d (%s): " fmt, current->pid, \
- __FUNCTION__, ##__VA_ARGS__); \
+ printk(JFFS2_ERR_MSG_PREFIX \
+ " (%d) %s: " fmt, current->pid, \
+ __FUNCTION__ , ##__VA_ARGS__); \
} while(0)
#define JFFS2_WARNING(fmt, ...) \
do { \
- printk(JFFS2_WARN_LVL JFFS2_WARN_MSG_PREFIX \
- " %d (%s): " fmt, current->pid, \
- __FUNCTION__, ##__VA_ARGS__); \
+ printk(JFFS2_WARN_MSG_PREFIX \
+ " (%d) %s: " fmt, current->pid, \
+ __FUNCTION__ , ##__VA_ARGS__); \
} while(0)
-
+
#define JFFS2_NOTICE(fmt, ...) \
do { \
- printk(JFFS2_NOTICE_LVL JFFS2_NOTICE_MSG_PREFIX \
- " %d (%s): " fmt, current->pid, \
- __FUNCTION__, ##__VA_ARGS__); \
+ printk(JFFS2_NOTICE_MSG_PREFIX \
+ " (%d) %s: " fmt, current->pid, \
+ __FUNCTION__ , ##__VA_ARGS__); \
} while(0)
#define JFFS2_DEBUG(fmt, ...) \
do { \
- printk(JFFS2_DBG_LVL JFFS2_DBG_MSG_PREFIX \
- " %d (%s): " fmt, current->pid, \
- __FUNCTION__, ##__VA_ARGS__); \
+ printk(JFFS2_DBG_MSG_PREFIX \
+ " (%d) %s: " fmt, current->pid, \
+ __FUNCTION__ , ##__VA_ARGS__); \
} while(0)
-/*
+/*
* We split our debugging messages on several parts, depending on the JFFS2
* subsystem the message belongs to.
*/
/* Read inode debugging messages */
#ifdef JFFS2_DBG_READINODE_MESSAGES
-#define JFFS2_DBG_READINODE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#define dbg_readinode(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
-#define JFFS2_DBG_READINODE(fmt, ...)
+#define dbg_readinode(fmt, ...)
#endif
/* Fragtree build debugging messages */
#ifdef JFFS2_DBG_FRAGTREE_MESSAGES
-#define JFFS2_DBG_FRAGTREE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#define dbg_fragtree(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
-#define JFFS2_DBG_FRAGTREE(fmt, ...)
+#define dbg_fragtree(fmt, ...)
#endif
#ifdef JFFS2_DBG_FRAGTREE2_MESSAGES
-#define JFFS2_DBG_FRAGTREE2(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#define dbg_fragtree2(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
-#define JFFS2_DBG_FRAGTREE2(fmt, ...)
+#define dbg_fragtree2(fmt, ...)
#endif
/* Directory entry list manilulation debugging messages */
#ifdef JFFS2_DBG_DENTLIST_MESSAGES
-#define JFFS2_DBG_DENTLIST(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#define dbg_dentlist(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
-#define JFFS2_DBG_DENTLIST(fmt, ...)
+#define dbg_dentlist(fmt, ...)
#endif
/* Print the messages about manipulating node_refs */
#ifdef JFFS2_DBG_NODEREF_MESSAGES
-#define JFFS2_DBG_NODEREF(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#define dbg_noderef(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
-#define JFFS2_DBG_NODEREF(fmt, ...)
+#define dbg_noderef(fmt, ...)
#endif
/* Manipulations with the list of inodes (JFFS2 inocache) */
#ifdef JFFS2_DBG_INOCACHE_MESSAGES
-#define JFFS2_DBG_INOCACHE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#define dbg_inocache(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#else
+#define dbg_inocache(fmt, ...)
+#endif
+
+/* Summary debugging messages */
+#ifdef JFFS2_DBG_SUMMARY_MESSAGES
+#define dbg_summary(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
-#define JFFS2_DBG_INOCACHE(fmt, ...)
+#define dbg_summary(fmt, ...)
+#endif
+
+/* File system build messages */
+#ifdef JFFS2_DBG_FSBUILD_MESSAGES
+#define dbg_fsbuild(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#else
+#define dbg_fsbuild(fmt, ...)
#endif
/* Watch the object allocations */
#ifdef JFFS2_DBG_MEMALLOC_MESSAGES
-#define JFFS2_DBG_MEMALLOC(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#define dbg_memalloc(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
-#define JFFS2_DBG_MEMALLOC(fmt, ...)
+#define dbg_memalloc(fmt, ...)
#endif
+/* Watch the XATTR subsystem */
+#ifdef JFFS2_DBG_XATTR_MESSAGES
+#define dbg_xattr(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#else
+#define dbg_xattr(fmt, ...)
+#endif
/* "Sanity" checks */
void