aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/debug.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-13 13:31:33 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-13 13:31:33 -0500
commit94b1984ab9ab61cc6047c07e074d766485299a9c (patch)
tree4b6cba21caf3d99129bea6a5eba0544b2fe8402a /fs/ubifs/debug.h
parent1a52bb0b686844021597d190e562ab55d1210104 (diff)
parent515315a123af641a9533e4ff0f178c470dc08fc7 (diff)
Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
* 'linux-next' of git://git.infradead.org/ubifs-2.6: UBIFS: fix key printing UBIFS: use snprintf instead of sprintf when printing keys UBIFS: fix debugging messages UBIFS: make debugging messages light again UBI: fix debugging messages UBI: make vid_hdr non-static
Diffstat (limited to 'fs/ubifs/debug.h')
-rw-r--r--fs/ubifs/debug.h44
1 files changed, 25 insertions, 19 deletions
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
index 8d9c46810189..307ab1d23f75 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,
@@ -368,6 +370,10 @@ static inline const char *dbg_jhead(int jhead) { return ""; }
368static inline const char * 370static inline const char *
369dbg_get_key_dump(const struct ubifs_info *c, 371dbg_get_key_dump(const struct ubifs_info *c,
370 const union ubifs_key *key) { return ""; } 372 const union ubifs_key *key) { return ""; }
373static inline const char *
374dbg_snprintf_key(const struct ubifs_info *c,
375 const union ubifs_key *key, char *buffer,
376 int len) { return ""; }
371static inline void dbg_dump_inode(struct ubifs_info *c, 377static inline void dbg_dump_inode(struct ubifs_info *c,
372 const struct inode *inode) { return; } 378 const struct inode *inode) { return; }
373static inline void dbg_dump_node(const struct ubifs_info *c, 379static inline void dbg_dump_node(const struct ubifs_info *c,