1 /* SPDX-License-Identifier: GPL-2.0 */
3 * fs/befs/befs_fs_types.h
5 * Copyright (C) 2001 Will Dyson (will@cs.earlham.edu)
9 * from linux/include/linux/befs_fs.h
11 * Copyright (C) 1999 Makoto Kato (m_kato@ga2.so-net.ne.jp)
15 #ifndef _LINUX_BEFS_FS_TYPES
16 #define _LINUX_BEFS_FS_TYPES
19 #include <linux/types.h>
22 #define PACKED __attribute__ ((__packed__))
25 * Max name lengths of BFS
28 #define BEFS_NAME_LEN 255
30 #define BEFS_SYMLINK_LEN 144
31 #define BEFS_NUM_DIRECT_BLOCKS 12
32 #define B_OS_NAME_LENGTH 32
34 /* The datastream blocks mapped by the double-indirect
35 * block are always 4 fs blocks long.
36 * This eliminates the need for linear searches among
37 * the potentially huge number of indirect blocks
39 * Err. Should that be 4 fs blocks or 4k???
40 * It matters on large blocksize volumes
42 #define BEFS_DBLINDIR_BRUN_LEN 4
51 BEFS_CLEAN
= 0x434c454e,
52 BEFS_DIRTY
= 0x44495254,
53 BEFS_SUPER_MAGIC1
= 0x42465331, /* BFS1 */
54 BEFS_SUPER_MAGIC2
= 0xdd121031,
55 BEFS_SUPER_MAGIC3
= 0x15b6830e,
58 #define BEFS_BYTEORDER_NATIVE 0x42494745
59 #define BEFS_BYTEORDER_NATIVE_LE ((__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE))
60 #define BEFS_BYTEORDER_NATIVE_BE ((__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE))
62 #define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1
63 #define BEFS_SUPER_MAGIC1_LE ((__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1))
64 #define BEFS_SUPER_MAGIC1_BE ((__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1))
70 #define BEFS_INODE_MAGIC1 0x3bbe0ad9
73 BEFS_INODE_IN_USE
= 0x00000001,
74 BEFS_ATTR_INODE
= 0x00000004,
75 BEFS_INODE_LOGGED
= 0x00000008,
76 BEFS_INODE_DELETED
= 0x00000010,
77 BEFS_LONG_SYMLINK
= 0x00000040,
78 BEFS_PERMANENT_FLAG
= 0x0000ffff,
79 BEFS_INODE_NO_CREATE
= 0x00010000,
80 BEFS_INODE_WAS_WRITTEN
= 0x00020000,
81 BEFS_NO_TRANSACTION
= 0x00040000,
84 * On-Disk datastructures of BeFS
87 typedef u64 __bitwise fs64
;
88 typedef u32 __bitwise fs32
;
89 typedef u16 __bitwise fs16
;
91 typedef u64 befs_off_t
;
92 typedef fs64 befs_time_t
;
96 fs32 allocation_group
;
99 } PACKED befs_disk_block_run
;
102 u32 allocation_group
;
105 } PACKED befs_block_run
;
107 typedef befs_disk_block_run befs_disk_inode_addr
;
108 typedef befs_block_run befs_inode_addr
;
111 * The Superblock Structure
114 char name
[B_OS_NAME_LENGTH
];
133 befs_disk_block_run log_blocks
;
138 befs_disk_inode_addr root_dir
;
139 befs_disk_inode_addr indices
;
141 } PACKED befs_super_block
;
144 * Note: the indirect and dbl_indir block_runs may
145 * be longer than one block!
148 befs_disk_block_run direct
[BEFS_NUM_DIRECT_BLOCKS
];
149 fs64 max_direct_range
;
150 befs_disk_block_run indirect
;
151 fs64 max_indirect_range
;
152 befs_disk_block_run double_indirect
;
153 fs64 max_double_indirect_range
;
155 } PACKED befs_disk_data_stream
;
158 befs_block_run direct
[BEFS_NUM_DIRECT_BLOCKS
];
159 befs_off_t max_direct_range
;
160 befs_block_run indirect
;
161 befs_off_t max_indirect_range
;
162 befs_block_run double_indirect
;
163 befs_off_t max_double_indirect_range
;
165 } PACKED befs_data_stream
;
173 } PACKED befs_small_data
;
175 /* Inode structure */
178 befs_disk_inode_addr inode_num
;
183 befs_time_t create_time
;
184 befs_time_t last_modified_time
;
185 befs_disk_inode_addr parent
;
186 befs_disk_inode_addr attributes
;
190 fs32 etc
; /* not use */
193 befs_disk_data_stream datastream
;
194 char symlink
[BEFS_SYMLINK_LEN
];
197 fs32 pad
[4]; /* not use */
198 befs_small_data small_data
[1];
205 #define BEFS_BTREE_MAGIC 0x69f6c2e8
208 BTREE_STRING_TYPE
= 0,
209 BTREE_INT32_TYPE
= 1,
210 BTREE_UINT32_TYPE
= 2,
211 BTREE_INT64_TYPE
= 3,
212 BTREE_UINT64_TYPE
= 4,
213 BTREE_FLOAT_TYPE
= 5,
214 BTREE_DOUBLE_TYPE
= 6
225 } PACKED befs_disk_btree_super
;
232 befs_off_t root_node_ptr
;
233 befs_off_t free_node_ptr
;
235 } PACKED befs_btree_super
;
238 * Header structure of each btree node
246 } PACKED befs_btree_nodehead
;
254 } PACKED befs_host_btree_nodehead
;
256 #endif /* _LINUX_BEFS_FS_TYPES */