blob: a51c20be655d120ca6b283de523c65d0fbeda20a [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 Bityutskiyae380ce2011-05-19 14:13:16 +030036/*
37 * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi"
38 * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte.
39 */
40#define UBIFS_DFS_DIR_NAME "ubi%d_%d"
41#define UBIFS_DFS_DIR_LEN (3 + 1 + 2*2 + 1)
42
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030043/**
44 * ubifs_debug_info - per-FS debugging information.
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030045 * @old_zroot: old index root - used by 'dbg_check_old_index()'
46 * @old_zroot_level: old index root level - used by 'dbg_check_old_index()'
47 * @old_zroot_sqnum: old index root sqnum - used by 'dbg_check_old_index()'
48 * @failure_mode: failure mode for recovery testing
49 * @fail_delay: 0=>don't delay, 1=>delay a time, 2=>delay a number of calls
50 * @fail_timeout: time in jiffies when delay of failure mode expires
51 * @fail_cnt: current number of calls to failure mode I/O functions
52 * @fail_cnt_max: number of calls by which to delay failure mode
53 * @chk_lpt_sz: used by LPT tree size checker
54 * @chk_lpt_sz2: used by LPT tree size checker
55 * @chk_lpt_wastage: used by LPT tree size checker
56 * @chk_lpt_lebs: used by LPT tree size checker
57 * @new_nhead_offs: used by LPT tree size checker
Artem Bityutskiy84abf972009-01-23 14:54:59 +020058 * @new_ihead_lnum: used by debugging to check @c->ihead_lnum
59 * @new_ihead_offs: used by debugging to check @c->ihead_offs
Artem Bityutskiy552ff312008-10-23 11:49:28 +030060 *
Artem Bityutskiy84abf972009-01-23 14:54:59 +020061 * @saved_lst: saved lprops statistics (used by 'dbg_save_space_info()')
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +030062 * @saved_bi: saved budgeting information
63 * @saved_free: saved amount of free space
64 * @saved_idx_gc_cnt: saved value of @c->idx_gc_cnt
Artem Bityutskiy84abf972009-01-23 14:54:59 +020065 *
Artem Bityutskiybdc1a1b2011-05-17 14:07:24 +030066 * @dfs_dir_name: name of debugfs directory containing this file-system's files
67 * @dfs_dir: direntry object of the file-system debugfs directory
68 * @dfs_dump_lprops: "dump lprops" debugfs knob
69 * @dfs_dump_budg: "dump budgeting information" debugfs knob
70 * @dfs_dump_tnc: "dump TNC" debugfs knob
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030071 */
72struct ubifs_debug_info {
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030073 struct ubifs_zbranch old_zroot;
74 int old_zroot_level;
75 unsigned long long old_zroot_sqnum;
76 int failure_mode;
77 int fail_delay;
78 unsigned long fail_timeout;
79 unsigned int fail_cnt;
80 unsigned int fail_cnt_max;
81 long long chk_lpt_sz;
82 long long chk_lpt_sz2;
83 long long chk_lpt_wastage;
84 int chk_lpt_lebs;
85 int new_nhead_offs;
86 int new_ihead_lnum;
87 int new_ihead_offs;
Artem Bityutskiy552ff312008-10-23 11:49:28 +030088
Artem Bityutskiy84abf972009-01-23 14:54:59 +020089 struct ubifs_lp_stats saved_lst;
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +030090 struct ubifs_budg_info saved_bi;
Artem Bityutskiy84abf972009-01-23 14:54:59 +020091 long long saved_free;
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +030092 int saved_idx_gc_cnt;
Artem Bityutskiy84abf972009-01-23 14:54:59 +020093
Artem Bityutskiyae380ce2011-05-19 14:13:16 +030094 char dfs_dir_name[UBIFS_DFS_DIR_LEN + 1];
Artem Bityutskiy84abf972009-01-23 14:54:59 +020095 struct dentry *dfs_dir;
96 struct dentry *dfs_dump_lprops;
97 struct dentry *dfs_dump_budg;
98 struct dentry *dfs_dump_tnc;
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +030099};
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300100
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300101#define ubifs_assert(expr) do { \
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300102 if (unlikely(!(expr))) { \
103 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
104 __func__, __LINE__, current->pid); \
105 dbg_dump_stack(); \
106 } \
107} while (0)
108
109#define ubifs_assert_cmt_locked(c) do { \
110 if (unlikely(down_write_trylock(&(c)->commit_sem))) { \
111 up_write(&(c)->commit_sem); \
112 printk(KERN_CRIT "commit lock is not locked!\n"); \
113 ubifs_assert(0); \
114 } \
115} while (0)
116
Artem Bityutskiyec068142011-04-26 10:21:54 +0300117#define dbg_dump_stack() dump_stack()
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300118
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300119#define dbg_err(fmt, ...) do { \
120 spin_lock(&dbg_lock); \
121 ubifs_err(fmt, ##__VA_ARGS__); \
122 spin_unlock(&dbg_lock); \
123} while (0)
124
125const char *dbg_key_str0(const struct ubifs_info *c,
126 const union ubifs_key *key);
127const char *dbg_key_str1(const struct ubifs_info *c,
128 const union ubifs_key *key);
129
130/*
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300131 * DBGKEY macros require @dbg_lock to be held, which it is in the dbg message
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300132 * macros.
133 */
134#define DBGKEY(key) dbg_key_str0(c, (key))
135#define DBGKEY1(key) dbg_key_str1(c, (key))
136
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300137#define ubifs_dbg_msg(type, fmt, ...) do { \
138 spin_lock(&dbg_lock); \
139 pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__); \
140 spin_unlock(&dbg_lock); \
141} while (0)
142
143/* Just a debugging messages not related to any specific UBIFS subsystem */
144#define dbg_msg(fmt, ...) ubifs_dbg_msg("msg", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300145/* General messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300146#define dbg_gen(fmt, ...) ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300147/* Additional journal messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300148#define dbg_jnl(fmt, ...) ubifs_dbg_msg("jnl", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300149/* Additional TNC messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300150#define dbg_tnc(fmt, ...) ubifs_dbg_msg("tnc", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300151/* Additional lprops messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300152#define dbg_lp(fmt, ...) ubifs_dbg_msg("lp", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300153/* Additional LEB find messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300154#define dbg_find(fmt, ...) ubifs_dbg_msg("find", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300155/* Additional mount messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300156#define dbg_mnt(fmt, ...) ubifs_dbg_msg("mnt", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300157/* Additional I/O messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300158#define dbg_io(fmt, ...) ubifs_dbg_msg("io", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300159/* Additional commit messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300160#define dbg_cmt(fmt, ...) ubifs_dbg_msg("cmt", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300161/* Additional budgeting messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300162#define dbg_budg(fmt, ...) ubifs_dbg_msg("budg", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300163/* Additional log messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300164#define dbg_log(fmt, ...) ubifs_dbg_msg("log", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300165/* Additional gc messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300166#define dbg_gc(fmt, ...) ubifs_dbg_msg("gc", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300167/* Additional scan messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300168#define dbg_scan(fmt, ...) ubifs_dbg_msg("scan", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300169/* Additional recovery messages */
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300170#define dbg_rcvry(fmt, ...) ubifs_dbg_msg("rcvry", fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300171
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300172/*
Artem Bityutskiy5d630e42011-03-14 17:55:40 +0200173 * Debugging check flags.
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300174 *
175 * UBIFS_CHK_GEN: general checks
176 * UBIFS_CHK_TNC: check TNC
177 * UBIFS_CHK_IDX_SZ: check index size
178 * UBIFS_CHK_ORPH: check orphans
179 * UBIFS_CHK_OLD_IDX: check the old index
180 * UBIFS_CHK_LPROPS: check lprops
181 * UBIFS_CHK_FS: check the file-system
182 */
183enum {
184 UBIFS_CHK_GEN = 0x1,
185 UBIFS_CHK_TNC = 0x2,
186 UBIFS_CHK_IDX_SZ = 0x4,
187 UBIFS_CHK_ORPH = 0x8,
188 UBIFS_CHK_OLD_IDX = 0x10,
189 UBIFS_CHK_LPROPS = 0x20,
190 UBIFS_CHK_FS = 0x40,
191};
192
193/*
Artem Bityutskiy5d630e42011-03-14 17:55:40 +0200194 * Special testing flags.
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300195 *
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300196 * UBIFS_TST_RCVRY: failure mode for recovery testing
197 */
198enum {
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300199 UBIFS_TST_RCVRY = 0x4,
200};
201
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300202extern spinlock_t dbg_lock;
203
204extern unsigned int ubifs_msg_flags;
205extern unsigned int ubifs_chk_flags;
206extern unsigned int ubifs_tst_flags;
207
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +0300208int ubifs_debugging_init(struct ubifs_info *c);
209void ubifs_debugging_exit(struct ubifs_info *c);
210
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300211/* Dump functions */
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300212const char *dbg_ntype(int type);
213const char *dbg_cstate(int cmt_state);
Artem Bityutskiy77a7ae52009-09-15 15:03:51 +0300214const char *dbg_jhead(int jhead);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300215const char *dbg_get_key_dump(const struct ubifs_info *c,
216 const union ubifs_key *key);
Artem Bityutskiy4315fb42011-05-25 17:32:42 +0300217void dbg_dump_inode(struct ubifs_info *c, const struct inode *inode);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300218void dbg_dump_node(const struct ubifs_info *c, const void *node);
Artem Bityutskiy2ba5f7a2008-10-31 17:32:30 +0200219void dbg_dump_lpt_node(const struct ubifs_info *c, void *node, int lnum,
220 int offs);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300221void dbg_dump_budget_req(const struct ubifs_budget_req *req);
222void dbg_dump_lstats(const struct ubifs_lp_stats *lst);
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +0300223void dbg_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300224void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp);
225void dbg_dump_lprops(struct ubifs_info *c);
Adrian Hunter73944a62008-09-12 18:13:31 +0300226void dbg_dump_lpt_info(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300227void dbg_dump_leb(const struct ubifs_info *c, int lnum);
228void dbg_dump_znode(const struct ubifs_info *c,
229 const struct ubifs_znode *znode);
230void dbg_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat);
231void dbg_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
232 struct ubifs_nnode *parent, int iip);
233void dbg_dump_tnc(struct ubifs_info *c);
234void dbg_dump_index(struct ubifs_info *c);
Artem Bityutskiy2ba5f7a2008-10-31 17:32:30 +0200235void dbg_dump_lpt_lebs(const struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300236
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300237int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
238 dbg_znode_callback znode_cb, void *priv);
239
240/* Checking functions */
Artem Bityutskiy84abf972009-01-23 14:54:59 +0200241void dbg_save_space_info(struct ubifs_info *c);
242int dbg_check_space_info(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300243int dbg_check_lprops(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300244int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot);
245int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300246int dbg_check_cats(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300247int dbg_check_ltab(struct ubifs_info *c);
Adrian Hunter73944a62008-09-12 18:13:31 +0300248int dbg_chk_lpt_free_spc(struct ubifs_info *c);
249int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300250int dbg_check_synced_i_size(struct inode *inode);
Artem Bityutskiy1b51e982011-05-25 17:38:29 +0300251int dbg_check_dir(struct ubifs_info *c, const struct inode *dir);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300252int dbg_check_tnc(struct ubifs_info *c, int extra);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300253int dbg_check_idx_size(struct ubifs_info *c, long long idx_size);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300254int dbg_check_filesystem(struct ubifs_info *c);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300255void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat,
256 int add_pos);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300257int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode,
258 int row, int col);
Artem Bityutskiye3c3efc2009-08-27 16:34:19 +0300259int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode,
260 loff_t size);
Artem Bityutskiy3bb66b42010-08-07 10:06:11 +0300261int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head);
262int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head);
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300263
264/* Force the use of in-the-gaps method for testing */
Artem Bityutskiybc3f07f2011-04-05 13:52:20 +0300265static inline int dbg_force_in_the_gaps_enabled(void)
266{
267 return ubifs_chk_flags & UBIFS_CHK_GEN;
268}
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300269int dbg_force_in_the_gaps(void);
270
271/* Failure mode for recovery testing */
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300272#define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY)
273
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300274#ifndef UBIFS_DBG_PRESERVE_UBI
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300275#define ubi_leb_read dbg_leb_read
276#define ubi_leb_write dbg_leb_write
277#define ubi_leb_change dbg_leb_change
278#define ubi_leb_erase dbg_leb_erase
279#define ubi_leb_unmap dbg_leb_unmap
280#define ubi_is_mapped dbg_is_mapped
281#define ubi_leb_map dbg_leb_map
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300282#endif
283
284int dbg_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
285 int len, int check);
286int dbg_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
287 int offset, int len, int dtype);
288int dbg_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
289 int len, int dtype);
290int dbg_leb_erase(struct ubi_volume_desc *desc, int lnum);
291int dbg_leb_unmap(struct ubi_volume_desc *desc, int lnum);
292int dbg_is_mapped(struct ubi_volume_desc *desc, int lnum);
293int dbg_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype);
294
295static inline int dbg_read(struct ubi_volume_desc *desc, int lnum, char *buf,
296 int offset, int len)
297{
298 return dbg_leb_read(desc, lnum, buf, offset, len, 0);
299}
300
301static inline int dbg_write(struct ubi_volume_desc *desc, int lnum,
302 const void *buf, int offset, int len)
303{
304 return dbg_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN);
305}
306
307static inline int dbg_change(struct ubi_volume_desc *desc, int lnum,
308 const void *buf, int len)
309{
310 return dbg_leb_change(desc, lnum, buf, len, UBI_UNKNOWN);
311}
312
Artem Bityutskiy552ff312008-10-23 11:49:28 +0300313/* Debugfs-related stuff */
314int dbg_debugfs_init(void);
315void dbg_debugfs_exit(void);
316int dbg_debugfs_init_fs(struct ubifs_info *c);
317void dbg_debugfs_exit_fs(struct ubifs_info *c);
318
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300319#else /* !CONFIG_UBIFS_FS_DEBUG */
320
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300321/* Use "if (0)" to make compiler check arguments even if debugging is off */
322#define ubifs_assert(expr) do { \
Artem Bityutskiyae380ce2011-05-19 14:13:16 +0300323 if (0) \
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300324 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
325 __func__, __LINE__, current->pid); \
326} while (0)
327
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300328#define dbg_err(fmt, ...) do { \
329 if (0) \
330 ubifs_err(fmt, ##__VA_ARGS__); \
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300331} while (0)
332
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300333#define ubifs_dbg_msg(fmt, ...) do { \
334 if (0) \
335 pr_debug(fmt "\n", ##__VA_ARGS__); \
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300336} while (0)
337
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300338#define dbg_dump_stack()
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300339#define ubifs_assert_cmt_locked(c)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300340
Artem Bityutskiy56e46742011-05-17 15:15:30 +0300341#define dbg_msg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
342#define dbg_gen(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
343#define dbg_jnl(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
344#define dbg_tnc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
345#define dbg_lp(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
346#define dbg_find(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
347#define dbg_mnt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
348#define dbg_io(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
349#define dbg_cmt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
350#define dbg_budg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
351#define dbg_log(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
352#define dbg_gc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
353#define dbg_scan(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
354#define dbg_rcvry(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300355
Artem Bityutskiy840dc6b2008-08-01 18:13:37 +0300356#define DBGKEY(key) ((char *)(key))
357#define DBGKEY1(key) ((char *)(key))
358
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700359static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; }
360static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; }
361static inline const char *dbg_ntype(int type) { return ""; }
362static inline const char *dbg_cstate(int cmt_state) { return ""; }
363static inline const char *dbg_jhead(int jhead) { return ""; }
364static inline const char *
365dbg_get_key_dump(const struct ubifs_info *c,
366 const union ubifs_key *key) { return ""; }
Artem Bityutskiy4315fb42011-05-25 17:32:42 +0300367static inline void dbg_dump_inode(struct ubifs_info *c,
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700368 const struct inode *inode) { return; }
369static inline void dbg_dump_node(const struct ubifs_info *c,
370 const void *node) { return; }
371static inline void dbg_dump_lpt_node(const struct ubifs_info *c,
372 void *node, int lnum,
373 int offs) { return; }
374static inline void
375dbg_dump_budget_req(const struct ubifs_budget_req *req) { return; }
376static inline void
377dbg_dump_lstats(const struct ubifs_lp_stats *lst) { return; }
Artem Bityutskiyf1bd66a2011-03-29 18:36:21 +0300378static inline void
379dbg_dump_budg(struct ubifs_info *c,
380 const struct ubifs_budg_info *bi) { return; }
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700381static inline void dbg_dump_lprop(const struct ubifs_info *c,
382 const struct ubifs_lprops *lp) { return; }
383static inline void dbg_dump_lprops(struct ubifs_info *c) { return; }
384static inline void dbg_dump_lpt_info(struct ubifs_info *c) { return; }
385static inline void dbg_dump_leb(const struct ubifs_info *c,
386 int lnum) { return; }
387static inline void
388dbg_dump_znode(const struct ubifs_info *c,
389 const struct ubifs_znode *znode) { return; }
390static inline void dbg_dump_heap(struct ubifs_info *c,
391 struct ubifs_lpt_heap *heap,
392 int cat) { return; }
393static inline void dbg_dump_pnode(struct ubifs_info *c,
394 struct ubifs_pnode *pnode,
395 struct ubifs_nnode *parent,
396 int iip) { return; }
397static inline void dbg_dump_tnc(struct ubifs_info *c) { return; }
398static inline void dbg_dump_index(struct ubifs_info *c) { return; }
399static inline void dbg_dump_lpt_lebs(const struct ubifs_info *c) { return; }
Artem Bityutskiy17c2f9f2008-10-17 13:31:39 +0300400
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700401static inline int dbg_walk_index(struct ubifs_info *c,
402 dbg_leaf_callback leaf_cb,
403 dbg_znode_callback znode_cb,
404 void *priv) { return 0; }
405static inline void dbg_save_space_info(struct ubifs_info *c) { return; }
406static inline int dbg_check_space_info(struct ubifs_info *c) { return 0; }
407static inline int dbg_check_lprops(struct ubifs_info *c) { return 0; }
408static inline int
409dbg_old_index_check_init(struct ubifs_info *c,
410 struct ubifs_zbranch *zroot) { return 0; }
411static inline int
412dbg_check_old_index(struct ubifs_info *c,
413 struct ubifs_zbranch *zroot) { return 0; }
414static inline int dbg_check_cats(struct ubifs_info *c) { return 0; }
415static inline int dbg_check_ltab(struct ubifs_info *c) { return 0; }
416static inline int dbg_chk_lpt_free_spc(struct ubifs_info *c) { return 0; }
417static inline int dbg_chk_lpt_sz(struct ubifs_info *c,
418 int action, int len) { return 0; }
419static inline int dbg_check_synced_i_size(struct inode *inode) { return 0; }
Artem Bityutskiy1b51e982011-05-25 17:38:29 +0300420static inline int dbg_check_dir(struct ubifs_info *c,
Artem Bityutskiy4315fb42011-05-25 17:32:42 +0300421 const struct inode *dir) { return 0; }
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700422static inline int dbg_check_tnc(struct ubifs_info *c, int extra) { return 0; }
423static inline int dbg_check_idx_size(struct ubifs_info *c,
424 long long idx_size) { return 0; }
425static inline int dbg_check_filesystem(struct ubifs_info *c) { return 0; }
426static inline void dbg_check_heap(struct ubifs_info *c,
427 struct ubifs_lpt_heap *heap,
428 int cat, int add_pos) { return; }
429static inline int dbg_check_lpt_nodes(struct ubifs_info *c,
430 struct ubifs_cnode *cnode, int row, int col) { return 0; }
431static inline int dbg_check_inode_size(struct ubifs_info *c,
432 const struct inode *inode,
433 loff_t size) { return 0; }
434static inline int
435dbg_check_data_nodes_order(struct ubifs_info *c,
436 struct list_head *head) { return 0; }
437static inline int
438dbg_check_nondata_nodes_order(struct ubifs_info *c,
439 struct list_head *head) { return 0; }
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300440
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700441static inline int dbg_force_in_the_gaps(void) { return 0; }
Artem Bityutskiybc3f07f2011-04-05 13:52:20 +0300442#define dbg_force_in_the_gaps_enabled() 0
443#define dbg_failure_mode 0
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300444
Maksim Rayskiy1dcffad2011-04-12 15:14:56 -0700445static inline int dbg_debugfs_init(void) { return 0; }
446static inline void dbg_debugfs_exit(void) { return; }
447static inline int dbg_debugfs_init_fs(struct ubifs_info *c) { return 0; }
448static inline int dbg_debugfs_exit_fs(struct ubifs_info *c) { return 0; }
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300449
Artem Bityutskiy552ff312008-10-23 11:49:28 +0300450#endif /* !CONFIG_UBIFS_FS_DEBUG */
Artem Bityutskiy1e517642008-07-14 19:08:37 +0300451#endif /* !__UBIFS_DEBUG_H__ */