Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/util-linux/mkfs_ext2.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/util-linux/mkfs_ext2.c
r2725 r3232 8 8 * Licensed under GPLv2, see file LICENSE in this source tree. 9 9 */ 10 11 //usage:#define mkfs_ext2_trivial_usage 12 //usage: "[-Fn] " 13 /* //usage: "[-c|-l filename] " */ 14 //usage: "[-b BLK_SIZE] " 15 /* //usage: "[-f fragment-size] [-g blocks-per-group] " */ 16 //usage: "[-i INODE_RATIO] [-I INODE_SIZE] " 17 /* //usage: "[-j] [-J journal-options] [-N number-of-inodes] " */ 18 //usage: "[-m RESERVED_PERCENT] " 19 /* //usage: "[-o creator-os] [-O feature[,...]] [-q] " */ 20 /* //usage: "[r fs-revision-level] [-E extended-options] [-v] [-F] " */ 21 //usage: "[-L LABEL] " 22 /* //usage: "[-M last-mounted-directory] [-S] [-T filesystem-type] " */ 23 //usage: "BLOCKDEV [KBYTES]" 24 //usage:#define mkfs_ext2_full_usage "\n\n" 25 //usage: " -b BLK_SIZE Block size, bytes" 26 /* //usage: "\n -c Check device for bad blocks" */ 27 /* //usage: "\n -E opts Set extended options" */ 28 /* //usage: "\n -f size Fragment size in bytes" */ 29 //usage: "\n -F Force" 30 /* //usage: "\n -g N Number of blocks in a block group" */ 31 //usage: "\n -i RATIO Max number of files is filesystem_size / RATIO" 32 //usage: "\n -I BYTES Inode size (min 128)" 33 /* //usage: "\n -j Create a journal (ext3)" */ 34 /* //usage: "\n -J opts Set journal options (size/device)" */ 35 /* //usage: "\n -l file Read bad blocks list from file" */ 36 //usage: "\n -L LBL Volume label" 37 //usage: "\n -m PERCENT Percent of blocks to reserve for admin" 38 /* //usage: "\n -M dir Set last mounted directory" */ 39 //usage: "\n -n Dry run" 40 /* //usage: "\n -N N Number of inodes to create" */ 41 /* //usage: "\n -o os Set the 'creator os' field" */ 42 /* //usage: "\n -O features Dir_index/filetype/has_journal/journal_dev/sparse_super" */ 43 /* //usage: "\n -q Quiet" */ 44 /* //usage: "\n -r rev Set filesystem revision" */ 45 /* //usage: "\n -S Write superblock and group descriptors only" */ 46 /* //usage: "\n -T fs-type Set usage type (news/largefile/largefile4)" */ 47 /* //usage: "\n -v Verbose" */ 48 10 49 #include "libbb.h" 11 50 #include <linux/fs.h> 12 #include <linux/ext2_fs.h>51 #include "bb_e2fs_defs.h" 13 52 14 53 #define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0 15 54 #define ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX 1 16 17 // from e2fsprogs18 #define s_reserved_gdt_blocks s_padding119 #define s_mkfs_time s_reserved[0]20 #define s_flags s_reserved[22]21 55 22 56 #define EXT2_HASH_HALF_MD4 1 … … 444 478 STORE_LE(sb->s_inode_size, inodesize); 445 479 // set "Required extra isize" and "Desired extra isize" fields to 28 446 if (inodesize != sizeof(*inode)) 447 STORE_LE(sb->s_reserved[21], 0x001C001C); 480 if (inodesize != sizeof(*inode)) { 481 STORE_LE(sb->s_min_extra_isize, 0x001c); 482 STORE_LE(sb->s_want_extra_isize, 0x001c); 483 } 448 484 STORE_LE(sb->s_first_ino, EXT2_GOOD_OLD_FIRST_INO); 449 485 STORE_LE(sb->s_log_block_size, blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE); … … 577 613 // zero boot sectors 578 614 memset(buf, 0, blocksize); 579 PUT(0, buf, 1024); // N.B. 1024 <= blocksize, so buf[0..1023] contains zeros 615 // Disabled: standard mke2fs doesn't do this, and 616 // on SPARC this destroys Sun disklabel. 617 // Users who need/want zeroing can easily do it with dd. 618 //PUT(0, buf, 1024); // N.B. 1024 <= blocksize, so buf[0..1023] contains zeros 619 580 620 // zero inode tables 581 621 for (i = 0; i < ngroups; ++i)
Note:
See TracChangeset
for help on using the changeset viewer.