mtd/fs/jffs3 debug.h,1.2,1.3
Artem Bityuckiy
dedekind at infradead.org
Mon Dec 13 14:00:16 EST 2004
Update of /home/cvs/mtd/fs/jffs3
In directory phoenix.infradead.org:/tmp/cvs-serv25066
Modified Files:
debug.h
Log Message:
Add macro definitions for output. Split debugging messages on
subsystems, enable all by default.
Index: debug.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/debug.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- debug.h 13 Dec 2004 17:15:46 -0000 1.2
+++ debug.h 13 Dec 2004 19:00:12 -0000 1.3
@@ -18,11 +18,77 @@
#define JFFS3_DBG_SANITY_CHECKS
+/* JFFS3 subsystems */
+#define JFFS3_DBG_OTHER 1
+#define JFFS3_DBG_SCAN 2
#if CONFIG_JFFS3_FS_DEBUG > 0
-#define JFFS3_DBG_PARANOIA_CHECKS
+#define JFFS3_DBG_PARANOIA_CHECKS 1 /* By default enable all paranoid checks */
+/* By default print the debugging messages from any JFFS3 subsystem */
+#define JFFS3_DBG_SUBSYS_OTHER_PRINT 1
+#define JFFS3_DBG_SUBSYS_SCAN_PRINT 1
+#else
+#define JFFS3_DBG_SUBSYS_OTHER_PRINT 0
+#define JFFS3_DBG_SUBSYS_SCAN_PRINT 0
#endif
+/*
+ * When developing JFFS3 it is often useful to enable debugging messages
+ * for some particular JFFS3 subsystem. This function prints message
+ * only if the messages for the specified JFFS3 subsystem are enabled.
+ */
+#define JFFS3DBG_SUBSYSTEM(subsystem, debug_level, args...) \
+do { \
+ char *subsysname = NULL; \
+ if ((debug_level) >= CONFIG_JFFS3_FS_DEBUG) { \
+ switch (subsystem) { \
+ case JFFS3_DBG_SCAN: \
+ if (JFFS3_DBG_SUBSYS_SCAN_PRINT) \
+ subsysname = "scan"; \
+ break; \
+ case JFFS3_DBG_OTHER: \
+ if (JFFS3_DBG_SUBSYS_OTHER_PRINT) \
+ subsysname = ""; \
+ break; \
+ default: \
+ BUG(); \
+ } \
+ if (subsysname) { \
+ printk(KERN_DEBUG "[JFFS3 DBG-L%d", debug_level); \
+ if (subsysname[0]) \
+ printk(", %s] ", subsysname); \
+ else \
+ printk("] "); \
+ printk("%s(): ", __FUNCTION__); \
+ printk(args); \
+ } \
+ } \
+} while(0)
+
+#define DBG(debug_level, args...) \
+ JFFS3DBG_SUBSYSTEM(JFFS3_DBG_OTHER, debug_level, args)
+
+#define DBG_SCAN(debug_level, args...) \
+ JFFS3DBG_SUBSYSTEM(JFFS3_DBG_SCAN, debug_level, args)
+
+#define ERROR_MSG(args...) \
+ do { \
+ printk(KERN_ERR "[JFFS3] Error in %s(): ", __FUNCTION__); \
+ printk(args); \
+ } while(0)
+
+#define WARNING_MSG(args...) \
+ do { \
+ printk(KERN_ERR "[JFFS3] Warning in %s(): ", __FUNCTION__); \
+ printk(args); \
+ } while(0)
+
+#define NOTICE_MSG(args...) \
+ do { \
+ printk(KERN_NOTICE "[JFFS3]: "); \
+ printk(args); \
+ } while(0)
+
void
jffs3_dbg_acct_paranoia_check(struct jffs3_sb_info *c, struct jffs3_eraseblock *jeb);
More information about the linux-mtd-cvs
mailing list