Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
befs_fs_types.h
Go to the documentation of this file.
1 /*
2  * fs/befs/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 
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 #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)
60 
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)
64 
65 /*
66  * Flags of inode
67  */
68 
69 #define BEFS_INODE_MAGIC1 0x3bbe0ad9
70 
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,
81 };
82 /*
83  * On-Disk datastructures of BeFS
84  */
85 
86 typedef u64 __bitwise fs64;
87 typedef u32 __bitwise fs32;
88 typedef u16 __bitwise fs16;
89 
90 typedef u64 befs_off_t;
91 typedef fs64 befs_time_t;
92 
93 /* Block runs */
94 typedef struct {
98 } PACKED befs_disk_block_run;
99 
100 typedef struct {
104 } PACKED befs_block_run;
105 
106 typedef befs_disk_block_run befs_disk_inode_addr;
107 typedef befs_block_run befs_inode_addr;
108 
109 /*
110  * The Superblock Structure
111  */
112 typedef struct {
116 
119 
122 
124 
129 
131 
132  befs_disk_block_run log_blocks;
135 
139 
140 } PACKED befs_super_block;
141 
142 /*
143  * Note: the indirect and dbl_indir block_runs may
144  * be longer than one block!
145  */
146 typedef struct {
147  befs_disk_block_run direct[BEFS_NUM_DIRECT_BLOCKS];
149  befs_disk_block_run indirect;
151  befs_disk_block_run double_indirect;
154 } PACKED befs_disk_data_stream;
155 
156 typedef struct {
159  befs_block_run indirect;
161  befs_block_run double_indirect;
164 } PACKED befs_data_stream;
165 
166 /* Attribute */
167 typedef struct {
171  char name[1];
172 } PACKED befs_small_data;
173 
174 /* Inode structure */
175 typedef struct {
176  fs32 magic1;
181  fs32 flags;
186  fs32 type;
187 
188  fs32 inode_size;
189  fs32 etc; /* not use */
190 
191  union {
192  befs_disk_data_stream datastream;
193  char symlink[BEFS_SYMLINK_LEN];
194  } data;
195 
196  fs32 pad[4]; /* not use */
197  befs_small_data small_data[1];
198 } PACKED befs_inode;
199 
200 /*
201  * B+tree superblock
202  */
203 
204 #define BEFS_BTREE_MAGIC 0x69f6c2e8
205 
214 };
215 
216 typedef struct {
224 } PACKED befs_disk_btree_super;
225 
226 typedef struct {
234 } PACKED befs_btree_super;
235 
236 /*
237  * Header structure of each btree node
238  */
239 typedef struct {
245 } PACKED befs_btree_nodehead;
246 
247 typedef struct {
253 } PACKED befs_host_btree_nodehead;
254 
255 #endif /* _LINUX_BEFS_FS_TYPES */