The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/fs/befs/debug.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  *  linux/fs/befs/debug.c
    3  * 
    4  * Copyright (C) 2001 Will Dyson (will_dyson at pobox.com)
    5  *
    6  * With help from the ntfs-tng driver by Anton Altparmakov
    7  *
    8  * Copyright (C) 1999  Makoto Kato (m_kato@ga2.so-net.ne.jp)
    9  *
   10  * debug functions
   11  */
   12 
   13 #ifdef __KERNEL__
   14 
   15 #include <stdarg.h>
   16 #include <linux/string.h>
   17 #include <linux/spinlock.h>
   18 #include <linux/kernel.h>
   19 #include <linux/fs.h>
   20 
   21 #endif                          /* __KERNEL__ */
   22 
   23 #include "befs.h"
   24 #include "endian.h"
   25 
   26 #define ERRBUFSIZE 1024
   27 
   28 void
   29 befs_error(const struct super_block *sb, const char *fmt, ...)
   30 {
   31         va_list args;
   32         char err_buf[ERRBUFSIZE];
   33 
   34         va_start(args, fmt);
   35         vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
   36         va_end(args);
   37 
   38         printk(KERN_ERR "BeFS(%s): %s\n", bdevname(sb->s_dev), err_buf);
   39 
   40         befs_debug(sb, err_buf);
   41 }
   42 
   43 void
   44 befs_warning(const struct super_block *sb, const char *fmt, ...)
   45 {
   46         va_list args;
   47         char err_buf[ERRBUFSIZE];
   48 
   49         va_start(args, fmt);
   50         vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
   51         va_end(args);
   52 
   53         printk(KERN_WARNING "BeFS(%s): %s\n", bdevname(sb->s_dev), err_buf);
   54 
   55         befs_debug(sb, err_buf);
   56 }
   57 
   58 void
   59 befs_debug(const struct super_block *sb, const char *fmt, ...)
   60 {
   61 #ifdef CONFIG_BEFS_DEBUG
   62 
   63         va_list args;
   64         char err_buf[ERRBUFSIZE];
   65 
   66         if (BEFS_SB(sb)->mount_opts.debug) {
   67                 va_start(args, fmt);
   68                 vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
   69                 va_end(args);
   70 
   71                 printk(KERN_DEBUG "BeFS(%s): %s\n",
   72                        bdevname(sb->s_dev), err_buf);
   73         }
   74 #endif                          //CONFIG_BEFS_DEBUG
   75 }
   76 
   77 void
   78 befs_dump_inode(const struct super_block *sb, befs_inode * inode)
   79 {
   80 #ifdef CONFIG_BEFS_DEBUG
   81 
   82         befs_block_run tmp_run;
   83 
   84         befs_debug(sb, "befs_inode infomation");
   85 
   86         befs_debug(sb, "  magic1 %08x", fs32_to_cpu(sb, inode->magic1));
   87 
   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);
   91 
   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));
  100 
  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);
  104 
  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);
  108 
  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));
  111 
  112         if (S_ISLNK(inode->mode)) {
  113                 befs_debug(sb, "  Symbolic link [%s]", inode->data.symlink);
  114         } else {
  115                 int i;
  116 
  117                 for (i = 0; i < BEFS_NUM_DIRECT_BLOCKS; i++) {
  118                         tmp_run =
  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,
  122                                    tmp_run.len);
  123                 }
  124                 befs_debug(sb, "  max_direct_range %Lu",
  125                            fs64_to_cpu(sb,
  126                                        inode->data.datastream.
  127                                        max_direct_range));
  128 
  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);
  133 
  134                 befs_debug(sb, "  max_indirect_range %Lu",
  135                            fs64_to_cpu(sb,
  136                                        inode->data.datastream.
  137                                        max_indirect_range));
  138 
  139                 tmp_run =
  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,
  143                            tmp_run.len);
  144 
  145                 befs_debug(sb, "  max_double_indirect_range %Lu",
  146                            fs64_to_cpu(sb,
  147                                        inode->data.datastream.
  148                                        max_double_indirect_range));
  149 
  150                 befs_debug(sb, "  size %Lu",
  151                            fs64_to_cpu(sb, inode->data.datastream.size));
  152         }
  153 
  154 #endif                          //CONFIG_BEFS_DEBUG
  155 }
  156 
  157 /*
  158  * Display super block structure for debug.
  159  */
  160 
  161 void
  162 befs_dump_super_block(const struct super_block *sb, befs_super_block * sup)
  163 {
  164 #ifdef CONFIG_BEFS_DEBUG
  165 
  166         befs_block_run tmp_run;
  167 
  168         befs_debug(sb, "befs_super_block information");
  169 
  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));
  174 
  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));
  177 
  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));
  180 
  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));
  186 
  187         befs_debug(sb, "  flags %08x", fs32_to_cpu(sb, sup->flags));
  188 
  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);
  192 
  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));
  195 
  196         befs_debug(sb, "  magic3 %08x", fs32_to_cpu(sb, sup->magic3));
  197 
  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);
  201 
  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);
  205 
  206 #endif                          //CONFIG_BEFS_DEBUG
  207 }
  208 
  209 void
  210 befs_dump_small_data(const struct super_block *sb, befs_small_data * sd)
  211 {
  212 }
  213 
  214 void
  215 befs_dump_run(const struct super_block *sb, befs_block_run run)
  216 {
  217 #ifdef CONFIG_BEFS_DEBUG
  218 
  219         run = fsrun_to_cpu(sb, run);
  220 
  221         befs_debug(sb, "[%u, %hu, %hu]",
  222                    run.allocation_group, run.start, run.len);
  223 
  224 #endif                          //CONFIG_BEFS_DEBUG
  225 }
  226 
  227 void
  228 befs_dump_index_entry(const struct super_block *sb, befs_btree_super * super)
  229 {
  230 #ifdef CONFIG_BEFS_DEBUG
  231 
  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));
  236 
  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));
  244 
  245 #endif                          //CONFIG_BEFS_DEBUG
  246 }
  247 
  248 void
  249 befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead * node)
  250 {
  251 #ifdef CONFIG_BEFS_DEBUG
  252 
  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));
  261 
  262 #endif                          //CONFIG_BEFS_DEBUG
  263 }

Cache object: aa331b99c171383174892ce5de05230b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.