Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
befs.h
Go to the documentation of this file.
1 /*
2  * befs.h
3  *
4  * Copyright (C) 2001-2002 Will Dyson <[email protected]>
5  * Copyright (C) 1999 Makoto Kato ([email protected])
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 
18 /*
19  * BeFS in memory structures
20  */
21 
22 typedef struct befs_mount_options {
25  int use_gid;
26  int use_uid;
27  int debug;
28  char *iocharset;
30 
31 typedef struct befs_sb_info {
40 
41  /* Allocation group information */
45 
46  /* jornal log entry */
47  befs_block_run log_blocks;
50 
54 
56  struct nls_table *nls;
57 
58 } befs_sb_info;
59 
60 typedef struct befs_inode_info {
63 
67 
68  union {
69  befs_data_stream ds;
71  } i_data;
72 
73  struct inode vfs_inode;
74 
76 
77 enum befs_err {
86 };
87 
88 
89 /****************************/
90 /* debug.c */
91 void befs_error(const struct super_block *sb, const char *fmt, ...);
92 void befs_warning(const struct super_block *sb, const char *fmt, ...);
93 void befs_debug(const struct super_block *sb, const char *fmt, ...);
94 
95 void befs_dump_super_block(const struct super_block *sb, befs_super_block *);
96 void befs_dump_inode(const struct super_block *sb, befs_inode *);
97 void befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super *);
98 void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *);
99 /****************************/
100 
101 
102 /* Gets a pointer to the private portion of the super_block
103  * structure from the public part
104  */
105 static inline befs_sb_info *
106 BEFS_SB(const struct super_block *super)
107 {
108  return (befs_sb_info *) super->s_fs_info;
109 }
110 
111 static inline befs_inode_info *
112 BEFS_I(const struct inode *inode)
113 {
114  return list_entry(inode, struct befs_inode_info, vfs_inode);
115 }
116 
117 static inline befs_blocknr_t
118 iaddr2blockno(struct super_block *sb, befs_inode_addr * iaddr)
119 {
120  return ((iaddr->allocation_group << BEFS_SB(sb)->ag_shift) +
121  iaddr->start);
122 }
123 
124 static inline befs_inode_addr
125 blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno)
126 {
127  befs_inode_addr iaddr;
128  iaddr.allocation_group = blockno >> BEFS_SB(sb)->ag_shift;
129  iaddr.start =
130  blockno - (iaddr.allocation_group << BEFS_SB(sb)->ag_shift);
131  iaddr.len = 1;
132 
133  return iaddr;
134 }
135 
136 static inline unsigned int
137 befs_iaddrs_per_block(struct super_block *sb)
138 {
139  return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr);
140 }
141 
142 static inline int
143 befs_iaddr_is_empty(befs_inode_addr * iaddr)
144 {
145  return (!iaddr->allocation_group) && (!iaddr->start) && (!iaddr->len);
146 }
147 
148 static inline size_t
149 befs_brun_size(struct super_block *sb, befs_block_run run)
150 {
151  return BEFS_SB(sb)->block_size * run.len;
152 }
153 
154 #include "endian.h"
155 
156 #endif /* _LINUX_BEFS_H */