blob: fd75b635daebf83d0c7445ba810c7ef937c65bbc [file] [log] [blame]
Artem Bityutskiy1e517642008-07-14 19:08:37 +03001/*
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
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -070026/* Checking helper functions */
27typedef int (*dbg_leaf_callback)(struct ubifs_info *c,
28 struct ubifs_zbranch *zbr, void *priv);
29typedef int (*dbg_znode_callback)(struct ubifs_info *c,
30 struct ubifs_znode *znode, void *priv);
31
Artem Bityutskiy1e517642008-07-14 19:08:37 +030032#ifdef CONFIG_UBIFS_FS_DEBUG
33
Artem Bityutskiybc3f07f2011-04-05 13:52:20 +030034#include <linux/random.h>
35
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030036/**
37 * ubifs_debug_info - per-FS debugging information.
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030038 * @old_zroot: old index root - used by 'dbg_check_old_index()'
39 * @old_zroot_level: old index root level - used by 'dbg_check_old_index()'
40 * @old_zroot_sqnum: old index root sqnum - used by 'dbg_check_old_index()'
41 * @failure_mode: failure mode for recovery testing
42 * @fail_delay: 0=>don't delay, 1=>delay a time, 2=>delay a number of calls
43 * @fail_timeout: time in jiffies when delay of failure mode expires
44 * @fail_cnt: current number of calls to failure mode I/O functions
45 * @fail_cnt_max: number of calls by which to delay failure mode
46 * @chk_lpt_sz: used by LPT tree size checker
47 * @chk_lpt_sz2: used by LPT tree size checker
48 * @chk_lpt_wastage: used by LPT tree size checker
49 * @chk_lpt_lebs: used by LPT tree size checker
50 * @new_nhead_offs: used by LPT tree size checker
Artem Bityutskiy84abf972009-01-23 14:54:59 +020051 * @new_ihead_lnum: used by debugging to check @c->ihead_lnum
52 * @new_ihead_offs: used by debugging to check @c->ihead_offs
Artem Bityutskiy552ff312008-10-23 11:49:28 +030053 *
Artem Bityutskiy84abf972009-01-23 14:54:59 +020054 * @saved_lst: saved lprops statistics (used by 'dbg_save_space_info()')
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +030055 * @saved_bi: saved budgeting information
56 * @saved_free: saved amount of free space
57 * @saved_idx_gc_cnt: saved value of @c->idx_gc_cnt
Artem Bityutskiy84abf972009-01-23 14:54:59 +020058 *
Artem Bityutskiybdc1a1b2011-05-17 14:07:24 +030059 * @dfs_dir_name: name of debugfs directory containing this file-system's files
60 * @dfs_dir: direntry object of the file-system debugfs directory
61 * @dfs_dump_lprops: "dump lprops" debugfs knob
62 * @dfs_dump_budg: "dump budgeting information" debugfs knob
63 * @dfs_dump_tnc: "dump TNC" debugfs knob
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030064 */
65struct ubifs_debug_info {
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030066 struct ubifs_zbranch old_zroot;
67 int old_zroot_level;
68 unsigned long long old_zroot_sqnum;
69 int failure_mode;
70 int fail_delay;
71 unsigned long fail_timeout;
72 unsigned int fail_cnt;
73 unsigned int fail_cnt_max;
74 long long chk_lpt_sz;
75 long long chk_lpt_sz2;
76 long long chk_lpt_wastage;
77 int chk_lpt_lebs;
78 int new_nhead_offs;
79 int new_ihead_lnum;
80 int new_ihead_offs;
Artem Bityutskiy552ff312008-10-23 11:49:28 +030081
Artem Bityutskiy84abf972009-01-23 14:54:59 +020082 struct ubifs_lp_stats saved_lst;
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +030083 struct ubifs_budg_info saved_bi;
Artem Bityutskiy84abf972009-01-23 14:54:59 +020084 long long saved_free;
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +030085 int saved_idx_gc_cnt;
Artem Bityutskiy84abf972009-01-23 14:54:59 +020086
87 char dfs_dir_name[100];
88 struct dentry *dfs_dir;
89 struct dentry *dfs_dump_lprops;
90 struct dentry *dfs_dump_budg;
91 struct dentry *dfs_dump_tnc;
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030092};
Artem Bityutskiy1e517642008-07-14 19:08:37 +030093
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +030094#define ubifs_assert(expr) do { \
Artem Bityutskiy1e517642008-07-14 19:08:37 +030095 if (unlikely(!(expr))) { \
96 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
97 __func__, __LINE__, current->pid); \
98 dbg_dump_stack(); \
99 } \
100} while (0)
101
102#define ubifs_assert_cmt_locked(c) do { \
103 if (unlikely(down_write_trylock(&(c)->commit_sem))) { \
104 up_write(&(c)->commit_sem); \
105 printk(KERN_CRIT "commit lock is not locked!\n"); \
106 ubifs_assert(0); \
107 } \
108} while (0)
109
Artem Bityutskiyec068142011-04-26 10:21:54 +0300110#define dbg_dump_stack() dump_stack()
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300111
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300112#define dbg_err(fmt, ...) do { \
113 spin_lock(&dbg_lock); \
114 ubifs_err(fmt, ##__VA_ARGS__); \
115 spin_unlock(&dbg_lock); \
116} while (0)
117
118const char *dbg_key_str0(const struct ubifs_info *c,
119 const union ubifs_key *key);
120const char *dbg_key_str1(const struct ubifs_info *c,
121 const union ubifs_key *key);
122
123/*
Artem Bityutskiy20ef6312012-01-11 15:13:27 +0200124 * TODO: these macros are now broken because there is no locking around them
125 * and we use a global buffer for the key string. This means that in case of
126 * concurrent execution we will end up with incorrect and messy key strings.
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300127 */
128#define DBGKEY(key) dbg_key_str0(c, (key))
129#define DBGKEY1(key) dbg_key_str1(c, (key))
130
Artem Bityutskiy20ef6312012-01-11 15:13:27 +0200131#define ubifs_dbg_msg(type, fmt, ...) \
132 pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__)
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300133
134/* Just a debugging messages not related to any specific UBIFS subsystem */
Artem Bityutskiy8aee2e22012-01-10 19:32:30 +0200135#define dbg_msg(fmt, ...) \
136 printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", current->pid, \
137 __func__, ##__VA_ARGS__)
138
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300139/* General messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300140#define dbg_gen(fmt, ...) ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300141/* Additional journal messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300142#define dbg_jnl(fmt, ...) ubifs_dbg_msg("jnl", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300143/* Additional TNC messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300144#define dbg_tnc(fmt, ...) ubifs_dbg_msg("tnc", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300145/* Additional lprops messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300146#define dbg_lp(fmt, ...) ubifs_dbg_msg("lp", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300147/* Additional LEB find messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300148#define dbg_find(fmt, ...) ubifs_dbg_msg("find", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300149/* Additional mount messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300150#define dbg_mnt(fmt, ...) ubifs_dbg_msg("mnt", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300151/* Additional I/O messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300152#define dbg_io(fmt, ...) ubifs_dbg_msg("io", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300153/* Additional commit messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300154#define dbg_cmt(fmt, ...) ubifs_dbg_msg("cmt", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300155/* Additional budgeting messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300156#define dbg_budg(fmt, ...) ubifs_dbg_msg("budg", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300157/* Additional log messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300158#define dbg_log(fmt, ...) ubifs_dbg_msg("log", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300159/* Additional gc messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300160#define dbg_gc(fmt, ...) ubifs_dbg_msg("gc", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300161/* Additional scan messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300162#define dbg_scan(fmt, ...) ubifs_dbg_msg("scan", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300163/* Additional recovery messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300164#define dbg_rcvry(fmt, ...) ubifs_dbg_msg("rcvry", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300165
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300166/*
Artem Bityutskiy5d630e42011-03-14 17:55:40 +0200167 * Debugging check flags.
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300168 *
169 * UBIFS_CHK_GEN: general checks
170 * UBIFS_CHK_TNC: check TNC
171 * UBIFS_CHK_IDX_SZ: check index size
172 * UBIFS_CHK_ORPH: check orphans
173 * UBIFS_CHK_OLD_IDX: check the old index
174 * UBIFS_CHK_LPROPS: check lprops
175 * UBIFS_CHK_FS: check the file-system
176 */
177enum {
178 UBIFS_CHK_GEN = 0x1,
179 UBIFS_CHK_TNC = 0x2,
180 UBIFS_CHK_IDX_SZ = 0x4,
181 UBIFS_CHK_ORPH = 0x8,
182 UBIFS_CHK_OLD_IDX = 0x10,
183 UBIFS_CHK_LPROPS = 0x20,
184 UBIFS_CHK_FS = 0x40,
185};
186
187/*
Artem Bityutskiy5d630e42011-03-14 17:55:40 +0200188 * Special testing flags.
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300189 *
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300190 * UBIFS_TST_RCVRY: failure mode for recovery testing
191 */
192enum {
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300193 UBIFS_TST_RCVRY = 0x4,
194};
195
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300196extern spinlock_t dbg_lock;
197
198extern unsigned int ubifs_msg_flags;
199extern unsigned int ubifs_chk_flags;
200extern unsigned int ubifs_tst_flags;
201
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +0300202int ubifs_debugging_init(struct ubifs_info *c);
203void ubifs_debugging_exit(struct ubifs_info *c);
204
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300205/* Dump functions */
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300206const char *dbg_ntype(int type);
207const char *dbg_cstate(int cmt_state);
Artem Bityutskiy77a7ae52009-09-15 15:03:51 +0300208const char *dbg_jhead(int jhead);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300209const char *dbg_get_key_dump(const struct ubifs_info *c,
210 const union ubifs_key *key);
211void dbg_dump_inode(const struct ubifs_info *c, const struct inode *inode);
212void dbg_dump_node(const struct ubifs_info *c, const void *node);
Artem Bityutskiy2ba5f7a2008-10-31 17:32:30 +0200213void dbg_dump_lpt_node(const struct ubifs_info *c, void *node, int lnum,
214 int offs);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300215void dbg_dump_budget_req(const struct ubifs_budget_req *req);
216void dbg_dump_lstats(const struct ubifs_lp_stats *lst);
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +0300217void dbg_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300218void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp);
219void dbg_dump_lprops(struct ubifs_info *c);
Adrian Hunter73944a62008-09-12 18:13:31 +0300220void dbg_dump_lpt_info(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300221void dbg_dump_leb(const struct ubifs_info *c, int lnum);
222void dbg_dump_znode(const struct ubifs_info *c,
223 const struct ubifs_znode *znode);
224void dbg_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat);
225void dbg_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
226 struct ubifs_nnode *parent, int iip);
227void dbg_dump_tnc(struct ubifs_info *c);
228void dbg_dump_index(struct ubifs_info *c);
Artem Bityutskiy2ba5f7a2008-10-31 17:32:30 +0200229void dbg_dump_lpt_lebs(const struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300230
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300231int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
232 dbg_znode_callback znode_cb, void *priv);
233
234/* Checking functions */
Artem Bityutskiy84abf972009-01-23 14:54:59 +0200235void dbg_save_space_info(struct ubifs_info *c);
236int dbg_check_space_info(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300237int dbg_check_lprops(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300238int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot);
239int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300240int dbg_check_cats(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300241int dbg_check_ltab(struct ubifs_info *c);
Adrian Hunter73944a62008-09-12 18:13:31 +0300242int dbg_chk_lpt_free_spc(struct ubifs_info *c);
243int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300244int dbg_check_synced_i_size(struct inode *inode);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300245int dbg_check_dir_size(struct ubifs_info *c, const struct inode *dir);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300246int dbg_check_tnc(struct ubifs_info *c, int extra);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300247int dbg_check_idx_size(struct ubifs_info *c, long long idx_size);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300248int dbg_check_filesystem(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300249void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat,
250 int add_pos);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300251int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode,
252 int row, int col);
Artem Bityutskiye3c3efc2009-08-27 16:34:19 +0300253int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode,
254 loff_t size);
Artem Bityutskiy3bb66b42010-08-07 10:06:11 +0300255int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head);
256int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300257
258/* Force the use of in-the-gaps method for testing */
Artem Bityutskiybc3f07f2011-04-05 13:52:20 +0300259static inline int dbg_force_in_the_gaps_enabled(void)
260{
261 return ubifs_chk_flags & UBIFS_CHK_GEN;
262}
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300263int dbg_force_in_the_gaps(void);
264
265/* Failure mode for recovery testing */
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300266#define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY)
267
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300268#ifndef UBIFS_DBG_PRESERVE_UBI
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300269#define ubi_leb_read dbg_leb_read
270#define ubi_leb_write dbg_leb_write
271#define ubi_leb_change dbg_leb_change
272#define ubi_leb_erase dbg_leb_erase
273#define ubi_leb_unmap dbg_leb_unmap
274#define ubi_is_mapped dbg_is_mapped
275#define ubi_leb_map dbg_leb_map
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300276#endif
277
278int dbg_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
279 int len, int check);
280int dbg_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
281 int offset, int len, int dtype);
282int dbg_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
283 int len, int dtype);
284int dbg_leb_erase(struct ubi_volume_desc *desc, int lnum);
285int dbg_leb_unmap(struct ubi_volume_desc *desc, int lnum);
286int dbg_is_mapped(struct ubi_volume_desc *desc, int lnum);
287int dbg_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype);
288
289static inline int dbg_read(struct ubi_volume_desc *desc, int lnum, char *buf,
290 int offset, int len)
291{
292 return dbg_leb_read(desc, lnum, buf, offset, len, 0);
293}
294
295static inline int dbg_write(struct ubi_volume_desc *desc, int lnum,
296 const void *buf, int offset, int len)
297{
298 return dbg_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN);
299}
300
301static inline int dbg_change(struct ubi_volume_desc *desc, int lnum,
302 const void *buf, int len)
303{
304 return dbg_leb_change(desc, lnum, buf, len, UBI_UNKNOWN);
305}
306
Artem Bityutskiy552ff312008-10-23 11:49:28 +0300307/* Debugfs-related stuff */
308int dbg_debugfs_init(void);
309void dbg_debugfs_exit(void);
310int dbg_debugfs_init_fs(struct ubifs_info *c);
311void dbg_debugfs_exit_fs(struct ubifs_info *c);
312
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300313#else /* !CONFIG_UBIFS_FS_DEBUG */
314
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300315/* Use "if (0)" to make compiler check arguments even if debugging is off */
316#define ubifs_assert(expr) do { \
317 if (0 && (expr)) \
318 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
319 __func__, __LINE__, current->pid); \
320} while (0)
321
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300322#define dbg_err(fmt, ...) do { \
323 if (0) \
324 ubifs_err(fmt, ##__VA_ARGS__); \
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300325} while (0)
326
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300327#define ubifs_dbg_msg(fmt, ...) do { \
328 if (0) \
329 pr_debug(fmt "\n", ##__VA_ARGS__); \
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300330} while (0)
331
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300332#define dbg_dump_stack()
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300333#define ubifs_assert_cmt_locked(c)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300334
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300335#define dbg_msg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
336#define dbg_gen(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
337#define dbg_jnl(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
338#define dbg_tnc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
339#define dbg_lp(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
340#define dbg_find(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
341#define dbg_mnt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
342#define dbg_io(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
343#define dbg_cmt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
344#define dbg_budg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
345#define dbg_log(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
346#define dbg_gc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
347#define dbg_scan(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
348#define dbg_rcvry(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300349
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300350#define DBGKEY(key) ((char *)(key))
351#define DBGKEY1(key) ((char *)(key))
352
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700353static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; }
354static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; }
355static inline const char *dbg_ntype(int type) { return ""; }
356static inline const char *dbg_cstate(int cmt_state) { return ""; }
357static inline const char *dbg_jhead(int jhead) { return ""; }
358static inline const char *
359dbg_get_key_dump(const struct ubifs_info *c,
360 const union ubifs_key *key) { return ""; }
361static inline void dbg_dump_inode(const struct ubifs_info *c,
362 const struct inode *inode) { return; }
363static inline void dbg_dump_node(const struct ubifs_info *c,
364 const void *node) { return; }
365static inline void dbg_dump_lpt_node(const struct ubifs_info *c,
366 void *node, int lnum,
367 int offs) { return; }
368static inline void
369dbg_dump_budget_req(const struct ubifs_budget_req *req) { return; }
370static inline void
371dbg_dump_lstats(const struct ubifs_lp_stats *lst) { return; }
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +0300372static inline void
373dbg_dump_budg(struct ubifs_info *c,
374 const struct ubifs_budg_info *bi) { return; }
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700375static inline void dbg_dump_lprop(const struct ubifs_info *c,
376 const struct ubifs_lprops *lp) { return; }
377static inline void dbg_dump_lprops(struct ubifs_info *c) { return; }
378static inline void dbg_dump_lpt_info(struct ubifs_info *c) { return; }
379static inline void dbg_dump_leb(const struct ubifs_info *c,
380 int lnum) { return; }
381static inline void
382dbg_dump_znode(const struct ubifs_info *c,
383 const struct ubifs_znode *znode) { return; }
384static inline void dbg_dump_heap(struct ubifs_info *c,
385 struct ubifs_lpt_heap *heap,
386 int cat) { return; }
387static inline void dbg_dump_pnode(struct ubifs_info *c,
388 struct ubifs_pnode *pnode,
389 struct ubifs_nnode *parent,
390 int iip) { return; }
391static inline void dbg_dump_tnc(struct ubifs_info *c) { return; }
392static inline void dbg_dump_index(struct ubifs_info *c) { return; }
393static inline void dbg_dump_lpt_lebs(const struct ubifs_info *c) { return; }
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +0300394
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700395static inline int dbg_walk_index(struct ubifs_info *c,
396 dbg_leaf_callback leaf_cb,
397 dbg_znode_callback znode_cb,
398 void *priv) { return 0; }
399static inline void dbg_save_space_info(struct ubifs_info *c) { return; }
400static inline int dbg_check_space_info(struct ubifs_info *c) { return 0; }
401static inline int dbg_check_lprops(struct ubifs_info *c) { return 0; }
402static inline int
403dbg_old_index_check_init(struct ubifs_info *c,
404 struct ubifs_zbranch *zroot) { return 0; }
405static inline int
406dbg_check_old_index(struct ubifs_info *c,
407 struct ubifs_zbranch *zroot) { return 0; }
408static inline int dbg_check_cats(struct ubifs_info *c) { return 0; }
409static inline int dbg_check_ltab(struct ubifs_info *c) { return 0; }
410static inline int dbg_chk_lpt_free_spc(struct ubifs_info *c) { return 0; }
411static inline int dbg_chk_lpt_sz(struct ubifs_info *c,
412 int action, int len) { return 0; }
413static inline int dbg_check_synced_i_size(struct inode *inode) { return 0; }
414static inline int dbg_check_dir_size(struct ubifs_info *c,
415 const struct inode *dir) { return 0; }
416static inline int dbg_check_tnc(struct ubifs_info *c, int extra) { return 0; }
417static inline int dbg_check_idx_size(struct ubifs_info *c,
418 long long idx_size) { return 0; }
419static inline int dbg_check_filesystem(struct ubifs_info *c) { return 0; }
420static inline void dbg_check_heap(struct ubifs_info *c,
421 struct ubifs_lpt_heap *heap,
422 int cat, int add_pos) { return; }
423static inline int dbg_check_lpt_nodes(struct ubifs_info *c,
424 struct ubifs_cnode *cnode, int row, int col) { return 0; }
425static inline int dbg_check_inode_size(struct ubifs_info *c,
426 const struct inode *inode,
427 loff_t size) { return 0; }
428static inline int
429dbg_check_data_nodes_order(struct ubifs_info *c,
430 struct list_head *head) { return 0; }
431static inline int
432dbg_check_nondata_nodes_order(struct ubifs_info *c,
433 struct list_head *head) { return 0; }
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300434
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700435static inline int dbg_force_in_the_gaps(void) { return 0; }
Artem Bityutskiybc3f07f2011-04-05 13:52:20 +0300436#define dbg_force_in_the_gaps_enabled() 0
437#define dbg_failure_mode 0
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300438
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700439static inline int dbg_debugfs_init(void) { return 0; }
440static inline void dbg_debugfs_exit(void) { return; }
441static inline int dbg_debugfs_init_fs(struct ubifs_info *c) { return 0; }
442static inline int dbg_debugfs_exit_fs(struct ubifs_info *c) { return 0; }
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300443
Artem Bityutskiy552ff312008-10-23 11:49:28 +0300444#endif /* !CONFIG_UBIFS_FS_DEBUG */
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300445#endif /* !__UBIFS_DEBUG_H__ */