aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mkfs_ext2.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-10-21 11:34:32 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-21 11:34:32 +0200
commit2ee2724a41f195f8a5e3e4e9ebc54dadc255d6f7 (patch)
treeb3b973095c4b77b0ff48a3c113138ca747d1f4fc /util-linux/mkfs_ext2.c
parent2288d86a54eee81800bdadea6f603ad4e234efb1 (diff)
downloadbusybox-w32-2ee2724a41f195f8a5e3e4e9ebc54dadc255d6f7.tar.gz
busybox-w32-2ee2724a41f195f8a5e3e4e9ebc54dadc255d6f7.tar.bz2
busybox-w32-2ee2724a41f195f8a5e3e4e9ebc54dadc255d6f7.zip
mkfs_ext2: explain 256-byte inodes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mkfs_ext2.c')
-rw-r--r--util-linux/mkfs_ext2.c58
1 files changed, 39 insertions, 19 deletions
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index de4c8b6c6..5cd923811 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -120,16 +120,45 @@ static uint32_t has_super(uint32_t x)
120 } 120 }
121} 121}
122 122
123/* Standard mke2fs 1.41.9: 123#define fd 3 /* predefined output descriptor */
124 * Usage: mke2fs [-c|-l filename] [-b block-size] [-f fragment-size] 124
125 * [-i bytes-per-inode] [-I inode-size] [-J journal-options] 125static void PUT(uint64_t off, void *buf, uint32_t size)
126 * [-G meta group size] [-N number-of-inodes] 126{
127 * [-m reserved-blocks-percentage] [-o creator-os] 127// bb_info_msg("PUT[%llu]:[%u]", off, size);
128 * [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory] 128 xlseek(fd, off, SEEK_SET);
129 * [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]] 129 xwrite(fd, buf, size);
130 * [-T fs-type] [-U UUID] [-jnqvFSV] device [blocks-count] 130}
131*/ 131
132// N.B. not commented below options are taken and silently ignored 132// 128 and 256-byte inodes:
133// 128-byte inode is described by struct ext2_inode.
134// 256-byte one just has these fields appended:
135// __u16 i_extra_isize;
136// __u16 i_pad1;
137// __u32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
138// __u32 i_mtime_extra; /* extra Modification time (nsec << 2 | epoch) */
139// __u32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
140// __u32 i_crtime; /* File creation time */
141// __u32 i_crtime_extra; /* extra File creation time (nsec << 2 | epoch)*/
142// __u32 i_version_hi; /* high 32 bits for 64-bit version */
143// the rest is padding.
144//
145// linux/ext2_fs.h has "#define i_size_high i_dir_acl" which suggests that even
146// 128-byte inode is capable of describing large files (i_dir_acl is meaningful
147// only for directories, which never need i_size_high).
148//
149// Standard mke2fs creates a filesystem with 256-byte inodes if it is
150// bigger than 0.5GB. So far, we do not do this.
151
152// Standard mke2fs 1.41.9:
153// Usage: mke2fs [-c|-l filename] [-b block-size] [-f fragment-size]
154// [-i bytes-per-inode] [-I inode-size] [-J journal-options]
155// [-G meta group size] [-N number-of-inodes]
156// [-m reserved-blocks-percentage] [-o creator-os]
157// [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]
158// [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]
159// [-T fs-type] [-U UUID] [-jnqvFSV] device [blocks-count]
160//
161// Options not commented below are taken but silently ignored:
133enum { 162enum {
134 OPT_c = 1 << 0, 163 OPT_c = 1 << 0,
135 OPT_l = 1 << 1, 164 OPT_l = 1 << 1,
@@ -159,15 +188,6 @@ enum {
159 //OPT_V = 1 << 25, // -V version. bbox applets don't support that 188 //OPT_V = 1 << 25, // -V version. bbox applets don't support that
160}; 189};
161 190
162#define fd 3 /* predefined output descriptor */
163
164static void PUT(uint64_t off, void *buf, uint32_t size)
165{
166// bb_info_msg("PUT[%llu]:[%u]", off, size);
167 xlseek(fd, off, SEEK_SET);
168 xwrite(fd, buf, size);
169}
170
171int mkfs_ext2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 191int mkfs_ext2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
172int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv) 192int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
173{ 193{