aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs/debug.h')
-rw-r--r--fs/ubifs/debug.h75
1 files changed, 42 insertions, 33 deletions
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
index 8d9c46810189..ad1a6fee6010 100644
--- a/fs/ubifs/debug.h
+++ b/fs/ubifs/debug.h
@@ -169,40 +169,39 @@ struct ubifs_global_debug_info {
169 spin_unlock(&dbg_lock); \ 169 spin_unlock(&dbg_lock); \
170} while (0) 170} while (0)
171 171
172const char *dbg_key_str0(const struct ubifs_info *c, 172#define ubifs_dbg_msg(type, fmt, ...) \
173 const union ubifs_key *key); 173 pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__)
174const char *dbg_key_str1(const struct ubifs_info *c, 174
175 const union ubifs_key *key); 175#define DBG_KEY_BUF_LEN 32
176 176#define ubifs_dbg_msg_key(type, key, fmt, ...) do { \
177/* 177 char __tmp_key_buf[DBG_KEY_BUF_LEN]; \
178 * DBGKEY macros require @dbg_lock to be held, which it is in the dbg message 178 pr_debug("UBIFS DBG " type ": " fmt "%s\n", ##__VA_ARGS__, \
179 * macros. 179 dbg_snprintf_key(c, key, __tmp_key_buf, DBG_KEY_BUF_LEN)); \
180 */
181#define DBGKEY(key) dbg_key_str0(c, (key))
182#define DBGKEY1(key) dbg_key_str1(c, (key))
183
184extern spinlock_t dbg_lock;
185
186#define ubifs_dbg_msg(type, fmt, ...) do { \
187 spin_lock(&dbg_lock); \
188 pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__); \
189 spin_unlock(&dbg_lock); \
190} while (0) 180} while (0)
191 181
192/* Just a debugging messages not related to any specific UBIFS subsystem */ 182/* Just a debugging messages not related to any specific UBIFS subsystem */
193#define dbg_msg(fmt, ...) ubifs_dbg_msg("msg", fmt, ##__VA_ARGS__) 183#define dbg_msg(fmt, ...) \
184 printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", current->pid, \
185 __func__, ##__VA_ARGS__)
186
194/* General messages */ 187/* General messages */
195#define dbg_gen(fmt, ...) ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__) 188#define dbg_gen(fmt, ...) ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__)
196/* Additional journal messages */ 189/* Additional journal messages */
197#define dbg_jnl(fmt, ...) ubifs_dbg_msg("jnl", fmt, ##__VA_ARGS__) 190#define dbg_jnl(fmt, ...) ubifs_dbg_msg("jnl", fmt, ##__VA_ARGS__)
191#define dbg_jnlk(key, fmt, ...) \
192 ubifs_dbg_msg_key("jnl", key, fmt, ##__VA_ARGS__)
198/* Additional TNC messages */ 193/* Additional TNC messages */
199#define dbg_tnc(fmt, ...) ubifs_dbg_msg("tnc", fmt, ##__VA_ARGS__) 194#define dbg_tnc(fmt, ...) ubifs_dbg_msg("tnc", fmt, ##__VA_ARGS__)
195#define dbg_tnck(key, fmt, ...) \
196 ubifs_dbg_msg_key("tnc", key, fmt, ##__VA_ARGS__)
200/* Additional lprops messages */ 197/* Additional lprops messages */
201#define dbg_lp(fmt, ...) ubifs_dbg_msg("lp", fmt, ##__VA_ARGS__) 198#define dbg_lp(fmt, ...) ubifs_dbg_msg("lp", fmt, ##__VA_ARGS__)
202/* Additional LEB find messages */ 199/* Additional LEB find messages */
203#define dbg_find(fmt, ...) ubifs_dbg_msg("find", fmt, ##__VA_ARGS__) 200#define dbg_find(fmt, ...) ubifs_dbg_msg("find", fmt, ##__VA_ARGS__)
204/* Additional mount messages */ 201/* Additional mount messages */
205#define dbg_mnt(fmt, ...) ubifs_dbg_msg("mnt", fmt, ##__VA_ARGS__) 202#define dbg_mnt(fmt, ...) ubifs_dbg_msg("mnt", fmt, ##__VA_ARGS__)
203#define dbg_mntk(key, fmt, ...) \
204 ubifs_dbg_msg_key("mnt", key, fmt, ##__VA_ARGS__)
206/* Additional I/O messages */ 205/* Additional I/O messages */
207#define dbg_io(fmt, ...) ubifs_dbg_msg("io", fmt, ##__VA_ARGS__) 206#define dbg_io(fmt, ...) ubifs_dbg_msg("io", fmt, ##__VA_ARGS__)
208/* Additional commit messages */ 207/* Additional commit messages */
@@ -218,6 +217,7 @@ extern spinlock_t dbg_lock;
218/* Additional recovery messages */ 217/* Additional recovery messages */
219#define dbg_rcvry(fmt, ...) ubifs_dbg_msg("rcvry", fmt, ##__VA_ARGS__) 218#define dbg_rcvry(fmt, ...) ubifs_dbg_msg("rcvry", fmt, ##__VA_ARGS__)
220 219
220extern spinlock_t dbg_lock;
221extern struct ubifs_global_debug_info ubifs_dbg; 221extern struct ubifs_global_debug_info ubifs_dbg;
222 222
223static inline int dbg_is_chk_gen(const struct ubifs_info *c) 223static inline int dbg_is_chk_gen(const struct ubifs_info *c)
@@ -258,6 +258,8 @@ const char *dbg_cstate(int cmt_state);
258const char *dbg_jhead(int jhead); 258const char *dbg_jhead(int jhead);
259const char *dbg_get_key_dump(const struct ubifs_info *c, 259const char *dbg_get_key_dump(const struct ubifs_info *c,
260 const union ubifs_key *key); 260 const union ubifs_key *key);
261const char *dbg_snprintf_key(const struct ubifs_info *c,
262 const union ubifs_key *key, char *buffer, int len);
261void dbg_dump_inode(struct ubifs_info *c, const struct inode *inode); 263void dbg_dump_inode(struct ubifs_info *c, const struct inode *inode);
262void dbg_dump_node(const struct ubifs_info *c, const void *node); 264void dbg_dump_node(const struct ubifs_info *c, const void *node);
263void dbg_dump_lpt_node(const struct ubifs_info *c, void *node, int lnum, 265void dbg_dump_lpt_node(const struct ubifs_info *c, void *node, int lnum,
@@ -345,20 +347,23 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c);
345#define dbg_dump_stack() 347#define dbg_dump_stack()
346#define ubifs_assert_cmt_locked(c) 348#define ubifs_assert_cmt_locked(c)
347 349
348#define dbg_msg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 350#define dbg_msg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
349#define dbg_gen(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 351#define dbg_gen(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
350#define dbg_jnl(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 352#define dbg_jnl(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
351#define dbg_tnc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 353#define dbg_jnlk(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
352#define dbg_lp(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 354#define dbg_tnc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
353#define dbg_find(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 355#define dbg_tnck(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
354#define dbg_mnt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 356#define dbg_lp(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
355#define dbg_io(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 357#define dbg_find(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
356#define dbg_cmt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 358#define dbg_mnt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
357#define dbg_budg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 359#define dbg_mntk(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
358#define dbg_log(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 360#define dbg_io(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
359#define dbg_gc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 361#define dbg_cmt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
360#define dbg_scan(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 362#define dbg_budg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
361#define dbg_rcvry(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) 363#define dbg_log(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
364#define dbg_gc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
365#define dbg_scan(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
366#define dbg_rcvry(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
362 367
363static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; } 368static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; }
364static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; } 369static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; }
@@ -368,6 +373,10 @@ static inline const char *dbg_jhead(int jhead) { return ""; }
368static inline const char * 373static inline const char *
369dbg_get_key_dump(const struct ubifs_info *c, 374dbg_get_key_dump(const struct ubifs_info *c,
370 const union ubifs_key *key) { return ""; } 375 const union ubifs_key *key) { return ""; }
376static inline const char *
377dbg_snprintf_key(const struct ubifs_info *c,
378 const union ubifs_key *key, char *buffer,
379 int len) { return ""; }
371static inline void dbg_dump_inode(struct ubifs_info *c, 380static inline void dbg_dump_inode(struct ubifs_info *c,
372 const struct inode *inode) { return; } 381 const struct inode *inode) { return; }
373static inline void dbg_dump_node(const struct ubifs_info *c, 382static inline void dbg_dump_node(const struct ubifs_info *c,