diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-22 00:38:52 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-22 00:38:52 +0200 |
commit | 481ca9604d1d367c02b9f0799a8c4328232900b5 (patch) | |
tree | 7b2f7f1ff5069f5566f733ff6d0c3b8ca2676c02 | |
parent | a46317b6f34be8575ebf3857c58f9e5a42781a75 (diff) | |
download | busybox-w32-481ca9604d1d367c02b9f0799a8c4328232900b5.tar.gz busybox-w32-481ca9604d1d367c02b9f0799a8c4328232900b5.tar.bz2 busybox-w32-481ca9604d1d367c02b9f0799a8c4328232900b5.zip |
mkfs_ext2: 1.41.9 compat
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | util-linux/mkfs_ext2.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c index 7191a5f55..ef22ec7e6 100644 --- a/util-linux/mkfs_ext2.c +++ b/util-linux/mkfs_ext2.c | |||
@@ -10,25 +10,19 @@ | |||
10 | #include "libbb.h" | 10 | #include "libbb.h" |
11 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
12 | #include <linux/ext2_fs.h> | 12 | #include <linux/ext2_fs.h> |
13 | #include <sys/user.h> /* PAGE_SIZE */ | ||
14 | #ifndef PAGE_SIZE | ||
15 | # define PAGE_SIZE 4096 | ||
16 | #endif | ||
17 | #include "volume_id/volume_id_internal.h" | 13 | #include "volume_id/volume_id_internal.h" |
18 | 14 | ||
19 | #define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0 | 15 | #define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0 |
20 | #define ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX 1 | 16 | #define ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX 1 |
21 | 17 | ||
22 | // from e2fsprogs | 18 | // from e2fsprogs |
23 | #define s_reserved_gdt_blocks s_padding1 | 19 | #define s_reserved_gdt_blocks s_padding1 |
24 | #define s_mkfs_time s_reserved[0] | 20 | #define s_mkfs_time s_reserved[0] |
25 | #define s_flags s_reserved[22] | 21 | #define s_flags s_reserved[22] |
26 | #define EXT2_HASH_HALF_MD4 1 | ||
27 | #define EXT2_FLAGS_SIGNED_HASH 0x0001 | ||
28 | 22 | ||
29 | // whiteout: for writable overlays | 23 | #define EXT2_HASH_HALF_MD4 1 |
30 | //#define LINUX_S_IFWHT 0160000 | 24 | #define EXT2_FLAGS_SIGNED_HASH 0x0001 |
31 | //#define EXT2_FEATURE_INCOMPAT_WHITEOUT 0x0020 | 25 | #define EXT2_FLAGS_UNSIGNED_HASH 0x0002 |
32 | 26 | ||
33 | // storage helpers | 27 | // storage helpers |
34 | char BUG_wrong_field_size(void); | 28 | char BUG_wrong_field_size(void); |
@@ -288,9 +282,6 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv) | |||
288 | if (nblocks != kilobytes) | 282 | if (nblocks != kilobytes) |
289 | bb_error_msg_and_die("block count doesn't fit in 32 bits"); | 283 | bb_error_msg_and_die("block count doesn't fit in 32 bits"); |
290 | #define kilobytes kilobytes_unused_after_this | 284 | #define kilobytes kilobytes_unused_after_this |
291 | //compat problem | ||
292 | // if (blocksize < PAGE_SIZE) | ||
293 | // nblocks &= ~((PAGE_SIZE >> blocksize_log2)-1); | ||
294 | // Experimentally, standard mke2fs won't work on images smaller than 60k | 285 | // Experimentally, standard mke2fs won't work on images smaller than 60k |
295 | if (nblocks < 60) | 286 | if (nblocks < 60) |
296 | bb_error_msg_and_die("need >= 60 blocks"); | 287 | bb_error_msg_and_die("need >= 60 blocks"); |
@@ -471,19 +462,22 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv) | |||
471 | STORE_LE(sb->s_mkfs_time, timestamp); | 462 | STORE_LE(sb->s_mkfs_time, timestamp); |
472 | STORE_LE(sb->s_wtime, timestamp); | 463 | STORE_LE(sb->s_wtime, timestamp); |
473 | STORE_LE(sb->s_lastcheck, timestamp); | 464 | STORE_LE(sb->s_lastcheck, timestamp); |
474 | // misc | 465 | // misc. Values are chosen to match mke2fs 1.41.9 |
475 | STORE_LE(sb->s_state, 1); // TODO: what's 1? | 466 | STORE_LE(sb->s_state, 1); // TODO: what's 1? |
476 | STORE_LE(sb->s_creator_os, EXT2_OS_LINUX); | 467 | STORE_LE(sb->s_creator_os, EXT2_OS_LINUX); |
477 | STORE_LE(sb->s_checkinterval, 24*60*60 * 180); // 180 days | 468 | STORE_LE(sb->s_checkinterval, 24*60*60 * 180); // 180 days |
478 | STORE_LE(sb->s_errors, EXT2_ERRORS_DEFAULT); | 469 | STORE_LE(sb->s_errors, EXT2_ERRORS_DEFAULT); |
470 | // mke2fs 1.41.9 also sets EXT3_FEATURE_COMPAT_RESIZE_INODE | ||
471 | // and if >= 0.5GB, EXT3_FEATURE_RO_COMPAT_LARGE_FILE. | ||
472 | // we use values which match "mke2fs -O ^resize_inode": | ||
473 | // in this case 1.41.9 never sets EXT3_FEATURE_RO_COMPAT_LARGE_FILE. | ||
479 | STORE_LE(sb->s_feature_compat, EXT2_FEATURE_COMPAT_SUPP | 474 | STORE_LE(sb->s_feature_compat, EXT2_FEATURE_COMPAT_SUPP |
480 | | (EXT2_FEATURE_COMPAT_RESIZE_INO * ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT) | 475 | | (EXT2_FEATURE_COMPAT_RESIZE_INO * ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT) |
481 | | (EXT2_FEATURE_COMPAT_DIR_INDEX * ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX) | 476 | | (EXT2_FEATURE_COMPAT_DIR_INDEX * ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX) |
482 | ); | 477 | ); |
483 | // e2fsck from 1.41.9 doesn't like EXT2_FEATURE_INCOMPAT_WHITEOUT | 478 | STORE_LE(sb->s_feature_incompat, EXT2_FEATURE_INCOMPAT_FILETYPE); |
484 | STORE_LE(sb->s_feature_incompat, EXT2_FEATURE_INCOMPAT_FILETYPE);// | EXT2_FEATURE_INCOMPAT_WHITEOUT; | ||
485 | STORE_LE(sb->s_feature_ro_compat, EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER); | 479 | STORE_LE(sb->s_feature_ro_compat, EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER); |
486 | STORE_LE(sb->s_flags, EXT2_FLAGS_SIGNED_HASH * ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX); | 480 | STORE_LE(sb->s_flags, EXT2_FLAGS_UNSIGNED_HASH * ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX); |
487 | generate_uuid(sb->s_uuid); | 481 | generate_uuid(sb->s_uuid); |
488 | if (ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX) { | 482 | if (ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX) { |
489 | STORE_LE(sb->s_def_hash_version, EXT2_HASH_HALF_MD4); | 483 | STORE_LE(sb->s_def_hash_version, EXT2_HASH_HALF_MD4); |