]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * include/linux/befs_fs_types.h | |
3 | * | |
4 | * Copyright (C) 2001 Will Dyson ([email protected]) | |
5 | * | |
6 | * | |
7 | * | |
8 | * from linux/include/linux/befs_fs.h | |
9 | * | |
10 | * Copyright (C) 1999 Makoto Kato ([email protected]) | |
11 | * | |
12 | */ | |
13 | ||
14 | #ifndef _LINUX_BEFS_FS_TYPES | |
15 | #define _LINUX_BEFS_FS_TYPES | |
16 | ||
17 | #ifdef __KERNEL__ | |
18 | #include <linux/types.h> | |
19 | #endif /*__KERNEL__*/ | |
20 | ||
21 | #define PACKED __attribute__ ((__packed__)) | |
22 | ||
23 | /* | |
24 | * Max name lengths of BFS | |
25 | */ | |
26 | ||
27 | #define BEFS_NAME_LEN 255 | |
28 | ||
29 | #define BEFS_SYMLINK_LEN 144 | |
30 | #define BEFS_NUM_DIRECT_BLOCKS 12 | |
31 | #define B_OS_NAME_LENGTH 32 | |
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 | |
37 | * | |
38 | * Err. Should that be 4 fs blocks or 4k??? | |
39 | * It matters on large blocksize volumes | |
40 | */ | |
41 | #define BEFS_DBLINDIR_BRUN_LEN 4 | |
42 | ||
43 | /* | |
44 | * Flags of superblock | |
45 | */ | |
46 | ||
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, | |
55 | }; | |
56 | ||
57 | #define BEFS_BYTEORDER_NATIVE 0x42494745 | |
58 | ||
59 | #define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1 | |
60 | ||
61 | /* | |
62 | * Flags of inode | |
63 | */ | |
64 | ||
65 | #define BEFS_INODE_MAGIC1 0x3bbe0ad9 | |
66 | ||
67 | enum inode_flags { | |
68 | BEFS_INODE_IN_USE = 0x00000001, | |
69 | BEFS_ATTR_INODE = 0x00000004, | |
70 | BEFS_INODE_LOGGED = 0x00000008, | |
71 | BEFS_INODE_DELETED = 0x00000010, | |
72 | BEFS_LONG_SYMLINK = 0x00000040, | |
73 | BEFS_PERMANENT_FLAG = 0x0000ffff, | |
74 | BEFS_INODE_NO_CREATE = 0x00010000, | |
75 | BEFS_INODE_WAS_WRITTEN = 0x00020000, | |
76 | BEFS_NO_TRANSACTION = 0x00040000, | |
77 | }; | |
78 | /* | |
79 | * On-Disk datastructures of BeFS | |
80 | */ | |
81 | ||
82 | typedef u64 befs_off_t; | |
83 | typedef u64 befs_time_t; | |
84 | typedef void befs_binode_etc; | |
85 | ||
86 | /* Block runs */ | |
87 | typedef struct { | |
88 | u32 allocation_group; | |
89 | u16 start; | |
90 | u16 len; | |
91 | } PACKED befs_block_run; | |
92 | ||
93 | typedef befs_block_run befs_inode_addr; | |
94 | ||
95 | /* | |
96 | * The Superblock Structure | |
97 | */ | |
98 | typedef struct { | |
99 | char name[B_OS_NAME_LENGTH]; | |
100 | u32 magic1; | |
101 | u32 fs_byte_order; | |
102 | ||
103 | u32 block_size; | |
104 | u32 block_shift; | |
105 | ||
106 | befs_off_t num_blocks; | |
107 | befs_off_t used_blocks; | |
108 | ||
109 | u32 inode_size; | |
110 | ||
111 | u32 magic2; | |
112 | u32 blocks_per_ag; | |
113 | u32 ag_shift; | |
114 | u32 num_ags; | |
115 | ||
116 | u32 flags; | |
117 | ||
118 | befs_block_run log_blocks; | |
119 | befs_off_t log_start; | |
120 | befs_off_t log_end; | |
121 | ||
122 | u32 magic3; | |
123 | befs_inode_addr root_dir; | |
124 | befs_inode_addr indices; | |
125 | ||
126 | } PACKED befs_super_block; | |
127 | ||
128 | /* | |
129 | * Note: the indirect and dbl_indir block_runs may | |
130 | * be longer than one block! | |
131 | */ | |
132 | typedef struct { | |
133 | befs_block_run direct[BEFS_NUM_DIRECT_BLOCKS]; | |
134 | befs_off_t max_direct_range; | |
135 | befs_block_run indirect; | |
136 | befs_off_t max_indirect_range; | |
137 | befs_block_run double_indirect; | |
138 | befs_off_t max_double_indirect_range; | |
139 | befs_off_t size; | |
140 | } PACKED befs_data_stream; | |
141 | ||
142 | /* Attribute */ | |
143 | typedef struct { | |
144 | u32 type; | |
145 | u16 name_size; | |
146 | u16 data_size; | |
147 | char name[1]; | |
148 | } PACKED befs_small_data; | |
149 | ||
150 | /* Inode structure */ | |
151 | typedef struct { | |
152 | u32 magic1; | |
153 | befs_inode_addr inode_num; | |
154 | u32 uid; | |
155 | u32 gid; | |
156 | u32 mode; | |
157 | u32 flags; | |
158 | befs_time_t create_time; | |
159 | befs_time_t last_modified_time; | |
160 | befs_inode_addr parent; | |
161 | befs_inode_addr attributes; | |
162 | u32 type; | |
163 | ||
164 | u32 inode_size; | |
165 | u32 etc; /* not use */ | |
166 | ||
167 | union { | |
168 | befs_data_stream datastream; | |
169 | char symlink[BEFS_SYMLINK_LEN]; | |
170 | } data; | |
171 | ||
172 | u32 pad[4]; /* not use */ | |
173 | befs_small_data small_data[1]; | |
174 | } PACKED befs_inode; | |
175 | ||
176 | /* | |
177 | * B+tree superblock | |
178 | */ | |
179 | ||
180 | #define BEFS_BTREE_MAGIC 0x69f6c2e8 | |
181 | ||
182 | enum btree_types { | |
183 | BTREE_STRING_TYPE = 0, | |
184 | BTREE_INT32_TYPE = 1, | |
185 | BTREE_UINT32_TYPE = 2, | |
186 | BTREE_INT64_TYPE = 3, | |
187 | BTREE_UINT64_TYPE = 4, | |
188 | BTREE_FLOAT_TYPE = 5, | |
189 | BTREE_DOUBLE_TYPE = 6 | |
190 | }; | |
191 | ||
192 | typedef struct { | |
193 | u32 magic; | |
194 | u32 node_size; | |
195 | u32 max_depth; | |
196 | u32 data_type; | |
197 | befs_off_t root_node_ptr; | |
198 | befs_off_t free_node_ptr; | |
199 | befs_off_t max_size; | |
200 | } PACKED befs_btree_super; | |
201 | ||
202 | /* | |
203 | * Header stucture of each btree node | |
204 | */ | |
205 | typedef struct { | |
206 | befs_off_t left; | |
207 | befs_off_t right; | |
208 | befs_off_t overflow; | |
209 | u16 all_key_count; | |
210 | u16 all_key_length; | |
211 | } PACKED befs_btree_nodehead; | |
212 | ||
213 | #endif /* _LINUX_BEFS_FS_TYPES */ |