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.h217
1 files changed, 25 insertions, 192 deletions
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
index 9f717655df18..486a8e024fb6 100644
--- a/fs/ubifs/debug.h
+++ b/fs/ubifs/debug.h
@@ -29,8 +29,6 @@ typedef int (*dbg_leaf_callback)(struct ubifs_info *c,
29typedef int (*dbg_znode_callback)(struct ubifs_info *c, 29typedef int (*dbg_znode_callback)(struct ubifs_info *c,
30 struct ubifs_znode *znode, void *priv); 30 struct ubifs_znode *znode, void *priv);
31 31
32#ifdef CONFIG_UBIFS_FS_DEBUG
33
34/* 32/*
35 * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi" 33 * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi"
36 * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte. 34 * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte.
@@ -149,7 +147,7 @@ struct ubifs_global_debug_info {
149 if (unlikely(!(expr))) { \ 147 if (unlikely(!(expr))) { \
150 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ 148 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
151 __func__, __LINE__, current->pid); \ 149 __func__, __LINE__, current->pid); \
152 dbg_dump_stack(); \ 150 dump_stack(); \
153 } \ 151 } \
154} while (0) 152} while (0)
155 153
@@ -161,12 +159,6 @@ struct ubifs_global_debug_info {
161 } \ 159 } \
162} while (0) 160} while (0)
163 161
164#define dbg_dump_stack() dump_stack()
165
166#define dbg_err(fmt, ...) do { \
167 ubifs_err(fmt, ##__VA_ARGS__); \
168} while (0)
169
170#define ubifs_dbg_msg(type, fmt, ...) \ 162#define ubifs_dbg_msg(type, fmt, ...) \
171 pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__) 163 pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__)
172 164
@@ -257,27 +249,27 @@ const char *dbg_get_key_dump(const struct ubifs_info *c,
257 const union ubifs_key *key); 249 const union ubifs_key *key);
258const char *dbg_snprintf_key(const struct ubifs_info *c, 250const char *dbg_snprintf_key(const struct ubifs_info *c,
259 const union ubifs_key *key, char *buffer, int len); 251 const union ubifs_key *key, char *buffer, int len);
260void dbg_dump_inode(struct ubifs_info *c, const struct inode *inode); 252void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode);
261void dbg_dump_node(const struct ubifs_info *c, const void *node); 253void ubifs_dump_node(const struct ubifs_info *c, const void *node);
262void dbg_dump_lpt_node(const struct ubifs_info *c, void *node, int lnum, 254void ubifs_dump_budget_req(const struct ubifs_budget_req *req);
263 int offs); 255void ubifs_dump_lstats(const struct ubifs_lp_stats *lst);
264void dbg_dump_budget_req(const struct ubifs_budget_req *req); 256void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi);
265void dbg_dump_lstats(const struct ubifs_lp_stats *lst); 257void ubifs_dump_lprop(const struct ubifs_info *c,
266void dbg_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi); 258 const struct ubifs_lprops *lp);
267void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp); 259void ubifs_dump_lprops(struct ubifs_info *c);
268void dbg_dump_lprops(struct ubifs_info *c); 260void ubifs_dump_lpt_info(struct ubifs_info *c);
269void dbg_dump_lpt_info(struct ubifs_info *c); 261void ubifs_dump_leb(const struct ubifs_info *c, int lnum);
270void dbg_dump_leb(const struct ubifs_info *c, int lnum); 262void ubifs_dump_sleb(const struct ubifs_info *c,
271void dbg_dump_sleb(const struct ubifs_info *c, 263 const struct ubifs_scan_leb *sleb, int offs);
272 const struct ubifs_scan_leb *sleb, int offs); 264void ubifs_dump_znode(const struct ubifs_info *c,
273void dbg_dump_znode(const struct ubifs_info *c, 265 const struct ubifs_znode *znode);
274 const struct ubifs_znode *znode); 266void ubifs_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap,
275void dbg_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat); 267 int cat);
276void dbg_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, 268void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
277 struct ubifs_nnode *parent, int iip); 269 struct ubifs_nnode *parent, int iip);
278void dbg_dump_tnc(struct ubifs_info *c); 270void ubifs_dump_tnc(struct ubifs_info *c);
279void dbg_dump_index(struct ubifs_info *c); 271void ubifs_dump_index(struct ubifs_info *c);
280void dbg_dump_lpt_lebs(const struct ubifs_info *c); 272void ubifs_dump_lpt_lebs(const struct ubifs_info *c);
281 273
282int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, 274int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
283 dbg_znode_callback znode_cb, void *priv); 275 dbg_znode_callback znode_cb, void *priv);
@@ -307,11 +299,10 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head);
307int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); 299int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head);
308 300
309int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, 301int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs,
310 int len, int dtype); 302 int len);
311int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, 303int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len);
312 int dtype);
313int dbg_leb_unmap(struct ubifs_info *c, int lnum); 304int dbg_leb_unmap(struct ubifs_info *c, int lnum);
314int dbg_leb_map(struct ubifs_info *c, int lnum, int dtype); 305int dbg_leb_map(struct ubifs_info *c, int lnum);
315 306
316/* Debugfs-related stuff */ 307/* Debugfs-related stuff */
317int dbg_debugfs_init(void); 308int dbg_debugfs_init(void);
@@ -319,162 +310,4 @@ void dbg_debugfs_exit(void);
319int dbg_debugfs_init_fs(struct ubifs_info *c); 310int dbg_debugfs_init_fs(struct ubifs_info *c);
320void dbg_debugfs_exit_fs(struct ubifs_info *c); 311void dbg_debugfs_exit_fs(struct ubifs_info *c);
321 312
322#else /* !CONFIG_UBIFS_FS_DEBUG */
323
324/* Use "if (0)" to make compiler check arguments even if debugging is off */
325#define ubifs_assert(expr) do { \
326 if (0) \
327 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
328 __func__, __LINE__, current->pid); \
329} while (0)
330
331#define dbg_err(fmt, ...) do { \
332 if (0) \
333 ubifs_err(fmt, ##__VA_ARGS__); \
334} while (0)
335
336#define DBGKEY(key) ((char *)(key))
337#define DBGKEY1(key) ((char *)(key))
338
339#define ubifs_dbg_msg(fmt, ...) do { \
340 if (0) \
341 printk(KERN_DEBUG fmt "\n", ##__VA_ARGS__); \
342} while (0)
343
344#define dbg_dump_stack()
345#define ubifs_assert_cmt_locked(c)
346
347#define dbg_msg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
348#define dbg_gen(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
349#define dbg_jnl(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
350#define dbg_jnlk(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
351#define dbg_tnc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
352#define dbg_tnck(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
353#define dbg_lp(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
354#define dbg_find(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
355#define dbg_mnt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
356#define dbg_mntk(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
357#define dbg_io(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
358#define dbg_cmt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
359#define dbg_budg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
360#define dbg_log(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
361#define dbg_gc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
362#define dbg_scan(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
363#define dbg_rcvry(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
364
365static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; }
366static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; }
367static inline const char *dbg_ntype(int type) { return ""; }
368static inline const char *dbg_cstate(int cmt_state) { return ""; }
369static inline const char *dbg_jhead(int jhead) { return ""; }
370static inline const char *
371dbg_get_key_dump(const struct ubifs_info *c,
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 ""; }
377static inline void dbg_dump_inode(struct ubifs_info *c,
378 const struct inode *inode) { return; }
379static inline void dbg_dump_node(const struct ubifs_info *c,
380 const void *node) { return; }
381static inline void dbg_dump_lpt_node(const struct ubifs_info *c,
382 void *node, int lnum,
383 int offs) { return; }
384static inline void
385dbg_dump_budget_req(const struct ubifs_budget_req *req) { return; }
386static inline void
387dbg_dump_lstats(const struct ubifs_lp_stats *lst) { return; }
388static inline void
389dbg_dump_budg(struct ubifs_info *c,
390 const struct ubifs_budg_info *bi) { return; }
391static inline void dbg_dump_lprop(const struct ubifs_info *c,
392 const struct ubifs_lprops *lp) { return; }
393static inline void dbg_dump_lprops(struct ubifs_info *c) { return; }
394static inline void dbg_dump_lpt_info(struct ubifs_info *c) { return; }
395static inline void dbg_dump_leb(const struct ubifs_info *c,
396 int lnum) { return; }
397static inline void
398dbg_dump_sleb(const struct ubifs_info *c,
399 const struct ubifs_scan_leb *sleb, int offs) { return; }
400static inline void
401dbg_dump_znode(const struct ubifs_info *c,
402 const struct ubifs_znode *znode) { return; }
403static inline void dbg_dump_heap(struct ubifs_info *c,
404 struct ubifs_lpt_heap *heap,
405 int cat) { return; }
406static inline void dbg_dump_pnode(struct ubifs_info *c,
407 struct ubifs_pnode *pnode,
408 struct ubifs_nnode *parent,
409 int iip) { return; }
410static inline void dbg_dump_tnc(struct ubifs_info *c) { return; }
411static inline void dbg_dump_index(struct ubifs_info *c) { return; }
412static inline void dbg_dump_lpt_lebs(const struct ubifs_info *c) { return; }
413
414static inline int dbg_walk_index(struct ubifs_info *c,
415 dbg_leaf_callback leaf_cb,
416 dbg_znode_callback znode_cb,
417 void *priv) { return 0; }
418static inline void dbg_save_space_info(struct ubifs_info *c) { return; }
419static inline int dbg_check_space_info(struct ubifs_info *c) { return 0; }
420static inline int dbg_check_lprops(struct ubifs_info *c) { return 0; }
421static inline int
422dbg_old_index_check_init(struct ubifs_info *c,
423 struct ubifs_zbranch *zroot) { return 0; }
424static inline int
425dbg_check_old_index(struct ubifs_info *c,
426 struct ubifs_zbranch *zroot) { return 0; }
427static inline int dbg_check_cats(struct ubifs_info *c) { return 0; }
428static inline int dbg_check_ltab(struct ubifs_info *c) { return 0; }
429static inline int dbg_chk_lpt_free_spc(struct ubifs_info *c) { return 0; }
430static inline int dbg_chk_lpt_sz(struct ubifs_info *c,
431 int action, int len) { return 0; }
432static inline int
433dbg_check_synced_i_size(const struct ubifs_info *c,
434 struct inode *inode) { return 0; }
435static inline int dbg_check_dir(struct ubifs_info *c,
436 const struct inode *dir) { return 0; }
437static inline int dbg_check_tnc(struct ubifs_info *c, int extra) { return 0; }
438static inline int dbg_check_idx_size(struct ubifs_info *c,
439 long long idx_size) { return 0; }
440static inline int dbg_check_filesystem(struct ubifs_info *c) { return 0; }
441static inline void dbg_check_heap(struct ubifs_info *c,
442 struct ubifs_lpt_heap *heap,
443 int cat, int add_pos) { return; }
444static inline int dbg_check_lpt_nodes(struct ubifs_info *c,
445 struct ubifs_cnode *cnode, int row, int col) { return 0; }
446static inline int dbg_check_inode_size(struct ubifs_info *c,
447 const struct inode *inode,
448 loff_t size) { return 0; }
449static inline int
450dbg_check_data_nodes_order(struct ubifs_info *c,
451 struct list_head *head) { return 0; }
452static inline int
453dbg_check_nondata_nodes_order(struct ubifs_info *c,
454 struct list_head *head) { return 0; }
455
456static inline int dbg_leb_write(struct ubifs_info *c, int lnum,
457 const void *buf, int offset,
458 int len, int dtype) { return 0; }
459static inline int dbg_leb_change(struct ubifs_info *c, int lnum,
460 const void *buf, int len,
461 int dtype) { return 0; }
462static inline int dbg_leb_unmap(struct ubifs_info *c, int lnum) { return 0; }
463static inline int dbg_leb_map(struct ubifs_info *c, int lnum,
464 int dtype) { return 0; }
465
466static inline int dbg_is_chk_gen(const struct ubifs_info *c) { return 0; }
467static inline int dbg_is_chk_index(const struct ubifs_info *c) { return 0; }
468static inline int dbg_is_chk_orph(const struct ubifs_info *c) { return 0; }
469static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; }
470static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; }
471static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; }
472static inline int dbg_is_power_cut(const struct ubifs_info *c) { return 0; }
473
474static inline int dbg_debugfs_init(void) { return 0; }
475static inline void dbg_debugfs_exit(void) { return; }
476static inline int dbg_debugfs_init_fs(struct ubifs_info *c) { return 0; }
477static inline int dbg_debugfs_exit_fs(struct ubifs_info *c) { return 0; }
478
479#endif /* !CONFIG_UBIFS_FS_DEBUG */
480#endif /* !__UBIFS_DEBUG_H__ */ 313#endif /* !__UBIFS_DEBUG_H__ */