diff options
Diffstat (limited to 'fs/ubifs/debug.h')
-rw-r--r-- | fs/ubifs/debug.h | 217 |
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, | |||
29 | typedef int (*dbg_znode_callback)(struct ubifs_info *c, | 29 | typedef 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); |
258 | const char *dbg_snprintf_key(const struct ubifs_info *c, | 250 | const 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); |
260 | void dbg_dump_inode(struct ubifs_info *c, const struct inode *inode); | 252 | void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode); |
261 | void dbg_dump_node(const struct ubifs_info *c, const void *node); | 253 | void ubifs_dump_node(const struct ubifs_info *c, const void *node); |
262 | void dbg_dump_lpt_node(const struct ubifs_info *c, void *node, int lnum, | 254 | void ubifs_dump_budget_req(const struct ubifs_budget_req *req); |
263 | int offs); | 255 | void ubifs_dump_lstats(const struct ubifs_lp_stats *lst); |
264 | void dbg_dump_budget_req(const struct ubifs_budget_req *req); | 256 | void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi); |
265 | void dbg_dump_lstats(const struct ubifs_lp_stats *lst); | 257 | void ubifs_dump_lprop(const struct ubifs_info *c, |
266 | void dbg_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi); | 258 | const struct ubifs_lprops *lp); |
267 | void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp); | 259 | void ubifs_dump_lprops(struct ubifs_info *c); |
268 | void dbg_dump_lprops(struct ubifs_info *c); | 260 | void ubifs_dump_lpt_info(struct ubifs_info *c); |
269 | void dbg_dump_lpt_info(struct ubifs_info *c); | 261 | void ubifs_dump_leb(const struct ubifs_info *c, int lnum); |
270 | void dbg_dump_leb(const struct ubifs_info *c, int lnum); | 262 | void ubifs_dump_sleb(const struct ubifs_info *c, |
271 | void 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); | 264 | void ubifs_dump_znode(const struct ubifs_info *c, |
273 | void dbg_dump_znode(const struct ubifs_info *c, | 265 | const struct ubifs_znode *znode); |
274 | const struct ubifs_znode *znode); | 266 | void ubifs_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, |
275 | void dbg_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat); | 267 | int cat); |
276 | void dbg_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | 268 | void 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); |
278 | void dbg_dump_tnc(struct ubifs_info *c); | 270 | void ubifs_dump_tnc(struct ubifs_info *c); |
279 | void dbg_dump_index(struct ubifs_info *c); | 271 | void ubifs_dump_index(struct ubifs_info *c); |
280 | void dbg_dump_lpt_lebs(const struct ubifs_info *c); | 272 | void ubifs_dump_lpt_lebs(const struct ubifs_info *c); |
281 | 273 | ||
282 | int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | 274 | int 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); | |||
307 | int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); | 299 | int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); |
308 | 300 | ||
309 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | 301 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, |
310 | int len, int dtype); | 302 | int len); |
311 | int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, | 303 | int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len); |
312 | int dtype); | ||
313 | int dbg_leb_unmap(struct ubifs_info *c, int lnum); | 304 | int dbg_leb_unmap(struct ubifs_info *c, int lnum); |
314 | int dbg_leb_map(struct ubifs_info *c, int lnum, int dtype); | 305 | int dbg_leb_map(struct ubifs_info *c, int lnum); |
315 | 306 | ||
316 | /* Debugfs-related stuff */ | 307 | /* Debugfs-related stuff */ |
317 | int dbg_debugfs_init(void); | 308 | int dbg_debugfs_init(void); |
@@ -319,162 +310,4 @@ void dbg_debugfs_exit(void); | |||
319 | int dbg_debugfs_init_fs(struct ubifs_info *c); | 310 | int dbg_debugfs_init_fs(struct ubifs_info *c); |
320 | void dbg_debugfs_exit_fs(struct ubifs_info *c); | 311 | void 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 | |||
365 | static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; } | ||
366 | static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; } | ||
367 | static inline const char *dbg_ntype(int type) { return ""; } | ||
368 | static inline const char *dbg_cstate(int cmt_state) { return ""; } | ||
369 | static inline const char *dbg_jhead(int jhead) { return ""; } | ||
370 | static inline const char * | ||
371 | dbg_get_key_dump(const struct ubifs_info *c, | ||
372 | const union ubifs_key *key) { return ""; } | ||
373 | static inline const char * | ||
374 | dbg_snprintf_key(const struct ubifs_info *c, | ||
375 | const union ubifs_key *key, char *buffer, | ||
376 | int len) { return ""; } | ||
377 | static inline void dbg_dump_inode(struct ubifs_info *c, | ||
378 | const struct inode *inode) { return; } | ||
379 | static inline void dbg_dump_node(const struct ubifs_info *c, | ||
380 | const void *node) { return; } | ||
381 | static inline void dbg_dump_lpt_node(const struct ubifs_info *c, | ||
382 | void *node, int lnum, | ||
383 | int offs) { return; } | ||
384 | static inline void | ||
385 | dbg_dump_budget_req(const struct ubifs_budget_req *req) { return; } | ||
386 | static inline void | ||
387 | dbg_dump_lstats(const struct ubifs_lp_stats *lst) { return; } | ||
388 | static inline void | ||
389 | dbg_dump_budg(struct ubifs_info *c, | ||
390 | const struct ubifs_budg_info *bi) { return; } | ||
391 | static inline void dbg_dump_lprop(const struct ubifs_info *c, | ||
392 | const struct ubifs_lprops *lp) { return; } | ||
393 | static inline void dbg_dump_lprops(struct ubifs_info *c) { return; } | ||
394 | static inline void dbg_dump_lpt_info(struct ubifs_info *c) { return; } | ||
395 | static inline void dbg_dump_leb(const struct ubifs_info *c, | ||
396 | int lnum) { return; } | ||
397 | static inline void | ||
398 | dbg_dump_sleb(const struct ubifs_info *c, | ||
399 | const struct ubifs_scan_leb *sleb, int offs) { return; } | ||
400 | static inline void | ||
401 | dbg_dump_znode(const struct ubifs_info *c, | ||
402 | const struct ubifs_znode *znode) { return; } | ||
403 | static inline void dbg_dump_heap(struct ubifs_info *c, | ||
404 | struct ubifs_lpt_heap *heap, | ||
405 | int cat) { return; } | ||
406 | static inline void dbg_dump_pnode(struct ubifs_info *c, | ||
407 | struct ubifs_pnode *pnode, | ||
408 | struct ubifs_nnode *parent, | ||
409 | int iip) { return; } | ||
410 | static inline void dbg_dump_tnc(struct ubifs_info *c) { return; } | ||
411 | static inline void dbg_dump_index(struct ubifs_info *c) { return; } | ||
412 | static inline void dbg_dump_lpt_lebs(const struct ubifs_info *c) { return; } | ||
413 | |||
414 | static 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; } | ||
418 | static inline void dbg_save_space_info(struct ubifs_info *c) { return; } | ||
419 | static inline int dbg_check_space_info(struct ubifs_info *c) { return 0; } | ||
420 | static inline int dbg_check_lprops(struct ubifs_info *c) { return 0; } | ||
421 | static inline int | ||
422 | dbg_old_index_check_init(struct ubifs_info *c, | ||
423 | struct ubifs_zbranch *zroot) { return 0; } | ||
424 | static inline int | ||
425 | dbg_check_old_index(struct ubifs_info *c, | ||
426 | struct ubifs_zbranch *zroot) { return 0; } | ||
427 | static inline int dbg_check_cats(struct ubifs_info *c) { return 0; } | ||
428 | static inline int dbg_check_ltab(struct ubifs_info *c) { return 0; } | ||
429 | static inline int dbg_chk_lpt_free_spc(struct ubifs_info *c) { return 0; } | ||
430 | static inline int dbg_chk_lpt_sz(struct ubifs_info *c, | ||
431 | int action, int len) { return 0; } | ||
432 | static inline int | ||
433 | dbg_check_synced_i_size(const struct ubifs_info *c, | ||
434 | struct inode *inode) { return 0; } | ||
435 | static inline int dbg_check_dir(struct ubifs_info *c, | ||
436 | const struct inode *dir) { return 0; } | ||
437 | static inline int dbg_check_tnc(struct ubifs_info *c, int extra) { return 0; } | ||
438 | static inline int dbg_check_idx_size(struct ubifs_info *c, | ||
439 | long long idx_size) { return 0; } | ||
440 | static inline int dbg_check_filesystem(struct ubifs_info *c) { return 0; } | ||
441 | static inline void dbg_check_heap(struct ubifs_info *c, | ||
442 | struct ubifs_lpt_heap *heap, | ||
443 | int cat, int add_pos) { return; } | ||
444 | static inline int dbg_check_lpt_nodes(struct ubifs_info *c, | ||
445 | struct ubifs_cnode *cnode, int row, int col) { return 0; } | ||
446 | static inline int dbg_check_inode_size(struct ubifs_info *c, | ||
447 | const struct inode *inode, | ||
448 | loff_t size) { return 0; } | ||
449 | static inline int | ||
450 | dbg_check_data_nodes_order(struct ubifs_info *c, | ||
451 | struct list_head *head) { return 0; } | ||
452 | static inline int | ||
453 | dbg_check_nondata_nodes_order(struct ubifs_info *c, | ||
454 | struct list_head *head) { return 0; } | ||
455 | |||
456 | static inline int dbg_leb_write(struct ubifs_info *c, int lnum, | ||
457 | const void *buf, int offset, | ||
458 | int len, int dtype) { return 0; } | ||
459 | static inline int dbg_leb_change(struct ubifs_info *c, int lnum, | ||
460 | const void *buf, int len, | ||
461 | int dtype) { return 0; } | ||
462 | static inline int dbg_leb_unmap(struct ubifs_info *c, int lnum) { return 0; } | ||
463 | static inline int dbg_leb_map(struct ubifs_info *c, int lnum, | ||
464 | int dtype) { return 0; } | ||
465 | |||
466 | static inline int dbg_is_chk_gen(const struct ubifs_info *c) { return 0; } | ||
467 | static inline int dbg_is_chk_index(const struct ubifs_info *c) { return 0; } | ||
468 | static inline int dbg_is_chk_orph(const struct ubifs_info *c) { return 0; } | ||
469 | static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; } | ||
470 | static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; } | ||
471 | static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; } | ||
472 | static inline int dbg_is_power_cut(const struct ubifs_info *c) { return 0; } | ||
473 | |||
474 | static inline int dbg_debugfs_init(void) { return 0; } | ||
475 | static inline void dbg_debugfs_exit(void) { return; } | ||
476 | static inline int dbg_debugfs_init_fs(struct ubifs_info *c) { return 0; } | ||
477 | static 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__ */ |