diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-18 07:53:05 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-06-01 04:21:47 -0400 |
commit | 2a734bb8d502b645c061fa329e87c5d651498e68 (patch) | |
tree | d87ee3ddd7c5ccee224044e2178aaf131407b91a /drivers/mtd/ubi/debug.h | |
parent | d99383b00eba9c6ac3dea462d718b2849012ee03 (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.h | 59 |
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); | |||
71 | void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type); | 71 | void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type); |
72 | void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); | 72 | void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); |
73 | void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len); | 73 | void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len); |
74 | 74 | int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len); | |
75 | extern unsigned int ubi_chk_flags; | 75 | int ubi_dbg_check_write(struct ubi_device *ubi, const void *buf, int pnum, |
76 | int offset, int len); | ||
77 | int ubi_debugging_init_dev(struct ubi_device *ubi); | ||
78 | void ubi_debugging_exit_dev(struct ubi_device *ubi); | ||
79 | int ubi_debugfs_init(void); | ||
80 | void ubi_debugfs_exit(void); | ||
81 | int ubi_debugfs_init_dev(struct ubi_device *ubi); | ||
82 | void 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 | */ |
83 | enum { | 101 | struct 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 | ||
88 | int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len); | ||
89 | int ubi_dbg_check_write(struct ubi_device *ubi, const void *buf, int pnum, | ||
90 | int offset, int len); | ||
91 | |||
92 | extern unsigned int ubi_tst_flags; | 110 | extern unsigned int ubi_tst_flags; |
93 | 111 | ||
94 | /* | 112 | /* |
@@ -201,11 +219,6 @@ static inline void ubi_dbg_dump_flash(struct ubi_device *ubi, | |||
201 | static inline void | 219 | static inline void |
202 | ubi_dbg_print_hex_dump(const char *l, const char *ps, int pt, int r, | 220 | ubi_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 | |||
205 | static inline int ubi_dbg_is_bgt_disabled(void) { return 0; } | ||
206 | static inline int ubi_dbg_is_bitflip(void) { return 0; } | ||
207 | static inline int ubi_dbg_is_write_failure(void) { return 0; } | ||
208 | static inline int ubi_dbg_is_erase_failure(void) { return 0; } | ||
209 | static inline int ubi_dbg_check_all_ff(struct ubi_device *ubi, | 222 | static 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 | ||
229 | static inline int ubi_debugging_init_dev(struct ubi_device *ubi) { return 0; } | ||
230 | static inline void ubi_debugging_exit_dev(struct ubi_device *ubi) { return; } | ||
231 | static inline int ubi_debugfs_init(void) { return 0; } | ||
232 | static inline void ubi_debugfs_exit(void) { return; } | ||
233 | static inline int ubi_debugfs_init_dev(struct ubi_device *ubi) { return 0; } | ||
234 | static inline void ubi_debugfs_exit_dev(struct ubi_device *ubi) { return; } | ||
235 | |||
236 | static inline int ubi_dbg_is_bgt_disabled(void) { return 0; } | ||
237 | static inline int ubi_dbg_is_bitflip(void) { return 0; } | ||
238 | static inline int ubi_dbg_is_write_failure(void) { return 0; } | ||
239 | static 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__ */ |