debug.h (7fbb8759eff9a348efa5f352ffaa51c364837c4b) | debug.h (17c2f9f85c896b48a5d74a9155d99ec5b241a0e6) |
---|---|
1/* 2 * This file is part of UBIFS. 3 * 4 * Copyright (C) 2006-2008 Nokia Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. --- 11 unchanged lines hidden (view full) --- 20 * Adrian Hunter 21 */ 22 23#ifndef __UBIFS_DEBUG_H__ 24#define __UBIFS_DEBUG_H__ 25 26#ifdef CONFIG_UBIFS_FS_DEBUG 27 | 1/* 2 * This file is part of UBIFS. 3 * 4 * Copyright (C) 2006-2008 Nokia Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. --- 11 unchanged lines hidden (view full) --- 20 * Adrian Hunter 21 */ 22 23#ifndef __UBIFS_DEBUG_H__ 24#define __UBIFS_DEBUG_H__ 25 26#ifdef CONFIG_UBIFS_FS_DEBUG 27 |
28#define UBIFS_DBG(op) op | 28/** 29 * ubifs_debug_info - per-FS debugging information. 30 * @buf: a buffer of LEB size, used for various purposes 31 * @old_zroot: old index root - used by 'dbg_check_old_index()' 32 * @old_zroot_level: old index root level - used by 'dbg_check_old_index()' 33 * @old_zroot_sqnum: old index root sqnum - used by 'dbg_check_old_index()' 34 * @failure_mode: failure mode for recovery testing 35 * @fail_delay: 0=>don't delay, 1=>delay a time, 2=>delay a number of calls 36 * @fail_timeout: time in jiffies when delay of failure mode expires 37 * @fail_cnt: current number of calls to failure mode I/O functions 38 * @fail_cnt_max: number of calls by which to delay failure mode 39 * @chk_lpt_sz: used by LPT tree size checker 40 * @chk_lpt_sz2: used by LPT tree size checker 41 * @chk_lpt_wastage: used by LPT tree size checker 42 * @chk_lpt_lebs: used by LPT tree size checker 43 * @new_nhead_offs: used by LPT tree size checker 44 * @new_ihead_lnum: used by debugging to check ihead_lnum 45 * @new_ihead_offs: used by debugging to check ihead_offs 46 */ 47struct ubifs_debug_info { 48 void *buf; 49 struct ubifs_zbranch old_zroot; 50 int old_zroot_level; 51 unsigned long long old_zroot_sqnum; 52 int failure_mode; 53 int fail_delay; 54 unsigned long fail_timeout; 55 unsigned int fail_cnt; 56 unsigned int fail_cnt_max; 57 long long chk_lpt_sz; 58 long long chk_lpt_sz2; 59 long long chk_lpt_wastage; 60 int chk_lpt_lebs; 61 int new_nhead_offs; 62 int new_ihead_lnum; 63 int new_ihead_offs; 64}; |
29 30#define ubifs_assert(expr) do { \ 31 if (unlikely(!(expr))) { \ 32 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ 33 __func__, __LINE__, current->pid); \ 34 dbg_dump_stack(); \ 35 } \ 36} while (0) --- 169 unchanged lines hidden (view full) --- 206#endif 207 208extern spinlock_t dbg_lock; 209 210extern unsigned int ubifs_msg_flags; 211extern unsigned int ubifs_chk_flags; 212extern unsigned int ubifs_tst_flags; 213 | 65 66#define ubifs_assert(expr) do { \ 67 if (unlikely(!(expr))) { \ 68 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ 69 __func__, __LINE__, current->pid); \ 70 dbg_dump_stack(); \ 71 } \ 72} while (0) --- 169 unchanged lines hidden (view full) --- 242#endif 243 244extern spinlock_t dbg_lock; 245 246extern unsigned int ubifs_msg_flags; 247extern unsigned int ubifs_chk_flags; 248extern unsigned int ubifs_tst_flags; 249 |
250int ubifs_debugging_init(struct ubifs_info *c); 251void ubifs_debugging_exit(struct ubifs_info *c); 252 |
|
214/* Dump functions */ 215 216const char *dbg_ntype(int type); 217const char *dbg_cstate(int cmt_state); 218const char *dbg_get_key_dump(const struct ubifs_info *c, 219 const union ubifs_key *key); 220void dbg_dump_inode(const struct ubifs_info *c, const struct inode *inode); 221void dbg_dump_node(const struct ubifs_info *c, const void *node); --- 47 unchanged lines hidden (view full) --- 269 (ubifs_tst_flags & UBIFS_TST_FORCE_IN_THE_GAPS) 270 271int dbg_force_in_the_gaps(void); 272 273/* Failure mode for recovery testing */ 274 275#define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY) 276 | 253/* Dump functions */ 254 255const char *dbg_ntype(int type); 256const char *dbg_cstate(int cmt_state); 257const char *dbg_get_key_dump(const struct ubifs_info *c, 258 const union ubifs_key *key); 259void dbg_dump_inode(const struct ubifs_info *c, const struct inode *inode); 260void dbg_dump_node(const struct ubifs_info *c, const void *node); --- 47 unchanged lines hidden (view full) --- 308 (ubifs_tst_flags & UBIFS_TST_FORCE_IN_THE_GAPS) 309 310int dbg_force_in_the_gaps(void); 311 312/* Failure mode for recovery testing */ 313 314#define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY) 315 |
277void dbg_failure_mode_registration(struct ubifs_info *c); 278void dbg_failure_mode_deregistration(struct ubifs_info *c); 279 | |
280#ifndef UBIFS_DBG_PRESERVE_UBI 281 282#define ubi_leb_read dbg_leb_read 283#define ubi_leb_write dbg_leb_write 284#define ubi_leb_change dbg_leb_change 285#define ubi_leb_erase dbg_leb_erase 286#define ubi_leb_unmap dbg_leb_unmap 287#define ubi_is_mapped dbg_is_mapped --- 27 unchanged lines hidden (view full) --- 315static inline int dbg_change(struct ubi_volume_desc *desc, int lnum, 316 const void *buf, int len) 317{ 318 return dbg_leb_change(desc, lnum, buf, len, UBI_UNKNOWN); 319} 320 321#else /* !CONFIG_UBIFS_FS_DEBUG */ 322 | 316#ifndef UBIFS_DBG_PRESERVE_UBI 317 318#define ubi_leb_read dbg_leb_read 319#define ubi_leb_write dbg_leb_write 320#define ubi_leb_change dbg_leb_change 321#define ubi_leb_erase dbg_leb_erase 322#define ubi_leb_unmap dbg_leb_unmap 323#define ubi_is_mapped dbg_is_mapped --- 27 unchanged lines hidden (view full) --- 351static inline int dbg_change(struct ubi_volume_desc *desc, int lnum, 352 const void *buf, int len) 353{ 354 return dbg_leb_change(desc, lnum, buf, len, UBI_UNKNOWN); 355} 356 357#else /* !CONFIG_UBIFS_FS_DEBUG */ 358 |
323#define UBIFS_DBG(op) 324 | |
325/* Use "if (0)" to make compiler check arguments even if debugging is off */ 326#define ubifs_assert(expr) do { \ 327 if (0 && (expr)) \ 328 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ 329 __func__, __LINE__, current->pid); \ 330} while (0) 331 332#define dbg_err(fmt, ...) do { \ --- 22 unchanged lines hidden (view full) --- 355#define dbg_log(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) 356#define dbg_gc(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) 357#define dbg_scan(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) 358#define dbg_rcvry(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) 359 360#define DBGKEY(key) ((char *)(key)) 361#define DBGKEY1(key) ((char *)(key)) 362 | 359/* Use "if (0)" to make compiler check arguments even if debugging is off */ 360#define ubifs_assert(expr) do { \ 361 if (0 && (expr)) \ 362 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ 363 __func__, __LINE__, current->pid); \ 364} while (0) 365 366#define dbg_err(fmt, ...) do { \ --- 22 unchanged lines hidden (view full) --- 389#define dbg_log(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) 390#define dbg_gc(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) 391#define dbg_scan(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) 392#define dbg_rcvry(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) 393 394#define DBGKEY(key) ((char *)(key)) 395#define DBGKEY1(key) ((char *)(key)) 396 |
397#define ubifs_debugging_init(c) 0 398#define ubifs_debugging_exit(c) ({}) 399 |
|
363#define dbg_ntype(type) "" 364#define dbg_cstate(cmt_state) "" 365#define dbg_get_key_dump(c, key) ({}) 366#define dbg_dump_inode(c, inode) ({}) 367#define dbg_dump_node(c, node) ({}) 368#define dbg_dump_budget_req(req) ({}) 369#define dbg_dump_lstats(lst) ({}) 370#define dbg_dump_budg(c) ({}) --- 20 unchanged lines hidden (view full) --- 391#define dbg_check_idx_size(c, idx_size) 0 392#define dbg_check_filesystem(c) 0 393#define dbg_check_heap(c, heap, cat, add_pos) ({}) 394#define dbg_check_lprops(c) 0 395#define dbg_check_lpt_nodes(c, cnode, row, col) 0 396#define dbg_force_in_the_gaps_enabled 0 397#define dbg_force_in_the_gaps() 0 398#define dbg_failure_mode 0 | 400#define dbg_ntype(type) "" 401#define dbg_cstate(cmt_state) "" 402#define dbg_get_key_dump(c, key) ({}) 403#define dbg_dump_inode(c, inode) ({}) 404#define dbg_dump_node(c, node) ({}) 405#define dbg_dump_budget_req(req) ({}) 406#define dbg_dump_lstats(lst) ({}) 407#define dbg_dump_budg(c) ({}) --- 20 unchanged lines hidden (view full) --- 428#define dbg_check_idx_size(c, idx_size) 0 429#define dbg_check_filesystem(c) 0 430#define dbg_check_heap(c, heap, cat, add_pos) ({}) 431#define dbg_check_lprops(c) 0 432#define dbg_check_lpt_nodes(c, cnode, row, col) 0 433#define dbg_force_in_the_gaps_enabled 0 434#define dbg_force_in_the_gaps() 0 435#define dbg_failure_mode 0 |
399#define dbg_failure_mode_registration(c) ({}) 400#define dbg_failure_mode_deregistration(c) ({}) | |
401 402#endif /* !CONFIG_UBIFS_FS_DEBUG */ 403 404#endif /* !__UBIFS_DEBUG_H__ */ | 436 437#endif /* !CONFIG_UBIFS_FS_DEBUG */ 438 439#endif /* !__UBIFS_DEBUG_H__ */ |