annotate toys/e2fs.h @ 75:89ca591a9236

More random progress on mke2fs. Nothing to see yet.
author Rob Landley <rob@landley.net>
date Tue, 23 Jan 2007 13:20:38 -0500
parents
children e6332139adae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
75
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 /* vi: set ts=4:
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 *
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 * mke2fs.h - Headers for ext2
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 *
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 * Copyright 2006 Rob Landley <rob@landley.net>
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
6 */
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
7
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
8 // Stuff defined in linux/ext2_fs.h
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
9
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
10 #define EXT2_SUPER_MAGIC 0xEF53
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
11
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 struct ext2_inode {
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 uint16_t mode; // File mode
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 uint16_t uid; // Low 16 bits of Owner Uid
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 uint32_t size; // Size in bytes
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 uint32_t atime; // Access time
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 uint32_t ctime; // Creation time
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 uint32_t mtime; // Modification time
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 uint32_t dtime; // Deletion Time
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 uint16_t gid; // Low 16 bits of Group Id
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
21 uint16_t links_count; // Links count
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 uint32_t blocks; // Blocks count
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 uint32_t flags; // File flags
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 uint32_t reserved1;
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 uint32_t block[15]; // Pointers to blocks
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
26 uint32_t generation; // File version (for NFS)
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
27 uint32_t file_acl; // File ACL
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
28 uint32_t dir_acl; // Directory ACL
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
29 uint32_t faddr; // Fragment address
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
30 uint8_t frag; // Fragment number
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
31 uint8_t fsize; // Fragment size
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
32 uint16_t pad1;
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
33 uint16_t uid_high; // High bits of uid
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
34 uint16_t gid_high; // High bits of gid
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
35 uint32_t reserved2;
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
36 };
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
37
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
38 struct ext2_super_block {
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
39 uint32_t inodes_count; // Inodes count
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
40 uint32_t blocks_count; // Blocks count
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
41 uint32_t r_blocks_count; // Reserved blocks count
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
42 uint32_t free_blocks_count; // Free blocks count
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 uint32_t free_inodes_count; // Free inodes count
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
44 uint32_t first_data_block; // First Data Block
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
45 uint32_t log_block_size; // Block size
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
46 uint32_t log_frag_size; // Fragment size
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
47 uint32_t blocks_per_group; // # Blocks per group
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
48 uint32_t frags_per_group; // # Fragments per group
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
49 uint32_t inodes_per_group; // # Inodes per group
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
50 uint32_t mtime; // Mount time
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
51 uint32_t wtime; // Write time
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
52 uint16_t mnt_count; // Mount count
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
53 uint16_t max_mnt_count; // Maximal mount count
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
54 uint16_t magic; // Magic signature
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
55 uint16_t state; // File system state
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
56 uint16_t errors; // Behaviour when detecting errors
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
57 uint16_t minor_rev_level; // minor revision level
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
58 uint32_t lastcheck; // time of last check
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
59 uint32_t checkinterval; // max. time between checks
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
60 uint32_t creator_os; // OS
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
61 uint32_t rev_level; // Revision level
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
62 uint16_t def_resuid; // Default uid for reserved blocks
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
63 uint16_t def_resgid; // Default gid for reserved blocks
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
64 uint32_t first_ino; // First non-reserved inode
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
65 uint16_t inode_size; // size of inode structure
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
66 uint16_t block_group_nr; // block group # of this superblock
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
67 uint32_t feature_compat; // compatible feature set
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
68 uint32_t feature_incompat; // incompatible feature set
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
69 uint32_t feature_ro_compat; // readonly-compatible feature set
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
70 char uuid[16]; // 128-bit uuid for volume
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
71 char volume_name[16]; // volume name
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
72 char last_mounted[64]; // directory where last mounted
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
73 uint32_t alg_usage_bitmap; // For compression
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
74 // For EXT2_COMPAT_PREALLOC
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
75 uint8_t prealloc_blocks; // Nr of blocks to try to preallocate
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
76 uint8_t prealloc_dir_blocks; //Nr to preallocate for dirs
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
77 uint16_t padding1;
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
78 // For EXT3_FEATURE_COMPAT_HAS_JOURNAL
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
79 uint8_t journal_uuid[16]; // uuid of journal superblock
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
80 uint32_t journal_inum; // inode number of journal file
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
81 uint32_t journal_dev; // device number of journal file
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
82 uint32_t last_orphan; // start of list of inodes to delete
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
83 uint32_t hash_seed[4]; // HTREE hash seed
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
84 uint8_t def_hash_version; // Default hash version to use
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
85 uint8_t padding2[3];
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
86 uint32_t default_mount_opts;
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
87 uint32_t first_meta_bg; // First metablock block group
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
88 uint32_t mkfs_time; // Creation timestamp
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
89 uint32_t jnl_blocks[17]; // Backup of journal inode
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
90 uint32_t reserved[172]; // Padding to the end of the block
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
91 };
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
92
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
93 #define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
94 #define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
95 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
96 #define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
97 #define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
98 #define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
99
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
100 #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
101 #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
102 #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
103
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
104 #define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
105 #define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
106 #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
107 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
108 #define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
109
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
110 #define EXT2_NAME_LEN 255
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
111
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
112 struct ext2_dentry {
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
113 uint32_t inode; // Inode number
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
114 uint16_t rec_len; // Directory entry length
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
115 uint8_t name_len; // Name length
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
116 uint8_t file_type;
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
117 char name[255]; // File name
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
118 };
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
119
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
120 // Ext2 directory file types. Only the low 3 bits are used. The
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
121 // other bits are reserved for now.
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
122
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
123 enum {
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
124 EXT2_FT_UNKNOWN,
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
125 EXT2_FT_REG_FILE,
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
126 EXT2_FT_DIR,
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
127 EXT2_FT_CHRDEV,
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
128 EXT2_FT_BLKDEV,
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
129 EXT2_FT_FIFO,
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
130 EXT2_FT_SOCK,
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
131 EXT2_FT_SYMLINK,
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
132 EXT2_FT_MAX
89ca591a9236 More random progress on mke2fs. Nothing to see yet.
Rob Landley <rob@landley.net>
parents:
diff changeset
133 };