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.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 51
17  * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Authors: Artem Bityutskiy (Битюцкий Артём)
20  *          Adrian Hunter
21  */
22 
23 #ifndef __UBIFS_DEBUG_H__
24 #define __UBIFS_DEBUG_H__
25 
26 /* Checking helper functions */
27 typedef int (*dbg_leaf_callback)(struct ubifs_info *c,
28 				 struct ubifs_zbranch *zbr, void *priv);
29 typedef int (*dbg_znode_callback)(struct ubifs_info *c,
30 				  struct ubifs_znode *znode, void *priv);
31 
32 #ifdef CONFIG_UBIFS_FS_DEBUG
33 
34 /**
35  * ubifs_debug_info - per-FS debugging information.
36  * @old_zroot: old index root - used by 'dbg_check_old_index()'
37  * @old_zroot_level: old index root level - used by 'dbg_check_old_index()'
38  * @old_zroot_sqnum: old index root sqnum - used by 'dbg_check_old_index()'
39  * @failure_mode: failure mode for recovery testing
40  * @fail_delay: 0=>don't delay, 1=>delay a time, 2=>delay a number of calls
41  * @fail_timeout: time in jiffies when delay of failure mode expires
42  * @fail_cnt: current number of calls to failure mode I/O functions
43  * @fail_cnt_max: number of calls by which to delay failure mode
44  * @chk_lpt_sz: used by LPT tree size checker
45  * @chk_lpt_sz2: used by LPT tree size checker
46  * @chk_lpt_wastage: used by LPT tree size checker
47  * @chk_lpt_lebs: used by LPT tree size checker
48  * @new_nhead_offs: used by LPT tree size checker
49  * @new_ihead_lnum: used by debugging to check @c->ihead_lnum
50  * @new_ihead_offs: used by debugging to check @c->ihead_offs
51  *
52  * @saved_lst: saved lprops statistics (used by 'dbg_save_space_info()')
53  * @saved_free: saved free space (used by 'dbg_save_space_info()')
54  *
55  * dfs_dir_name: name of debugfs directory containing this file-system's files
56  * dfs_dir: direntry object of the file-system debugfs directory
57  * dfs_dump_lprops: "dump lprops" debugfs knob
58  * dfs_dump_budg: "dump budgeting information" debugfs knob
59  * dfs_dump_tnc: "dump TNC" debugfs knob
60  */
61 struct ubifs_debug_info {
62 	struct ubifs_zbranch old_zroot;
63 	int old_zroot_level;
64 	unsigned long long old_zroot_sqnum;
65 	int failure_mode;
66 	int fail_delay;
67 	unsigned long fail_timeout;
68 	unsigned int fail_cnt;
69 	unsigned int fail_cnt_max;
70 	long long chk_lpt_sz;
71 	long long chk_lpt_sz2;
72 	long long chk_lpt_wastage;
73 	int chk_lpt_lebs;
74 	int new_nhead_offs;
75 	int new_ihead_lnum;
76 	int new_ihead_offs;
77 
78 	struct ubifs_lp_stats saved_lst;
79 	long long saved_free;
80 
81 	char dfs_dir_name[100];
82 	struct dentry *dfs_dir;
83 	struct dentry *dfs_dump_lprops;
84 	struct dentry *dfs_dump_budg;
85 	struct dentry *dfs_dump_tnc;
86 };
87 
88 #define ubifs_assert(expr) do {                                                \
89 	if (unlikely(!(expr))) {                                               \
90 		printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
91 		       __func__, __LINE__, current->pid);                      \
92 		dbg_dump_stack();                                              \
93 	}                                                                      \
94 } while (0)
95 
96 #define ubifs_assert_cmt_locked(c) do {                                        \
97 	if (unlikely(down_write_trylock(&(c)->commit_sem))) {                  \
98 		up_write(&(c)->commit_sem);                                    \
99 		printk(KERN_CRIT "commit lock is not locked!\n");              \
100 		ubifs_assert(0);                                               \
101 	}                                                                      \
102 } while (0)
103 
104 #define dbg_dump_stack() do {                                                  \
105 	if (!dbg_failure_mode)                                                 \
106 		dump_stack();                                                  \
107 } while (0)
108 
109 /* Generic debugging messages */
110 #define dbg_msg(fmt, ...) do {                                                 \
111 	spin_lock(&dbg_lock);                                                  \
112 	printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", current->pid,   \
113 	       __func__, ##__VA_ARGS__);                                       \
114 	spin_unlock(&dbg_lock);                                                \
115 } while (0)
116 
117 #define dbg_do_msg(typ, fmt, ...) do {                                         \
118 	if (ubifs_msg_flags & typ)                                             \
119 		dbg_msg(fmt, ##__VA_ARGS__);                                   \
120 } while (0)
121 
122 #define dbg_err(fmt, ...) do {                                                 \
123 	spin_lock(&dbg_lock);                                                  \
124 	ubifs_err(fmt, ##__VA_ARGS__);                                         \
125 	spin_unlock(&dbg_lock);                                                \
126 } while (0)
127 
128 const char *dbg_key_str0(const struct ubifs_info *c,
129 			 const union ubifs_key *key);
130 const char *dbg_key_str1(const struct ubifs_info *c,
131 			 const union ubifs_key *key);
132 
133 /*
134  * DBGKEY macros require @dbg_lock to be held, which it is in the dbg message
135  * macros.
136  */
137 #define DBGKEY(key) dbg_key_str0(c, (key))
138 #define DBGKEY1(key) dbg_key_str1(c, (key))
139 
140 /* General messages */
141 #define dbg_gen(fmt, ...)   dbg_do_msg(UBIFS_MSG_GEN, fmt, ##__VA_ARGS__)
142 
143 /* Additional journal messages */
144 #define dbg_jnl(fmt, ...)   dbg_do_msg(UBIFS_MSG_JNL, fmt, ##__VA_ARGS__)
145 
146 /* Additional TNC messages */
147 #define dbg_tnc(fmt, ...)   dbg_do_msg(UBIFS_MSG_TNC, fmt, ##__VA_ARGS__)
148 
149 /* Additional lprops messages */
150 #define dbg_lp(fmt, ...)    dbg_do_msg(UBIFS_MSG_LP, fmt, ##__VA_ARGS__)
151 
152 /* Additional LEB find messages */
153 #define dbg_find(fmt, ...)  dbg_do_msg(UBIFS_MSG_FIND, fmt, ##__VA_ARGS__)
154 
155 /* Additional mount messages */
156 #define dbg_mnt(fmt, ...)   dbg_do_msg(UBIFS_MSG_MNT, fmt, ##__VA_ARGS__)
157 
158 /* Additional I/O messages */
159 #define dbg_io(fmt, ...)    dbg_do_msg(UBIFS_MSG_IO, fmt, ##__VA_ARGS__)
160 
161 /* Additional commit messages */
162 #define dbg_cmt(fmt, ...)   dbg_do_msg(UBIFS_MSG_CMT, fmt, ##__VA_ARGS__)
163 
164 /* Additional budgeting messages */
165 #define dbg_budg(fmt, ...)  dbg_do_msg(UBIFS_MSG_BUDG, fmt, ##__VA_ARGS__)
166 
167 /* Additional log messages */
168 #define dbg_log(fmt, ...)   dbg_do_msg(UBIFS_MSG_LOG, fmt, ##__VA_ARGS__)
169 
170 /* Additional gc messages */
171 #define dbg_gc(fmt, ...)    dbg_do_msg(UBIFS_MSG_GC, fmt, ##__VA_ARGS__)
172 
173 /* Additional scan messages */
174 #define dbg_scan(fmt, ...)  dbg_do_msg(UBIFS_MSG_SCAN, fmt, ##__VA_ARGS__)
175 
176 /* Additional recovery messages */
177 #define dbg_rcvry(fmt, ...) dbg_do_msg(UBIFS_MSG_RCVRY, fmt, ##__VA_ARGS__)
178 
179 /*
180  * Debugging message type flags.
181  *
182  * UBIFS_MSG_GEN: general messages
183  * UBIFS_MSG_JNL: journal messages
184  * UBIFS_MSG_MNT: mount messages
185  * UBIFS_MSG_CMT: commit messages
186  * UBIFS_MSG_FIND: LEB find messages
187  * UBIFS_MSG_BUDG: budgeting messages
188  * UBIFS_MSG_GC: garbage collection messages
189  * UBIFS_MSG_TNC: TNC messages
190  * UBIFS_MSG_LP: lprops messages
191  * UBIFS_MSG_IO: I/O messages
192  * UBIFS_MSG_LOG: log messages
193  * UBIFS_MSG_SCAN: scan messages
194  * UBIFS_MSG_RCVRY: recovery messages
195  */
196 enum {
197 	UBIFS_MSG_GEN   = 0x1,
198 	UBIFS_MSG_JNL   = 0x2,
199 	UBIFS_MSG_MNT   = 0x4,
200 	UBIFS_MSG_CMT   = 0x8,
201 	UBIFS_MSG_FIND  = 0x10,
202 	UBIFS_MSG_BUDG  = 0x20,
203 	UBIFS_MSG_GC    = 0x40,
204 	UBIFS_MSG_TNC   = 0x80,
205 	UBIFS_MSG_LP    = 0x100,
206 	UBIFS_MSG_IO    = 0x200,
207 	UBIFS_MSG_LOG   = 0x400,
208 	UBIFS_MSG_SCAN  = 0x800,
209 	UBIFS_MSG_RCVRY = 0x1000,
210 };
211 
212 /*
213  * Debugging check flags.
214  *
215  * UBIFS_CHK_GEN: general checks
216  * UBIFS_CHK_TNC: check TNC
217  * UBIFS_CHK_IDX_SZ: check index size
218  * UBIFS_CHK_ORPH: check orphans
219  * UBIFS_CHK_OLD_IDX: check the old index
220  * UBIFS_CHK_LPROPS: check lprops
221  * UBIFS_CHK_FS: check the file-system
222  */
223 enum {
224 	UBIFS_CHK_GEN     = 0x1,
225 	UBIFS_CHK_TNC     = 0x2,
226 	UBIFS_CHK_IDX_SZ  = 0x4,
227 	UBIFS_CHK_ORPH    = 0x8,
228 	UBIFS_CHK_OLD_IDX = 0x10,
229 	UBIFS_CHK_LPROPS  = 0x20,
230 	UBIFS_CHK_FS      = 0x40,
231 };
232 
233 /*
234  * Special testing flags.
235  *
236  * UBIFS_TST_FORCE_IN_THE_GAPS: force the use of in-the-gaps method
237  * UBIFS_TST_RCVRY: failure mode for recovery testing
238  */
239 enum {
240 	UBIFS_TST_FORCE_IN_THE_GAPS = 0x2,
241 	UBIFS_TST_RCVRY             = 0x4,
242 };
243 
244 extern spinlock_t dbg_lock;
245 
246 extern unsigned int ubifs_msg_flags;
247 extern unsigned int ubifs_chk_flags;
248 extern unsigned int ubifs_tst_flags;
249 
250 int ubifs_debugging_init(struct ubifs_info *c);
251 void ubifs_debugging_exit(struct ubifs_info *c);
252 
253 /* Dump functions */
254 const char *dbg_ntype(int type);
255 const char *dbg_cstate(int cmt_state);
256 const char *dbg_jhead(int jhead);
257 const char *dbg_get_key_dump(const struct ubifs_info *c,
258 			     const union ubifs_key *key);
259 void dbg_dump_inode(const struct ubifs_info *c, const struct inode *inode);
260 void dbg_dump_node(const struct ubifs_info *c, const void *node);
261 void dbg_dump_lpt_node(const struct ubifs_info *c, void *node, int lnum,
262 		       int offs);
263 void dbg_dump_budget_req(const struct ubifs_budget_req *req);
264 void dbg_dump_lstats(const struct ubifs_lp_stats *lst);
265 void dbg_dump_budg(struct ubifs_info *c);
266 void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp);
267 void dbg_dump_lprops(struct ubifs_info *c);
268 void dbg_dump_lpt_info(struct ubifs_info *c);
269 void dbg_dump_leb(const struct ubifs_info *c, int lnum);
270 void dbg_dump_znode(const struct ubifs_info *c,
271 		    const struct ubifs_znode *znode);
272 void dbg_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat);
273 void dbg_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
274 		    struct ubifs_nnode *parent, int iip);
275 void dbg_dump_tnc(struct ubifs_info *c);
276 void dbg_dump_index(struct ubifs_info *c);
277 void dbg_dump_lpt_lebs(const struct ubifs_info *c);
278 
279 int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
280 		   dbg_znode_callback znode_cb, void *priv);
281 
282 /* Checking functions */
283 void dbg_save_space_info(struct ubifs_info *c);
284 int dbg_check_space_info(struct ubifs_info *c);
285 int dbg_check_lprops(struct ubifs_info *c);
286 int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot);
287 int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot);
288 int dbg_check_cats(struct ubifs_info *c);
289 int dbg_check_ltab(struct ubifs_info *c);
290 int dbg_chk_lpt_free_spc(struct ubifs_info *c);
291 int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len);
292 int dbg_check_synced_i_size(struct inode *inode);
293 int dbg_check_dir_size(struct ubifs_info *c, const struct inode *dir);
294 int dbg_check_tnc(struct ubifs_info *c, int extra);
295 int dbg_check_idx_size(struct ubifs_info *c, long long idx_size);
296 int dbg_check_filesystem(struct ubifs_info *c);
297 void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat,
298 		    int add_pos);
299 int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode,
300 			int row, int col);
301 int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode,
302 			 loff_t size);
303 int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head);
304 int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head);
305 
306 /* Force the use of in-the-gaps method for testing */
307 
308 #define dbg_force_in_the_gaps_enabled \
309 	(ubifs_tst_flags & UBIFS_TST_FORCE_IN_THE_GAPS)
310 
311 int dbg_force_in_the_gaps(void);
312 
313 /* Failure mode for recovery testing */
314 
315 #define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY)
316 
317 #ifndef UBIFS_DBG_PRESERVE_UBI
318 
319 #define ubi_leb_read   dbg_leb_read
320 #define ubi_leb_write  dbg_leb_write
321 #define ubi_leb_change dbg_leb_change
322 #define ubi_leb_erase  dbg_leb_erase
323 #define ubi_leb_unmap  dbg_leb_unmap
324 #define ubi_is_mapped  dbg_is_mapped
325 #define ubi_leb_map    dbg_leb_map
326 
327 #endif
328 
329 int dbg_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
330 		 int len, int check);
331 int dbg_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
332 		  int offset, int len, int dtype);
333 int dbg_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
334 		   int len, int dtype);
335 int dbg_leb_erase(struct ubi_volume_desc *desc, int lnum);
336 int dbg_leb_unmap(struct ubi_volume_desc *desc, int lnum);
337 int dbg_is_mapped(struct ubi_volume_desc *desc, int lnum);
338 int dbg_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype);
339 
dbg_read(struct ubi_volume_desc * desc,int lnum,char * buf,int offset,int len)340 static inline int dbg_read(struct ubi_volume_desc *desc, int lnum, char *buf,
341 			   int offset, int len)
342 {
343 	return dbg_leb_read(desc, lnum, buf, offset, len, 0);
344 }
345 
dbg_write(struct ubi_volume_desc * desc,int lnum,const void * buf,int offset,int len)346 static inline int dbg_write(struct ubi_volume_desc *desc, int lnum,
347 			    const void *buf, int offset, int len)
348 {
349 	return dbg_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN);
350 }
351 
dbg_change(struct ubi_volume_desc * desc,int lnum,const void * buf,int len)352 static inline int dbg_change(struct ubi_volume_desc *desc, int lnum,
353 				    const void *buf, int len)
354 {
355 	return dbg_leb_change(desc, lnum, buf, len, UBI_UNKNOWN);
356 }
357 
358 /* Debugfs-related stuff */
359 int dbg_debugfs_init(void);
360 void dbg_debugfs_exit(void);
361 int dbg_debugfs_init_fs(struct ubifs_info *c);
362 void dbg_debugfs_exit_fs(struct ubifs_info *c);
363 
364 #else /* !CONFIG_UBIFS_FS_DEBUG */
365 
366 /* Use "if (0)" to make compiler check arguments even if debugging is off */
367 #define ubifs_assert(expr)  do {                                               \
368 	if (0 && (expr))                                                       \
369 		printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
370 		       __func__, __LINE__, current->pid);                      \
371 } while (0)
372 
373 #define dbg_err(fmt, ...)   do {                                               \
374 	if (0)                                                                 \
375 		ubifs_err(fmt, ##__VA_ARGS__);                                 \
376 } while (0)
377 
378 #define dbg_msg(fmt, ...) do {                                                 \
379 	if (0)                                                                 \
380 		printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n",         \
381 		       current->pid, __func__, ##__VA_ARGS__);                 \
382 } while (0)
383 
384 #define dbg_dump_stack()
385 #define ubifs_assert_cmt_locked(c)
386 
387 #define dbg_gen(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
388 #define dbg_jnl(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
389 #define dbg_tnc(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
390 #define dbg_lp(fmt, ...)    dbg_msg(fmt, ##__VA_ARGS__)
391 #define dbg_find(fmt, ...)  dbg_msg(fmt, ##__VA_ARGS__)
392 #define dbg_mnt(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
393 #define dbg_io(fmt, ...)    dbg_msg(fmt, ##__VA_ARGS__)
394 #define dbg_cmt(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
395 #define dbg_budg(fmt, ...)  dbg_msg(fmt, ##__VA_ARGS__)
396 #define dbg_log(fmt, ...)   dbg_msg(fmt, ##__VA_ARGS__)
397 #define dbg_gc(fmt, ...)    dbg_msg(fmt, ##__VA_ARGS__)
398 #define dbg_scan(fmt, ...)  dbg_msg(fmt, ##__VA_ARGS__)
399 #define dbg_rcvry(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__)
400 
401 #define DBGKEY(key)  ((char *)(key))
402 #define DBGKEY1(key) ((char *)(key))
403 
ubifs_debugging_init(struct ubifs_info * c)404 static inline int ubifs_debugging_init(struct ubifs_info *c)      { return 0; }
ubifs_debugging_exit(struct ubifs_info * c)405 static inline void ubifs_debugging_exit(struct ubifs_info *c)     { return; }
dbg_ntype(int type)406 static inline const char *dbg_ntype(int type)                     { return ""; }
dbg_cstate(int cmt_state)407 static inline const char *dbg_cstate(int cmt_state)               { return ""; }
dbg_jhead(int jhead)408 static inline const char *dbg_jhead(int jhead)                    { return ""; }
409 static inline const char *
dbg_get_key_dump(const struct ubifs_info * c,const union ubifs_key * key)410 dbg_get_key_dump(const struct ubifs_info *c,
411 		 const union ubifs_key *key)                      { return ""; }
dbg_dump_inode(const struct ubifs_info * c,const struct inode * inode)412 static inline void dbg_dump_inode(const struct ubifs_info *c,
413 				  const struct inode *inode)      { return; }
dbg_dump_node(const struct ubifs_info * c,const void * node)414 static inline void dbg_dump_node(const struct ubifs_info *c,
415 				 const void *node)                { return; }
dbg_dump_lpt_node(const struct ubifs_info * c,void * node,int lnum,int offs)416 static inline void dbg_dump_lpt_node(const struct ubifs_info *c,
417 				     void *node, int lnum,
418 				     int offs)                    { return; }
419 static inline void
dbg_dump_budget_req(const struct ubifs_budget_req * req)420 dbg_dump_budget_req(const struct ubifs_budget_req *req)           { return; }
421 static inline void
dbg_dump_lstats(const struct ubifs_lp_stats * lst)422 dbg_dump_lstats(const struct ubifs_lp_stats *lst)                 { return; }
dbg_dump_budg(struct ubifs_info * c)423 static inline void dbg_dump_budg(struct ubifs_info *c)            { return; }
dbg_dump_lprop(const struct ubifs_info * c,const struct ubifs_lprops * lp)424 static inline void dbg_dump_lprop(const struct ubifs_info *c,
425 				  const struct ubifs_lprops *lp)  { return; }
dbg_dump_lprops(struct ubifs_info * c)426 static inline void dbg_dump_lprops(struct ubifs_info *c)          { return; }
dbg_dump_lpt_info(struct ubifs_info * c)427 static inline void dbg_dump_lpt_info(struct ubifs_info *c)        { return; }
dbg_dump_leb(const struct ubifs_info * c,int lnum)428 static inline void dbg_dump_leb(const struct ubifs_info *c,
429 				int lnum)                         { return; }
430 static inline void
dbg_dump_znode(const struct ubifs_info * c,const struct ubifs_znode * znode)431 dbg_dump_znode(const struct ubifs_info *c,
432 	       const struct ubifs_znode *znode)                   { return; }
dbg_dump_heap(struct ubifs_info * c,struct ubifs_lpt_heap * heap,int cat)433 static inline void dbg_dump_heap(struct ubifs_info *c,
434 				 struct ubifs_lpt_heap *heap,
435 				 int cat)                         { return; }
dbg_dump_pnode(struct ubifs_info * c,struct ubifs_pnode * pnode,struct ubifs_nnode * parent,int iip)436 static inline void dbg_dump_pnode(struct ubifs_info *c,
437 				  struct ubifs_pnode *pnode,
438 				  struct ubifs_nnode *parent,
439 				  int iip)                        { return; }
dbg_dump_tnc(struct ubifs_info * c)440 static inline void dbg_dump_tnc(struct ubifs_info *c)             { return; }
dbg_dump_index(struct ubifs_info * c)441 static inline void dbg_dump_index(struct ubifs_info *c)           { return; }
dbg_dump_lpt_lebs(const struct ubifs_info * c)442 static inline void dbg_dump_lpt_lebs(const struct ubifs_info *c)  { return; }
443 
dbg_walk_index(struct ubifs_info * c,dbg_leaf_callback leaf_cb,dbg_znode_callback znode_cb,void * priv)444 static inline int dbg_walk_index(struct ubifs_info *c,
445 				 dbg_leaf_callback leaf_cb,
446 				 dbg_znode_callback znode_cb,
447 				 void *priv)                      { return 0; }
dbg_save_space_info(struct ubifs_info * c)448 static inline void dbg_save_space_info(struct ubifs_info *c)      { return; }
dbg_check_space_info(struct ubifs_info * c)449 static inline int dbg_check_space_info(struct ubifs_info *c)      { return 0; }
dbg_check_lprops(struct ubifs_info * c)450 static inline int dbg_check_lprops(struct ubifs_info *c)          { return 0; }
451 static inline int
dbg_old_index_check_init(struct ubifs_info * c,struct ubifs_zbranch * zroot)452 dbg_old_index_check_init(struct ubifs_info *c,
453 			 struct ubifs_zbranch *zroot)             { return 0; }
454 static inline int
dbg_check_old_index(struct ubifs_info * c,struct ubifs_zbranch * zroot)455 dbg_check_old_index(struct ubifs_info *c,
456 		    struct ubifs_zbranch *zroot)                  { return 0; }
dbg_check_cats(struct ubifs_info * c)457 static inline int dbg_check_cats(struct ubifs_info *c)            { return 0; }
dbg_check_ltab(struct ubifs_info * c)458 static inline int dbg_check_ltab(struct ubifs_info *c)            { return 0; }
dbg_chk_lpt_free_spc(struct ubifs_info * c)459 static inline int dbg_chk_lpt_free_spc(struct ubifs_info *c)      { return 0; }
dbg_chk_lpt_sz(struct ubifs_info * c,int action,int len)460 static inline int dbg_chk_lpt_sz(struct ubifs_info *c,
461 				 int action, int len)             { return 0; }
dbg_check_synced_i_size(struct inode * inode)462 static inline int dbg_check_synced_i_size(struct inode *inode)    { return 0; }
dbg_check_dir_size(struct ubifs_info * c,const struct inode * dir)463 static inline int dbg_check_dir_size(struct ubifs_info *c,
464 				     const struct inode *dir)     { return 0; }
dbg_check_tnc(struct ubifs_info * c,int extra)465 static inline int dbg_check_tnc(struct ubifs_info *c, int extra)  { return 0; }
dbg_check_idx_size(struct ubifs_info * c,long long idx_size)466 static inline int dbg_check_idx_size(struct ubifs_info *c,
467 				     long long idx_size)          { return 0; }
dbg_check_filesystem(struct ubifs_info * c)468 static inline int dbg_check_filesystem(struct ubifs_info *c)      { return 0; }
dbg_check_heap(struct ubifs_info * c,struct ubifs_lpt_heap * heap,int cat,int add_pos)469 static inline void dbg_check_heap(struct ubifs_info *c,
470 				  struct ubifs_lpt_heap *heap,
471 				  int cat, int add_pos)           { return; }
dbg_check_lpt_nodes(struct ubifs_info * c,struct ubifs_cnode * cnode,int row,int col)472 static inline int dbg_check_lpt_nodes(struct ubifs_info *c,
473 	struct ubifs_cnode *cnode, int row, int col)              { return 0; }
dbg_check_inode_size(struct ubifs_info * c,const struct inode * inode,loff_t size)474 static inline int dbg_check_inode_size(struct ubifs_info *c,
475 				       const struct inode *inode,
476 				       loff_t size)               { return 0; }
477 static inline int
dbg_check_data_nodes_order(struct ubifs_info * c,struct list_head * head)478 dbg_check_data_nodes_order(struct ubifs_info *c,
479 			   struct list_head *head)                { return 0; }
480 static inline int
dbg_check_nondata_nodes_order(struct ubifs_info * c,struct list_head * head)481 dbg_check_nondata_nodes_order(struct ubifs_info *c,
482 			      struct list_head *head)             { return 0; }
483 
dbg_force_in_the_gaps(void)484 static inline int dbg_force_in_the_gaps(void)                     { return 0; }
485 #define dbg_force_in_the_gaps_enabled 0
486 #define dbg_failure_mode              0
487 
dbg_debugfs_init(void)488 static inline int dbg_debugfs_init(void)                          { return 0; }
dbg_debugfs_exit(void)489 static inline void dbg_debugfs_exit(void)                         { return; }
dbg_debugfs_init_fs(struct ubifs_info * c)490 static inline int dbg_debugfs_init_fs(struct ubifs_info *c)       { return 0; }
dbg_debugfs_exit_fs(struct ubifs_info * c)491 static inline int dbg_debugfs_exit_fs(struct ubifs_info *c)       { return 0; }
492 
493 #endif /* !CONFIG_UBIFS_FS_DEBUG */
494 #endif /* !__UBIFS_DEBUG_H__ */
495