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