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/befs.h

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  * befs_fs.h
    3  *
    4  * Copyright (C) 2001-2002 Will Dyson <will_dyson@pobox.com>
    5  * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
    6  */
    7 
    8 #ifndef _LINUX_BEFS_H
    9 #define _LINUX_BEFS_H
   10 
   11 #include "befs_fs_types.h"
   12 
   13 /* used in debug.c */
   14 #define BEFS_VERSION "0.9.3"
   15 
   16 typedef u64 befs_blocknr_t;
   17 typedef u32 vfs_blocknr_t;
   18 
   19 /*
   20  * BeFS in memory structures
   21  */
   22 
   23 typedef struct befs_mount_options {
   24         gid_t gid;
   25         uid_t uid;
   26         int use_gid;
   27         int use_uid;
   28         int debug;
   29         char *iocharset;
   30 } befs_mount_options;
   31 
   32 typedef struct befs_sb_info {
   33         u32 magic1;
   34         u32 block_size;
   35         u32 block_shift;
   36         int byte_order;
   37         befs_off_t num_blocks;
   38         befs_off_t used_blocks;
   39         u32 inode_size;
   40         u32 magic2;
   41 
   42         /* Allocation group information */
   43         u32 blocks_per_ag;
   44         u32 ag_shift;
   45         u32 num_ags;
   46 
   47         /* jornal log entry */
   48         befs_block_run log_blocks;
   49         befs_off_t log_start;
   50         befs_off_t log_end;
   51 
   52         befs_inode_addr root_dir;
   53         befs_inode_addr indices;
   54         u32 magic3;
   55 
   56         befs_mount_options mount_opts;
   57         struct nls_table *nls;
   58 
   59 } befs_sb_info;
   60 
   61 typedef struct befs_inode_info {
   62         u32 i_flags;
   63         u32 i_type;
   64 
   65         befs_inode_addr i_inode_num;
   66         befs_inode_addr i_parent;
   67         befs_inode_addr i_attribute;
   68 
   69         union {
   70                 befs_data_stream ds;
   71                 char symlink[BEFS_SYMLINK_LEN];
   72         } i_data;
   73 
   74 } befs_inode_info;
   75 
   76 enum befs_err {
   77         BEFS_OK,
   78         BEFS_ERR,
   79         BEFS_BAD_INODE,
   80         BEFS_BT_END,
   81         BEFS_BT_EMPTY,
   82         BEFS_BT_MATCH,
   83         BEFS_BT_PARMATCH,
   84         BEFS_BT_NOT_FOUND
   85 };
   86 
   87 /****************************/
   88 /* debug.c */
   89 void befs_error(const struct super_block *sb, const char *fmt, ...);
   90 void befs_warning(const struct super_block *sb, const char *fmt, ...);
   91 void befs_debug(const struct super_block *sb, const char *fmt, ...);
   92 
   93 void befs_dump_super_block(const struct super_block *sb, befs_super_block *);
   94 void befs_dump_inode(const struct super_block *sb, befs_inode *);
   95 void befs_dump_index_entry(const struct super_block *sb, befs_btree_super *);
   96 void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *);
   97 void befs_dump_inode_addr(const struct super_block *sb, befs_inode_addr);
   98 /****************************/
   99 
  100 /* Gets a pointer to the private portion of the super_block
  101  * structure from the public part
  102  */
  103 static inline befs_sb_info *
  104 BEFS_SB(const struct super_block *super)
  105 {
  106         return (befs_sb_info *) super->u.generic_sbp;
  107 }
  108 
  109 static inline befs_inode_info *
  110 BEFS_I(const struct inode *inode)
  111 {
  112         return (befs_inode_info *) inode->u.generic_ip;
  113 }
  114 
  115 static inline befs_blocknr_t
  116 iaddr2blockno(struct super_block *sb, befs_inode_addr * iaddr)
  117 {
  118         return ((iaddr->allocation_group << BEFS_SB(sb)->ag_shift) +
  119                 iaddr->start);
  120 }
  121 
  122 static inline befs_inode_addr
  123 blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno)
  124 {
  125         befs_inode_addr iaddr;
  126         iaddr.allocation_group = blockno >> BEFS_SB(sb)->ag_shift;
  127         iaddr.start =
  128             blockno - (iaddr.allocation_group << BEFS_SB(sb)->ag_shift);
  129         iaddr.len = 1;
  130 
  131         return iaddr;
  132 }
  133 
  134 static inline unsigned int
  135 befs_iaddrs_per_block(struct super_block *sb)
  136 {
  137         return BEFS_SB(sb)->block_size / sizeof (befs_inode_addr);
  138 }
  139 
  140 static inline int
  141 befs_iaddr_is_empty(befs_inode_addr * iaddr)
  142 {
  143         return (!iaddr->allocation_group) && (!iaddr->start) && (!iaddr->len);
  144 }
  145 
  146 static inline size_t
  147 befs_brun_size(struct super_block *sb, befs_block_run run)
  148 {
  149         return BEFS_SB(sb)->block_size * run.len;
  150 }
  151 
  152 #endif                          /* _LINUX_BEFS_H */

Cache object: 8a82b4882d0ae301a025f691afed53ec


[ 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.