Blame view

fs/befs/befs_fs_types.h 4.92 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
f30c22695   Uwe Zeisberger   fix file specific...
2
   * fs/befs/befs_fs_types.h
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
   *
   * Copyright (C) 2001 Will Dyson (will@cs.earlham.edu)
   *
   *
   *
   * from linux/include/linux/befs_fs.h
   *
   * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
   *
   */
  
  #ifndef _LINUX_BEFS_FS_TYPES
  #define _LINUX_BEFS_FS_TYPES
  
  #ifdef __KERNEL__
  #include <linux/types.h>
  #endif /*__KERNEL__*/
  
  #define PACKED __attribute__ ((__packed__))
  
  /*
   * Max name lengths of BFS
   */
  
  #define BEFS_NAME_LEN 255
  
  #define BEFS_SYMLINK_LEN 144
  #define BEFS_NUM_DIRECT_BLOCKS 12
  #define B_OS_NAME_LENGTH 32
  
  /* The datastream blocks mapped by the double-indirect
   * block are always 4 fs blocks long.
   * This eliminates the need for linear searches among
   * the potentially huge number of indirect blocks
   *
   * Err. Should that be 4 fs blocks or 4k???
   * It matters on large blocksize volumes
   */
  #define BEFS_DBLINDIR_BRUN_LEN 4
  
  /*
   * Flags of superblock
   */
  
  enum super_flags {
  	BEFS_BYTESEX_BE,
  	BEFS_BYTESEX_LE,
  	BEFS_CLEAN = 0x434c454e,
  	BEFS_DIRTY = 0x44495254,
  	BEFS_SUPER_MAGIC1 = 0x42465331,	/* BFS1 */
  	BEFS_SUPER_MAGIC2 = 0xdd121031,
  	BEFS_SUPER_MAGIC3 = 0x15b6830e,
  };
  
  #define BEFS_BYTEORDER_NATIVE 0x42494745
152b95a1e   Harvey Harrison   befs: annotate fs...
58
59
  #define BEFS_BYTEORDER_NATIVE_LE (__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE)
  #define BEFS_BYTEORDER_NATIVE_BE (__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
61
  
  #define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1
152b95a1e   Harvey Harrison   befs: annotate fs...
62
63
  #define BEFS_SUPER_MAGIC1_LE (__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1)
  #define BEFS_SUPER_MAGIC1_BE (__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  
  /*
   * Flags of inode
   */
  
  #define BEFS_INODE_MAGIC1 0x3bbe0ad9
  
  enum inode_flags {
  	BEFS_INODE_IN_USE = 0x00000001,
  	BEFS_ATTR_INODE = 0x00000004,
  	BEFS_INODE_LOGGED = 0x00000008,
  	BEFS_INODE_DELETED = 0x00000010,
  	BEFS_LONG_SYMLINK = 0x00000040,
  	BEFS_PERMANENT_FLAG = 0x0000ffff,
  	BEFS_INODE_NO_CREATE = 0x00010000,
  	BEFS_INODE_WAS_WRITTEN = 0x00020000,
  	BEFS_NO_TRANSACTION = 0x00040000,
  };
  /* 
   * On-Disk datastructures of BeFS
   */
1151895f8   Al Viro   [PATCH] befs: int...
85
86
87
  typedef u64 __bitwise fs64;
  typedef u32 __bitwise fs32;
  typedef u16 __bitwise fs16;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
88
  typedef u64 befs_off_t;
a9721f315   Al Viro   [PATCH] befs: end...
89
  typedef fs64 befs_time_t;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
90
91
92
  
  /* Block runs */
  typedef struct {
a9721f315   Al Viro   [PATCH] befs: end...
93
94
95
96
97
98
  	fs32 allocation_group;
  	fs16 start;
  	fs16 len;
  } PACKED befs_disk_block_run;
  
  typedef struct {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
99
100
101
102
  	u32 allocation_group;
  	u16 start;
  	u16 len;
  } PACKED befs_block_run;
a9721f315   Al Viro   [PATCH] befs: end...
103
  typedef befs_disk_block_run befs_disk_inode_addr;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104
105
106
107
108
109
110
  typedef befs_block_run befs_inode_addr;
  
  /*
   * The Superblock Structure
   */
  typedef struct {
  	char name[B_OS_NAME_LENGTH];
a9721f315   Al Viro   [PATCH] befs: end...
111
112
  	fs32 magic1;
  	fs32 fs_byte_order;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
113

a9721f315   Al Viro   [PATCH] befs: end...
114
115
  	fs32 block_size;
  	fs32 block_shift;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
116

a9721f315   Al Viro   [PATCH] befs: end...
117
118
  	fs64 num_blocks;
  	fs64 used_blocks;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
119

a9721f315   Al Viro   [PATCH] befs: end...
120
  	fs32 inode_size;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
121

a9721f315   Al Viro   [PATCH] befs: end...
122
123
124
125
  	fs32 magic2;
  	fs32 blocks_per_ag;
  	fs32 ag_shift;
  	fs32 num_ags;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
126

a9721f315   Al Viro   [PATCH] befs: end...
127
  	fs32 flags;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
128

a9721f315   Al Viro   [PATCH] befs: end...
129
130
131
  	befs_disk_block_run log_blocks;
  	fs64 log_start;
  	fs64 log_end;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
132

a9721f315   Al Viro   [PATCH] befs: end...
133
134
135
  	fs32 magic3;
  	befs_disk_inode_addr root_dir;
  	befs_disk_inode_addr indices;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
136
137
138
139
140
141
142
143
  
  } PACKED befs_super_block;
  
  /* 
   * Note: the indirect and dbl_indir block_runs may
   * be longer than one block!
   */
  typedef struct {
a9721f315   Al Viro   [PATCH] befs: end...
144
145
146
147
148
149
150
151
152
153
  	befs_disk_block_run direct[BEFS_NUM_DIRECT_BLOCKS];
  	fs64 max_direct_range;
  	befs_disk_block_run indirect;
  	fs64 max_indirect_range;
  	befs_disk_block_run double_indirect;
  	fs64 max_double_indirect_range;
  	fs64 size;
  } PACKED befs_disk_data_stream;
  
  typedef struct {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
154
155
156
157
158
159
160
161
162
163
164
  	befs_block_run direct[BEFS_NUM_DIRECT_BLOCKS];
  	befs_off_t max_direct_range;
  	befs_block_run indirect;
  	befs_off_t max_indirect_range;
  	befs_block_run double_indirect;
  	befs_off_t max_double_indirect_range;
  	befs_off_t size;
  } PACKED befs_data_stream;
  
  /* Attribute */
  typedef struct {
a9721f315   Al Viro   [PATCH] befs: end...
165
166
167
  	fs32 type;
  	fs16 name_size;
  	fs16 data_size;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
168
169
170
171
172
  	char name[1];
  } PACKED befs_small_data;
  
  /* Inode structure */
  typedef struct {
a9721f315   Al Viro   [PATCH] befs: end...
173
174
175
176
177
178
  	fs32 magic1;
  	befs_disk_inode_addr inode_num;
  	fs32 uid;
  	fs32 gid;
  	fs32 mode;
  	fs32 flags;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
179
180
  	befs_time_t create_time;
  	befs_time_t last_modified_time;
a9721f315   Al Viro   [PATCH] befs: end...
181
182
183
  	befs_disk_inode_addr parent;
  	befs_disk_inode_addr attributes;
  	fs32 type;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
184

a9721f315   Al Viro   [PATCH] befs: end...
185
186
  	fs32 inode_size;
  	fs32 etc;		/* not use */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
187
188
  
  	union {
a9721f315   Al Viro   [PATCH] befs: end...
189
  		befs_disk_data_stream datastream;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
190
191
  		char symlink[BEFS_SYMLINK_LEN];
  	} data;
a9721f315   Al Viro   [PATCH] befs: end...
192
  	fs32 pad[4];		/* not use */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
  	befs_small_data small_data[1];
  } PACKED befs_inode;
  
  /*
   * B+tree superblock
   */
  
  #define BEFS_BTREE_MAGIC 0x69f6c2e8
  
  enum btree_types {
  	BTREE_STRING_TYPE = 0,
  	BTREE_INT32_TYPE = 1,
  	BTREE_UINT32_TYPE = 2,
  	BTREE_INT64_TYPE = 3,
  	BTREE_UINT64_TYPE = 4,
  	BTREE_FLOAT_TYPE = 5,
  	BTREE_DOUBLE_TYPE = 6
  };
  
  typedef struct {
a9721f315   Al Viro   [PATCH] befs: end...
213
214
215
216
217
218
219
220
221
222
  	fs32 magic;
  	fs32 node_size;
  	fs32 max_depth;
  	fs32 data_type;
  	fs64 root_node_ptr;
  	fs64 free_node_ptr;
  	fs64 max_size;
  } PACKED befs_disk_btree_super;
  
  typedef struct {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
223
224
225
226
227
228
229
230
231
232
  	u32 magic;
  	u32 node_size;
  	u32 max_depth;
  	u32 data_type;
  	befs_off_t root_node_ptr;
  	befs_off_t free_node_ptr;
  	befs_off_t max_size;
  } PACKED befs_btree_super;
  
  /*
25985edce   Lucas De Marchi   Fix common misspe...
233
   * Header structure of each btree node
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
234
235
   */
  typedef struct {
a9721f315   Al Viro   [PATCH] befs: end...
236
237
238
239
240
241
242
243
  	fs64 left;
  	fs64 right;
  	fs64 overflow;
  	fs16 all_key_count;
  	fs16 all_key_length;
  } PACKED befs_btree_nodehead;
  
  typedef struct {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
244
245
246
247
248
  	befs_off_t left;
  	befs_off_t right;
  	befs_off_t overflow;
  	u16 all_key_count;
  	u16 all_key_length;
a9721f315   Al Viro   [PATCH] befs: end...
249
  } PACKED befs_host_btree_nodehead;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
250
251
  
  #endif				/* _LINUX_BEFS_FS_TYPES */