Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / fs / ext2 / inode.h
blob6ea66c1807b98855cf5c5ac8e7e937e5a9b123f4
1 /* Inode table. This table holds inodes that are currently in use. In some
2 * cases they have been opened by an open() or creat() system call, in other
3 * cases the file system itself needs the inode for one reason or another,
4 * such as to search a directory for a path name.
5 * The first part of the struct holds fields that are present on the
6 * disk; the second part holds fields not present on the disk.
7 * The disk inode part is also declared in "type.h" as 'd_inode'
9 */
11 #ifndef EXT2_INODE_H
12 #define EXT2_INODE_H
14 #include <sys/queue.h>
16 /* Disk part of inode structure was taken from
17 * linux/include/linux/ext2_fs.h.
19 EXTERN struct inode {
20 u16_t i_mode; /* File mode */
21 u16_t i_uid; /* Low 16 bits of Owner Uid */
22 u32_t i_size; /* Size in bytes */
23 u32_t i_atime; /* Access time */
24 u32_t i_ctime; /* Creation time */
25 u32_t i_mtime; /* Modification time */
26 u32_t i_dtime; /* Deletion Time */
27 u16_t i_gid; /* Low 16 bits of Group Id */
28 u16_t i_links_count; /* Links count */
29 u32_t i_blocks; /* 512-byte blocks count */
30 u32_t i_flags; /* File flags */
31 union {
32 struct {
33 u32_t l_i_reserved1;
34 } linux1;
35 struct {
36 u32_t h_i_translator;
37 } hurd1;
38 struct {
39 u32_t m_i_reserved1;
40 } masix1;
41 } osd1; /* OS dependent 1 */
42 u32_t i_block[EXT2_N_BLOCKS]; /* Pointers to blocks */
43 u32_t i_generation; /* File version (for NFS) */
44 u32_t i_file_acl; /* File ACL */
45 u32_t i_dir_acl; /* Directory ACL */
46 u32_t i_faddr; /* Fragment address */
47 union {
48 struct {
49 u8_t l_i_frag; /* Fragment number */
50 u8_t l_i_fsize; /* Fragment size */
51 u16_t i_pad1;
52 u16_t l_i_uid_high; /* these 2 fields */
53 u16_t l_i_gid_high; /* were reserved2[0] */
54 u32_t l_i_reserved2;
55 } linux2;
56 struct {
57 u8_t h_i_frag; /* Fragment number */
58 u8_t h_i_fsize; /* Fragment size */
59 u16_t h_i_mode_high;
60 u16_t h_i_uid_high;
61 u16_t h_i_gid_high;
62 u32_t h_i_author;
63 } hurd2;
64 struct {
65 u8_t m_i_frag; /* Fragment number */
66 u8_t m_i_fsize; /* Fragment size */
67 u16_t m_pad1;
68 u32_t m_i_reserved2[2];
69 } masix2;
70 } osd2; /* OS dependent 2 */
72 /* The following items are not present on the disk. */
73 dev_t i_dev; /* which device is the inode on */
74 ino_t i_num; /* inode number on its (minor) device */
75 int i_count; /* # times inode used; 0 means slot is free */
76 struct super_block *i_sp; /* pointer to super block for inode's device */
77 char i_dirt; /* CLEAN or DIRTY */
78 block_t i_bsearch; /* where to start search for new blocks,
79 * also this is last allocated block.
81 off_t i_last_pos_bl_alloc; /* last write position for which we allocated
82 * a new block (should be block i_bsearch).
83 * used to check for sequential operation.
85 off_t i_last_dpos; /* where to start dentry search */
86 int i_last_dentry_size; /* size of last found dentry */
88 char i_mountpoint; /* true if mounted on */
90 char i_seek; /* set on LSEEK, cleared on READ/WRITE */
91 char i_update; /* the ATIME, CTIME, and MTIME bits are here */
93 block_t i_prealloc_blocks[EXT2_PREALLOC_BLOCKS]; /* preallocated blocks */
94 int i_prealloc_count; /* number of preallocated blocks */
95 int i_prealloc_index; /* index into i_prealloc_blocks */
96 int i_preallocation; /* use preallocation for this inode, normally
97 * it's reset only when non-sequential write
98 * happens.
101 LIST_ENTRY(inode) i_hash; /* hash list */
102 TAILQ_ENTRY(inode) i_unused; /* free and unused list */
104 } inode[NR_INODES];
107 /* list of unused/free inodes */
108 EXTERN TAILQ_HEAD(unused_inodes_t, inode) unused_inodes;
110 /* inode hashtable */
111 EXTERN LIST_HEAD(inodelist, inode) hash_inodes[INODE_HASH_SIZE];
113 EXTERN unsigned int inode_cache_hit;
114 EXTERN unsigned int inode_cache_miss;
116 /* Field values. Note that CLEAN and DIRTY are defined in "const.h" */
117 #define NO_SEEK 0 /* i_seek = NO_SEEK if last op was not SEEK */
118 #define ISEEK 1 /* i_seek = ISEEK if last op was SEEK */
120 #endif /* EXT2_INODE_H */