omap_hsmmc: Flush posted write to IRQ
[linux-ginger.git] / fs / befs / befs_fs_types.h
blob7893eaa1e58c695d1cff286c0df64c3647b11e8e
1 /*
2 * fs/befs/befs_fs_types.h
4 * Copyright (C) 2001 Will Dyson (will@cs.earlham.edu)
8 * from linux/include/linux/befs_fs.h
10 * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
14 #ifndef _LINUX_BEFS_FS_TYPES
15 #define _LINUX_BEFS_FS_TYPES
17 #ifdef __KERNEL__
18 #include <linux/types.h>
19 #endif /*__KERNEL__*/
21 #define PACKED __attribute__ ((__packed__))
24 * Max name lengths of BFS
27 #define BEFS_NAME_LEN 255
29 #define BEFS_SYMLINK_LEN 144
30 #define BEFS_NUM_DIRECT_BLOCKS 12
31 #define B_OS_NAME_LENGTH 32
33 /* The datastream blocks mapped by the double-indirect
34 * block are always 4 fs blocks long.
35 * This eliminates the need for linear searches among
36 * the potentially huge number of indirect blocks
38 * Err. Should that be 4 fs blocks or 4k???
39 * It matters on large blocksize volumes
41 #define BEFS_DBLINDIR_BRUN_LEN 4
44 * Flags of superblock
47 enum super_flags {
48 BEFS_BYTESEX_BE,
49 BEFS_BYTESEX_LE,
50 BEFS_CLEAN = 0x434c454e,
51 BEFS_DIRTY = 0x44495254,
52 BEFS_SUPER_MAGIC1 = 0x42465331, /* BFS1 */
53 BEFS_SUPER_MAGIC2 = 0xdd121031,
54 BEFS_SUPER_MAGIC3 = 0x15b6830e,
57 #define BEFS_BYTEORDER_NATIVE 0x42494745
58 #define BEFS_BYTEORDER_NATIVE_LE (__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE)
59 #define BEFS_BYTEORDER_NATIVE_BE (__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE)
61 #define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1
62 #define BEFS_SUPER_MAGIC1_LE (__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1)
63 #define BEFS_SUPER_MAGIC1_BE (__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1)
66 * Flags of inode
69 #define BEFS_INODE_MAGIC1 0x3bbe0ad9
71 enum inode_flags {
72 BEFS_INODE_IN_USE = 0x00000001,
73 BEFS_ATTR_INODE = 0x00000004,
74 BEFS_INODE_LOGGED = 0x00000008,
75 BEFS_INODE_DELETED = 0x00000010,
76 BEFS_LONG_SYMLINK = 0x00000040,
77 BEFS_PERMANENT_FLAG = 0x0000ffff,
78 BEFS_INODE_NO_CREATE = 0x00010000,
79 BEFS_INODE_WAS_WRITTEN = 0x00020000,
80 BEFS_NO_TRANSACTION = 0x00040000,
82 /*
83 * On-Disk datastructures of BeFS
86 typedef u64 __bitwise fs64;
87 typedef u32 __bitwise fs32;
88 typedef u16 __bitwise fs16;
90 typedef u64 befs_off_t;
91 typedef fs64 befs_time_t;
93 /* Block runs */
94 typedef struct {
95 fs32 allocation_group;
96 fs16 start;
97 fs16 len;
98 } PACKED befs_disk_block_run;
100 typedef struct {
101 u32 allocation_group;
102 u16 start;
103 u16 len;
104 } PACKED befs_block_run;
106 typedef befs_disk_block_run befs_disk_inode_addr;
107 typedef befs_block_run befs_inode_addr;
110 * The Superblock Structure
112 typedef struct {
113 char name[B_OS_NAME_LENGTH];
114 fs32 magic1;
115 fs32 fs_byte_order;
117 fs32 block_size;
118 fs32 block_shift;
120 fs64 num_blocks;
121 fs64 used_blocks;
123 fs32 inode_size;
125 fs32 magic2;
126 fs32 blocks_per_ag;
127 fs32 ag_shift;
128 fs32 num_ags;
130 fs32 flags;
132 befs_disk_block_run log_blocks;
133 fs64 log_start;
134 fs64 log_end;
136 fs32 magic3;
137 befs_disk_inode_addr root_dir;
138 befs_disk_inode_addr indices;
140 } PACKED befs_super_block;
143 * Note: the indirect and dbl_indir block_runs may
144 * be longer than one block!
146 typedef struct {
147 befs_disk_block_run direct[BEFS_NUM_DIRECT_BLOCKS];
148 fs64 max_direct_range;
149 befs_disk_block_run indirect;
150 fs64 max_indirect_range;
151 befs_disk_block_run double_indirect;
152 fs64 max_double_indirect_range;
153 fs64 size;
154 } PACKED befs_disk_data_stream;
156 typedef struct {
157 befs_block_run direct[BEFS_NUM_DIRECT_BLOCKS];
158 befs_off_t max_direct_range;
159 befs_block_run indirect;
160 befs_off_t max_indirect_range;
161 befs_block_run double_indirect;
162 befs_off_t max_double_indirect_range;
163 befs_off_t size;
164 } PACKED befs_data_stream;
166 /* Attribute */
167 typedef struct {
168 fs32 type;
169 fs16 name_size;
170 fs16 data_size;
171 char name[1];
172 } PACKED befs_small_data;
174 /* Inode structure */
175 typedef struct {
176 fs32 magic1;
177 befs_disk_inode_addr inode_num;
178 fs32 uid;
179 fs32 gid;
180 fs32 mode;
181 fs32 flags;
182 befs_time_t create_time;
183 befs_time_t last_modified_time;
184 befs_disk_inode_addr parent;
185 befs_disk_inode_addr attributes;
186 fs32 type;
188 fs32 inode_size;
189 fs32 etc; /* not use */
191 union {
192 befs_disk_data_stream datastream;
193 char symlink[BEFS_SYMLINK_LEN];
194 } data;
196 fs32 pad[4]; /* not use */
197 befs_small_data small_data[1];
198 } PACKED befs_inode;
201 * B+tree superblock
204 #define BEFS_BTREE_MAGIC 0x69f6c2e8
206 enum btree_types {
207 BTREE_STRING_TYPE = 0,
208 BTREE_INT32_TYPE = 1,
209 BTREE_UINT32_TYPE = 2,
210 BTREE_INT64_TYPE = 3,
211 BTREE_UINT64_TYPE = 4,
212 BTREE_FLOAT_TYPE = 5,
213 BTREE_DOUBLE_TYPE = 6
216 typedef struct {
217 fs32 magic;
218 fs32 node_size;
219 fs32 max_depth;
220 fs32 data_type;
221 fs64 root_node_ptr;
222 fs64 free_node_ptr;
223 fs64 max_size;
224 } PACKED befs_disk_btree_super;
226 typedef struct {
227 u32 magic;
228 u32 node_size;
229 u32 max_depth;
230 u32 data_type;
231 befs_off_t root_node_ptr;
232 befs_off_t free_node_ptr;
233 befs_off_t max_size;
234 } PACKED befs_btree_super;
237 * Header stucture of each btree node
239 typedef struct {
240 fs64 left;
241 fs64 right;
242 fs64 overflow;
243 fs16 all_key_count;
244 fs16 all_key_length;
245 } PACKED befs_btree_nodehead;
247 typedef struct {
248 befs_off_t left;
249 befs_off_t right;
250 befs_off_t overflow;
251 u16 all_key_count;
252 u16 all_key_length;
253 } PACKED befs_host_btree_nodehead;
255 #endif /* _LINUX_BEFS_FS_TYPES */