^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * linux/fs/befs/debug.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2001 Will Dyson (will_dyson at pobox.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * With help from the ntfs-tng driver by Anton Altparmakov
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * debug functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #ifdef __KERNEL__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <stdarg.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #endif /* __KERNEL__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include "befs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) befs_error(const struct super_block *sb, const char *fmt, ...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct va_format vaf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) va_list args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) va_start(args, fmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) vaf.fmt = fmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) vaf.va = &args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) pr_err("(%s): %pV\n", sb->s_id, &vaf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) va_end(args);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) befs_warning(const struct super_block *sb, const char *fmt, ...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct va_format vaf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) va_list args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) va_start(args, fmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) vaf.fmt = fmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) vaf.va = &args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) pr_warn("(%s): %pV\n", sb->s_id, &vaf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) va_end(args);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) befs_debug(const struct super_block *sb, const char *fmt, ...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #ifdef CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct va_format vaf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) va_list args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) va_start(args, fmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) vaf.fmt = fmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) vaf.va = &args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) pr_debug("(%s): %pV\n", sb->s_id, &vaf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) va_end(args);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #endif //CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) befs_dump_inode(const struct super_block *sb, befs_inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #ifdef CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) befs_block_run tmp_run;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) befs_debug(sb, "befs_inode information");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) befs_debug(sb, " magic1 %08x", fs32_to_cpu(sb, inode->magic1));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) tmp_run = fsrun_to_cpu(sb, inode->inode_num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) befs_debug(sb, " inode_num %u, %hu, %hu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) tmp_run.allocation_group, tmp_run.start, tmp_run.len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) befs_debug(sb, " uid %u", fs32_to_cpu(sb, inode->uid));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) befs_debug(sb, " gid %u", fs32_to_cpu(sb, inode->gid));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) befs_debug(sb, " mode %08x", fs32_to_cpu(sb, inode->mode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) befs_debug(sb, " flags %08x", fs32_to_cpu(sb, inode->flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) befs_debug(sb, " create_time %llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) fs64_to_cpu(sb, inode->create_time));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) befs_debug(sb, " last_modified_time %llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) fs64_to_cpu(sb, inode->last_modified_time));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) tmp_run = fsrun_to_cpu(sb, inode->parent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) befs_debug(sb, " parent [%u, %hu, %hu]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) tmp_run.allocation_group, tmp_run.start, tmp_run.len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) tmp_run = fsrun_to_cpu(sb, inode->attributes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) befs_debug(sb, " attributes [%u, %hu, %hu]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) tmp_run.allocation_group, tmp_run.start, tmp_run.len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) befs_debug(sb, " type %08x", fs32_to_cpu(sb, inode->type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) befs_debug(sb, " inode_size %u", fs32_to_cpu(sb, inode->inode_size));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) if (S_ISLNK(fs32_to_cpu(sb, inode->mode))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) befs_debug(sb, " Symbolic link [%s]", inode->data.symlink);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) for (i = 0; i < BEFS_NUM_DIRECT_BLOCKS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) tmp_run =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) fsrun_to_cpu(sb, inode->data.datastream.direct[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) befs_debug(sb, " direct %d [%u, %hu, %hu]", i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) tmp_run.allocation_group, tmp_run.start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) tmp_run.len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) befs_debug(sb, " max_direct_range %llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) fs64_to_cpu(sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) inode->data.datastream.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) max_direct_range));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) tmp_run = fsrun_to_cpu(sb, inode->data.datastream.indirect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) befs_debug(sb, " indirect [%u, %hu, %hu]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) tmp_run.allocation_group,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) tmp_run.start, tmp_run.len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) befs_debug(sb, " max_indirect_range %llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) fs64_to_cpu(sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) inode->data.datastream.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) max_indirect_range));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) tmp_run =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) fsrun_to_cpu(sb, inode->data.datastream.double_indirect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) befs_debug(sb, " double indirect [%u, %hu, %hu]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) tmp_run.allocation_group, tmp_run.start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) tmp_run.len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) befs_debug(sb, " max_double_indirect_range %llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) fs64_to_cpu(sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) inode->data.datastream.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) max_double_indirect_range));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) befs_debug(sb, " size %llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) fs64_to_cpu(sb, inode->data.datastream.size));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #endif //CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * Display super block structure for debug.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) befs_dump_super_block(const struct super_block *sb, befs_super_block *sup)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) #ifdef CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) befs_block_run tmp_run;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) befs_debug(sb, "befs_super_block information");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) befs_debug(sb, " name %s", sup->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) befs_debug(sb, " magic1 %08x", fs32_to_cpu(sb, sup->magic1));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) befs_debug(sb, " fs_byte_order %08x",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) fs32_to_cpu(sb, sup->fs_byte_order));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) befs_debug(sb, " block_size %u", fs32_to_cpu(sb, sup->block_size));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) befs_debug(sb, " block_shift %u", fs32_to_cpu(sb, sup->block_shift));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) befs_debug(sb, " num_blocks %llu", fs64_to_cpu(sb, sup->num_blocks));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) befs_debug(sb, " used_blocks %llu", fs64_to_cpu(sb, sup->used_blocks));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) befs_debug(sb, " inode_size %u", fs32_to_cpu(sb, sup->inode_size));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) befs_debug(sb, " magic2 %08x", fs32_to_cpu(sb, sup->magic2));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) befs_debug(sb, " blocks_per_ag %u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) fs32_to_cpu(sb, sup->blocks_per_ag));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) befs_debug(sb, " ag_shift %u", fs32_to_cpu(sb, sup->ag_shift));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) befs_debug(sb, " num_ags %u", fs32_to_cpu(sb, sup->num_ags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) befs_debug(sb, " flags %08x", fs32_to_cpu(sb, sup->flags));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) tmp_run = fsrun_to_cpu(sb, sup->log_blocks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) befs_debug(sb, " log_blocks %u, %hu, %hu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) tmp_run.allocation_group, tmp_run.start, tmp_run.len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) befs_debug(sb, " log_start %lld", fs64_to_cpu(sb, sup->log_start));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) befs_debug(sb, " log_end %lld", fs64_to_cpu(sb, sup->log_end));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) befs_debug(sb, " magic3 %08x", fs32_to_cpu(sb, sup->magic3));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) tmp_run = fsrun_to_cpu(sb, sup->root_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) befs_debug(sb, " root_dir %u, %hu, %hu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) tmp_run.allocation_group, tmp_run.start, tmp_run.len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) tmp_run = fsrun_to_cpu(sb, sup->indices);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) befs_debug(sb, " indices %u, %hu, %hu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) tmp_run.allocation_group, tmp_run.start, tmp_run.len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #endif //CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) /* unused */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) befs_dump_small_data(const struct super_block *sb, befs_small_data *sd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) /* unused */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) befs_dump_run(const struct super_block *sb, befs_disk_block_run run)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) #ifdef CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) befs_block_run n = fsrun_to_cpu(sb, run);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) befs_debug(sb, "[%u, %hu, %hu]", n.allocation_group, n.start, n.len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) #endif //CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) #endif /* 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) befs_dump_index_entry(const struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) befs_disk_btree_super *super)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) #ifdef CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) befs_debug(sb, "Btree super structure");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) befs_debug(sb, " magic %08x", fs32_to_cpu(sb, super->magic));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) befs_debug(sb, " node_size %u", fs32_to_cpu(sb, super->node_size));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) befs_debug(sb, " max_depth %08x", fs32_to_cpu(sb, super->max_depth));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) befs_debug(sb, " data_type %08x", fs32_to_cpu(sb, super->data_type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) befs_debug(sb, " root_node_pointer %016LX",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) fs64_to_cpu(sb, super->root_node_ptr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) befs_debug(sb, " free_node_pointer %016LX",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) fs64_to_cpu(sb, super->free_node_ptr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) befs_debug(sb, " maximum size %016LX",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) fs64_to_cpu(sb, super->max_size));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #endif //CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) #ifdef CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) befs_debug(sb, "Btree node structure");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) befs_debug(sb, " left %016LX", fs64_to_cpu(sb, node->left));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) befs_debug(sb, " right %016LX", fs64_to_cpu(sb, node->right));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) befs_debug(sb, " overflow %016LX", fs64_to_cpu(sb, node->overflow));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) befs_debug(sb, " all_key_count %hu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) fs16_to_cpu(sb, node->all_key_count));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) befs_debug(sb, " all_key_length %hu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) fs16_to_cpu(sb, node->all_key_length));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) #endif //CONFIG_BEFS_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) }