2 * linux/fs/befs/debug.c
4 * Copyright (C) 2001 Will Dyson (will_dyson at pobox.com)
6 * With help from the ntfs-tng driver by Anton Altparmakov
8 * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
16 #include <linux/string.h>
17 #include <linux/spinlock.h>
18 #include <linux/kernel.h>
21 #endif /* __KERNEL__ */
26 #define ERRBUFSIZE 1024
29 befs_error(const struct super_block *sb, const char *fmt, ...)
32 char err_buf[ERRBUFSIZE];
35 vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
38 printk(KERN_ERR "BeFS(%s): %s\n", bdevname(sb->s_dev), err_buf);
40 befs_debug(sb, err_buf);
44 befs_warning(const struct super_block *sb, const char *fmt, ...)
47 char err_buf[ERRBUFSIZE];
50 vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
53 printk(KERN_WARNING "BeFS(%s): %s\n", bdevname(sb->s_dev), err_buf);
55 befs_debug(sb, err_buf);
59 befs_debug(const struct super_block *sb, const char *fmt, ...)
61 #ifdef CONFIG_BEFS_DEBUG
64 char err_buf[ERRBUFSIZE];
66 if (BEFS_SB(sb)->mount_opts.debug) {
68 vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
71 printk(KERN_DEBUG "BeFS(%s): %s\n",
72 bdevname(sb->s_dev), err_buf);
74 #endif //CONFIG_BEFS_DEBUG
78 befs_dump_inode(const struct super_block *sb, befs_inode * inode)
80 #ifdef CONFIG_BEFS_DEBUG
82 befs_block_run tmp_run;
84 befs_debug(sb, "befs_inode infomation");
86 befs_debug(sb, " magic1 %08x", fs32_to_cpu(sb, inode->magic1));
88 tmp_run = fsrun_to_cpu(sb, inode->inode_num);
89 befs_debug(sb, " inode_num %u, %hu, %hu",
90 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
92 befs_debug(sb, " uid %u", fs32_to_cpu(sb, inode->uid));
93 befs_debug(sb, " gid %u", fs32_to_cpu(sb, inode->gid));
94 befs_debug(sb, " mode %08x", fs32_to_cpu(sb, inode->mode));
95 befs_debug(sb, " flags %08x", fs32_to_cpu(sb, inode->flags));
96 befs_debug(sb, " create_time %Lu",
97 fs64_to_cpu(sb, inode->create_time));
98 befs_debug(sb, " last_modified_time %Lu",
99 fs64_to_cpu(sb, inode->last_modified_time));
101 tmp_run = fsrun_to_cpu(sb, inode->parent);
102 befs_debug(sb, " parent [%u, %hu, %hu]",
103 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
105 tmp_run = fsrun_to_cpu(sb, inode->attributes);
106 befs_debug(sb, " attributes [%u, %hu, %hu]",
107 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
109 befs_debug(sb, " type %08x", fs32_to_cpu(sb, inode->type));
110 befs_debug(sb, " inode_size %u", fs32_to_cpu(sb, inode->inode_size));
112 if (S_ISLNK(inode->mode)) {
113 befs_debug(sb, " Symbolic link [%s]", inode->data.symlink);
117 for (i = 0; i < BEFS_NUM_DIRECT_BLOCKS; i++) {
119 fsrun_to_cpu(sb, inode->data.datastream.direct[i]);
120 befs_debug(sb, " direct %d [%u, %hu, %hu]", i,
121 tmp_run.allocation_group, tmp_run.start,
124 befs_debug(sb, " max_direct_range %Lu",
126 inode->data.datastream.
129 tmp_run = fsrun_to_cpu(sb, inode->data.datastream.indirect);
130 befs_debug(sb, " indirect [%u, %hu, %hu]",
131 tmp_run.allocation_group,
132 tmp_run.start, tmp_run.len);
134 befs_debug(sb, " max_indirect_range %Lu",
136 inode->data.datastream.
137 max_indirect_range));
140 fsrun_to_cpu(sb, inode->data.datastream.double_indirect);
141 befs_debug(sb, " double indirect [%u, %hu, %hu]",
142 tmp_run.allocation_group, tmp_run.start,
145 befs_debug(sb, " max_double_indirect_range %Lu",
147 inode->data.datastream.
148 max_double_indirect_range));
150 befs_debug(sb, " size %Lu",
151 fs64_to_cpu(sb, inode->data.datastream.size));
154 #endif //CONFIG_BEFS_DEBUG
158 * Display super block structure for debug.
162 befs_dump_super_block(const struct super_block *sb, befs_super_block * sup)
164 #ifdef CONFIG_BEFS_DEBUG
166 befs_block_run tmp_run;
168 befs_debug(sb, "befs_super_block information");
170 befs_debug(sb, " name %s", sup->name);
171 befs_debug(sb, " magic1 %08x", fs32_to_cpu(sb, sup->magic1));
172 befs_debug(sb, " fs_byte_order %08x",
173 fs32_to_cpu(sb, sup->fs_byte_order));
175 befs_debug(sb, " block_size %u", fs32_to_cpu(sb, sup->block_size));
176 befs_debug(sb, " block_shift %u", fs32_to_cpu(sb, sup->block_shift));
178 befs_debug(sb, " num_blocks %Lu", fs64_to_cpu(sb, sup->num_blocks));
179 befs_debug(sb, " used_blocks %Lu", fs64_to_cpu(sb, sup->used_blocks));
181 befs_debug(sb, " magic2 %08x", fs32_to_cpu(sb, sup->magic2));
182 befs_debug(sb, " blocks_per_ag %u",
183 fs32_to_cpu(sb, sup->blocks_per_ag));
184 befs_debug(sb, " ag_shift %u", fs32_to_cpu(sb, sup->ag_shift));
185 befs_debug(sb, " num_ags %u", fs32_to_cpu(sb, sup->num_ags));
187 befs_debug(sb, " flags %08x", fs32_to_cpu(sb, sup->flags));
189 tmp_run = fsrun_to_cpu(sb, sup->log_blocks);
190 befs_debug(sb, " log_blocks %u, %hu, %hu",
191 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
193 befs_debug(sb, " log_start %Ld", fs64_to_cpu(sb, sup->log_start));
194 befs_debug(sb, " log_end %Ld", fs64_to_cpu(sb, sup->log_end));
196 befs_debug(sb, " magic3 %08x", fs32_to_cpu(sb, sup->magic3));
198 tmp_run = fsrun_to_cpu(sb, sup->root_dir);
199 befs_debug(sb, " root_dir %u, %hu, %hu",
200 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
202 tmp_run = fsrun_to_cpu(sb, sup->indices);
203 befs_debug(sb, " indices %u, %hu, %hu",
204 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
206 #endif //CONFIG_BEFS_DEBUG
210 befs_dump_small_data(const struct super_block *sb, befs_small_data * sd)
215 befs_dump_run(const struct super_block *sb, befs_block_run run)
217 #ifdef CONFIG_BEFS_DEBUG
219 run = fsrun_to_cpu(sb, run);
221 befs_debug(sb, "[%u, %hu, %hu]",
222 run.allocation_group, run.start, run.len);
224 #endif //CONFIG_BEFS_DEBUG
228 befs_dump_index_entry(const struct super_block *sb, befs_btree_super * super)
230 #ifdef CONFIG_BEFS_DEBUG
232 befs_debug(sb, "Btree super structure");
233 befs_debug(sb, " magic %08x", fs32_to_cpu(sb, super->magic));
234 befs_debug(sb, " node_size %u", fs32_to_cpu(sb, super->node_size));
235 befs_debug(sb, " max_depth %08x", fs32_to_cpu(sb, super->max_depth));
237 befs_debug(sb, " data_type %08x", fs32_to_cpu(sb, super->data_type));
238 befs_debug(sb, " root_node_pointer %016LX",
239 fs64_to_cpu(sb, super->root_node_ptr));
240 befs_debug(sb, " free_node_pointer %016LX",
241 fs64_to_cpu(sb, super->free_node_ptr));
242 befs_debug(sb, " maximum size %016LX",
243 fs64_to_cpu(sb, super->max_size));
245 #endif //CONFIG_BEFS_DEBUG
249 befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead * node)
251 #ifdef CONFIG_BEFS_DEBUG
253 befs_debug(sb, "Btree node structure");
254 befs_debug(sb, " left %016LX", fs64_to_cpu(sb, node->left));
255 befs_debug(sb, " right %016LX", fs64_to_cpu(sb, node->right));
256 befs_debug(sb, " overflow %016LX", fs64_to_cpu(sb, node->overflow));
257 befs_debug(sb, " all_key_count %hu",
258 fs16_to_cpu(sb, node->all_key_count));
259 befs_debug(sb, " all_key_length %hu",
260 fs16_to_cpu(sb, node->all_key_length));
262 #endif //CONFIG_BEFS_DEBUG