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", sb->s_id, 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", sb->s_id, 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", sb->s_id, err_buf);
73 #endif //CONFIG_BEFS_DEBUG
77 befs_dump_inode(const struct super_block *sb, befs_inode * inode)
79 #ifdef CONFIG_BEFS_DEBUG
81 befs_block_run tmp_run;
83 befs_debug(sb, "befs_inode information");
85 befs_debug(sb, " magic1 %08x", fs32_to_cpu(sb, inode->magic1));
87 tmp_run = fsrun_to_cpu(sb, inode->inode_num);
88 befs_debug(sb, " inode_num %u, %hu, %hu",
89 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
91 befs_debug(sb, " uid %u", fs32_to_cpu(sb, inode->uid));
92 befs_debug(sb, " gid %u", fs32_to_cpu(sb, inode->gid));
93 befs_debug(sb, " mode %08x", fs32_to_cpu(sb, inode->mode));
94 befs_debug(sb, " flags %08x", fs32_to_cpu(sb, inode->flags));
95 befs_debug(sb, " create_time %Lu",
96 fs64_to_cpu(sb, inode->create_time));
97 befs_debug(sb, " last_modified_time %Lu",
98 fs64_to_cpu(sb, inode->last_modified_time));
100 tmp_run = fsrun_to_cpu(sb, inode->parent);
101 befs_debug(sb, " parent [%u, %hu, %hu]",
102 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
104 tmp_run = fsrun_to_cpu(sb, inode->attributes);
105 befs_debug(sb, " attributes [%u, %hu, %hu]",
106 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
108 befs_debug(sb, " type %08x", fs32_to_cpu(sb, inode->type));
109 befs_debug(sb, " inode_size %u", fs32_to_cpu(sb, inode->inode_size));
111 if (S_ISLNK(inode->mode)) {
112 befs_debug(sb, " Symbolic link [%s]", inode->data.symlink);
116 for (i = 0; i < BEFS_NUM_DIRECT_BLOCKS; i++) {
118 fsrun_to_cpu(sb, inode->data.datastream.direct[i]);
119 befs_debug(sb, " direct %d [%u, %hu, %hu]", i,
120 tmp_run.allocation_group, tmp_run.start,
123 befs_debug(sb, " max_direct_range %Lu",
125 inode->data.datastream.
128 tmp_run = fsrun_to_cpu(sb, inode->data.datastream.indirect);
129 befs_debug(sb, " indirect [%u, %hu, %hu]",
130 tmp_run.allocation_group,
131 tmp_run.start, tmp_run.len);
133 befs_debug(sb, " max_indirect_range %Lu",
135 inode->data.datastream.
136 max_indirect_range));
139 fsrun_to_cpu(sb, inode->data.datastream.double_indirect);
140 befs_debug(sb, " double indirect [%u, %hu, %hu]",
141 tmp_run.allocation_group, tmp_run.start,
144 befs_debug(sb, " max_double_indirect_range %Lu",
146 inode->data.datastream.
147 max_double_indirect_range));
149 befs_debug(sb, " size %Lu",
150 fs64_to_cpu(sb, inode->data.datastream.size));
153 #endif //CONFIG_BEFS_DEBUG
157 * Display super block structure for debug.
161 befs_dump_super_block(const struct super_block *sb, befs_super_block * sup)
163 #ifdef CONFIG_BEFS_DEBUG
165 befs_block_run tmp_run;
167 befs_debug(sb, "befs_super_block information");
169 befs_debug(sb, " name %s", sup->name);
170 befs_debug(sb, " magic1 %08x", fs32_to_cpu(sb, sup->magic1));
171 befs_debug(sb, " fs_byte_order %08x",
172 fs32_to_cpu(sb, sup->fs_byte_order));
174 befs_debug(sb, " block_size %u", fs32_to_cpu(sb, sup->block_size));
175 befs_debug(sb, " block_shift %u", fs32_to_cpu(sb, sup->block_shift));
177 befs_debug(sb, " num_blocks %Lu", fs64_to_cpu(sb, sup->num_blocks));
178 befs_debug(sb, " used_blocks %Lu", fs64_to_cpu(sb, sup->used_blocks));
180 befs_debug(sb, " magic2 %08x", fs32_to_cpu(sb, sup->magic2));
181 befs_debug(sb, " blocks_per_ag %u",
182 fs32_to_cpu(sb, sup->blocks_per_ag));
183 befs_debug(sb, " ag_shift %u", fs32_to_cpu(sb, sup->ag_shift));
184 befs_debug(sb, " num_ags %u", fs32_to_cpu(sb, sup->num_ags));
186 befs_debug(sb, " flags %08x", fs32_to_cpu(sb, sup->flags));
188 tmp_run = fsrun_to_cpu(sb, sup->log_blocks);
189 befs_debug(sb, " log_blocks %u, %hu, %hu",
190 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
192 befs_debug(sb, " log_start %Ld", fs64_to_cpu(sb, sup->log_start));
193 befs_debug(sb, " log_end %Ld", fs64_to_cpu(sb, sup->log_end));
195 befs_debug(sb, " magic3 %08x", fs32_to_cpu(sb, sup->magic3));
197 tmp_run = fsrun_to_cpu(sb, sup->root_dir);
198 befs_debug(sb, " root_dir %u, %hu, %hu",
199 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
201 tmp_run = fsrun_to_cpu(sb, sup->indices);
202 befs_debug(sb, " indices %u, %hu, %hu",
203 tmp_run.allocation_group, tmp_run.start, tmp_run.len);
205 #endif //CONFIG_BEFS_DEBUG
209 befs_dump_small_data(const struct super_block *sb, befs_small_data * sd)
214 befs_dump_run(const struct super_block *sb, befs_block_run run)
216 #ifdef CONFIG_BEFS_DEBUG
218 run = fsrun_to_cpu(sb, run);
220 befs_debug(sb, "[%u, %hu, %hu]",
221 run.allocation_group, run.start, run.len);
223 #endif //CONFIG_BEFS_DEBUG
227 befs_dump_index_entry(const struct super_block *sb, befs_btree_super * super)
229 #ifdef CONFIG_BEFS_DEBUG
231 befs_debug(sb, "Btree super structure");
232 befs_debug(sb, " magic %08x", fs32_to_cpu(sb, super->magic));
233 befs_debug(sb, " node_size %u", fs32_to_cpu(sb, super->node_size));
234 befs_debug(sb, " max_depth %08x", fs32_to_cpu(sb, super->max_depth));
236 befs_debug(sb, " data_type %08x", fs32_to_cpu(sb, super->data_type));
237 befs_debug(sb, " root_node_pointer %016LX",
238 fs64_to_cpu(sb, super->root_node_ptr));
239 befs_debug(sb, " free_node_pointer %016LX",
240 fs64_to_cpu(sb, super->free_node_ptr));
241 befs_debug(sb, " maximum size %016LX",
242 fs64_to_cpu(sb, super->max_size));
244 #endif //CONFIG_BEFS_DEBUG
248 befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead * node)
250 #ifdef CONFIG_BEFS_DEBUG
252 befs_debug(sb, "Btree node structure");
253 befs_debug(sb, " left %016LX", fs64_to_cpu(sb, node->left));
254 befs_debug(sb, " right %016LX", fs64_to_cpu(sb, node->right));
255 befs_debug(sb, " overflow %016LX", fs64_to_cpu(sb, node->overflow));
256 befs_debug(sb, " all_key_count %hu",
257 fs16_to_cpu(sb, node->all_key_count));
258 befs_debug(sb, " all_key_length %hu",
259 fs16_to_cpu(sb, node->all_key_length));
261 #endif //CONFIG_BEFS_DEBUG