aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/debug.h
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-18 07:53:05 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-06-01 04:21:47 -0400
commit2a734bb8d502b645c061fa329e87c5d651498e68 (patch)
treed87ee3ddd7c5ccee224044e2178aaf131407b91a /drivers/mtd/ubi/debug.h
parentd99383b00eba9c6ac3dea462d718b2849012ee03 (diff)
UBI: use debugfs for the extra checks knobs
This patch introduces debugfs support to UBI. All the UBI stuff is kept in the "ubi" debugfs directory, which contains per-UBI device "ubi/ubiX" sub-directories, containing debugging files. This file also creates "ubi/ubiX/chk_gen" and "ubi/ubiX/chk_io" knobs for switching general and I/O extra checks on and off. And it removes the 'debug_chks' UBI module parameters. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/debug.h')
-rw-r--r--drivers/mtd/ubi/debug.h59
1 files changed, 42 insertions, 17 deletions
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index 3f1a09c5c438..cb6c87977be6 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -71,24 +71,42 @@ void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv);
71void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type); 71void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type);
72void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); 72void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req);
73void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len); 73void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len);
74 74int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len);
75extern unsigned int ubi_chk_flags; 75int ubi_dbg_check_write(struct ubi_device *ubi, const void *buf, int pnum,
76 int offset, int len);
77int ubi_debugging_init_dev(struct ubi_device *ubi);
78void ubi_debugging_exit_dev(struct ubi_device *ubi);
79int ubi_debugfs_init(void);
80void ubi_debugfs_exit(void);
81int ubi_debugfs_init_dev(struct ubi_device *ubi);
82void ubi_debugfs_exit_dev(struct ubi_device *ubi);
76 83
77/* 84/*
78 * Debugging check flags. 85 * The UBI debugfs directory name pattern and maximum name length (3 for "ubi"
86 * + 2 for the number plus 1 for the trailing zero byte.
87 */
88#define UBI_DFS_DIR_NAME "ubi%d"
89#define UBI_DFS_DIR_LEN (3 + 2 + 1)
90
91/**
92 * struct ubi_debug_info - debugging information for an UBI device.
79 * 93 *
80 * UBI_CHK_GEN: general checks 94 * @chk_gen: if UBI general extra checks are enabled
81 * UBI_CHK_IO: check writes and erases 95 * @chk_io: if UBI I/O extra checks are enabled
96 * @dfs_dir_name: name of debugfs directory containing files of this UBI device
97 * @dfs_dir: direntry object of the UBI device debugfs directory
98 * @dfs_chk_gen: debugfs knob to enable UBI general extra checks
99 * @dfs_chk_io: debugfs knob to enable UBI I/O extra checks
82 */ 100 */
83enum { 101struct ubi_debug_info {
84 UBI_CHK_GEN = 0x1, 102 unsigned int chk_gen:1;
85 UBI_CHK_IO = 0x2, 103 unsigned int chk_io:1;
104 char dfs_dir_name[UBI_DFS_DIR_LEN + 1];
105 struct dentry *dfs_dir;
106 struct dentry *dfs_chk_gen;
107 struct dentry *dfs_chk_io;
86}; 108};
87 109
88int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len);
89int ubi_dbg_check_write(struct ubi_device *ubi, const void *buf, int pnum,
90 int offset, int len);
91
92extern unsigned int ubi_tst_flags; 110extern unsigned int ubi_tst_flags;
93 111
94/* 112/*
@@ -201,11 +219,6 @@ static inline void ubi_dbg_dump_flash(struct ubi_device *ubi,
201static inline void 219static inline void
202ubi_dbg_print_hex_dump(const char *l, const char *ps, int pt, int r, 220ubi_dbg_print_hex_dump(const char *l, const char *ps, int pt, int r,
203 int g, const void *b, size_t len, bool a) { return; } 221 int g, const void *b, size_t len, bool a) { return; }
204
205static inline int ubi_dbg_is_bgt_disabled(void) { return 0; }
206static inline int ubi_dbg_is_bitflip(void) { return 0; }
207static inline int ubi_dbg_is_write_failure(void) { return 0; }
208static inline int ubi_dbg_is_erase_failure(void) { return 0; }
209static inline int ubi_dbg_check_all_ff(struct ubi_device *ubi, 222static inline int ubi_dbg_check_all_ff(struct ubi_device *ubi,
210 int pnum, int offset, 223 int pnum, int offset,
211 int len) { return 0; } 224 int len) { return 0; }
@@ -213,5 +226,17 @@ static inline int ubi_dbg_check_write(struct ubi_device *ubi,
213 const void *buf, int pnum, 226 const void *buf, int pnum,
214 int offset, int len) { return 0; } 227 int offset, int len) { return 0; }
215 228
229static inline int ubi_debugging_init_dev(struct ubi_device *ubi) { return 0; }
230static inline void ubi_debugging_exit_dev(struct ubi_device *ubi) { return; }
231static inline int ubi_debugfs_init(void) { return 0; }
232static inline void ubi_debugfs_exit(void) { return; }
233static inline int ubi_debugfs_init_dev(struct ubi_device *ubi) { return 0; }
234static inline void ubi_debugfs_exit_dev(struct ubi_device *ubi) { return; }
235
236static inline int ubi_dbg_is_bgt_disabled(void) { return 0; }
237static inline int ubi_dbg_is_bitflip(void) { return 0; }
238static inline int ubi_dbg_is_write_failure(void) { return 0; }
239static inline int ubi_dbg_is_erase_failure(void) { return 0; }
240
216#endif /* !CONFIG_MTD_UBI_DEBUG */ 241#endif /* !CONFIG_MTD_UBI_DEBUG */
217#endif /* !__UBI_DEBUG_H__ */ 242#endif /* !__UBI_DEBUG_H__ */