VM: make mapping types explicit
[minix.git] / servers / ext2 / type.h
blobf2498c7074680812eb6c28f22aab0b4185895345
1 #ifndef EXT2_TYPE_H
2 #define EXT2_TYPE_H
4 /* On the disk all attributes are stored in little endian format.
5 * Inode structure was taken from linux/include/linux/ext2_fs.h.
6 */
7 typedef struct {
8 u16_t i_mode; /* File mode */
9 u16_t i_uid; /* Low 16 bits of Owner Uid */
10 u32_t i_size; /* Size in bytes */
11 u32_t i_atime; /* Access time */
12 u32_t i_ctime; /* Creation time */
13 u32_t i_mtime; /* Modification time */
14 u32_t i_dtime; /* Deletion Time */
15 u16_t i_gid; /* Low 16 bits of Group Id */
16 u16_t i_links_count; /* Links count */
17 u32_t i_blocks; /* Blocks count */
18 u32_t i_flags; /* File flags */
19 union {
20 struct {
21 u32_t l_i_reserved1;
22 } linux1;
23 struct {
24 u32_t h_i_translator;
25 } hurd1;
26 struct {
27 u32_t m_i_reserved1;
28 } masix1;
29 } osd1; /* OS dependent 1 */
30 u32_t i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
31 u32_t i_generation; /* File version (for NFS) */
32 u32_t i_file_acl; /* File ACL */
33 u32_t i_dir_acl; /* Directory ACL */
34 u32_t i_faddr; /* Fragment address */
35 union {
36 struct {
37 u8_t l_i_frag; /* Fragment number */
38 u8_t l_i_fsize; /* Fragment size */
39 u16_t i_pad1;
40 u16_t l_i_uid_high; /* these 2 fields */
41 u16_t l_i_gid_high; /* were reserved2[0] */
42 u32_t l_i_reserved2;
43 } linux2;
44 struct {
45 u8_t h_i_frag; /* Fragment number */
46 u8_t h_i_fsize; /* Fragment size */
47 u16_t h_i_mode_high;
48 u16_t h_i_uid_high;
49 u16_t h_i_gid_high;
50 u32_t h_i_author;
51 } hurd2;
52 struct {
53 u8_t m_i_frag; /* Fragment number */
54 u8_t m_i_fsize; /* Fragment size */
55 u16_t m_pad1;
56 u32_t m_i_reserved2[2];
57 } masix2;
58 } osd2; /* OS dependent 2 */
59 } d_inode;
62 /* Part of on disk directory (entry description).
63 * It includes all fields except name (since size is unknown.
64 * In revision 0 name_len is u16_t (here is structure of rev >= 0.5,
65 * where name_len was truncated with the upper 8 bit to add file_type).
66 * MIN_DIR_ENTRY_SIZE depends on this structure.
68 struct ext2_disk_dir_desc {
69 u32_t d_ino;
70 u16_t d_rec_len;
71 u8_t d_name_len;
72 u8_t d_file_type;
73 char d_name[1];
76 /* Current position in block */
77 #define CUR_DISC_DIR_POS(cur_desc, base) ((char*)cur_desc - (char*)base)
78 /* Return pointer to the next dentry */
79 #define NEXT_DISC_DIR_DESC(cur_desc) ((struct ext2_disk_dir_desc*)\
80 ((char*)cur_desc + cur_desc->d_rec_len))
81 /* Return next dentry's position in block */
82 #define NEXT_DISC_DIR_POS(cur_desc, base) (cur_desc->d_rec_len +\
83 CUR_DISC_DIR_POS(cur_desc, base))
85 struct buf {
86 /* Data portion of the buffer. */
87 union fsdata_u *bp;
89 /* Header portion of the buffer. */
90 struct buf *b_next; /* used to link all free bufs in a chain */
91 struct buf *b_prev; /* used to link all free bufs the other way */
92 struct buf *b_hash; /* used to link bufs on hash chains */
93 block_t b_blocknr; /* block number of its (minor) device */
94 dev_t b_dev; /* major | minor device where block resides */
95 char b_dirt; /* CLEAN or DIRTY */
96 char b_count; /* number of users of this buffer */
97 unsigned int b_bytes; /* Number of bytes allocated in bp */
101 /* Structure with options affecting global behavior. */
102 struct opt {
103 int use_orlov; /* Bool: Use Orlov allocator */
104 /* In ext2 there are reserved blocks, which can be used by super user only or
105 * user specified by resuid/resgid. Right now we can't check what user
106 * requested operation (VFS limitation), so it's a small warkaround.
108 int mfsalloc; /* Bool: use mfslike allocator */
109 int use_reserved_blocks; /* Bool: small workaround */
110 unsigned int block_with_super;/* Int: where to read super block,
111 * uses 1k units. */
112 int use_prealloc; /* Bool: use preallocation */
116 #endif /* EXT2_TYPE_H */