From: Davidlohr Bueso Date: Thu, 9 Jun 2011 16:01:09 +0000 (-0400) Subject: mkfs.minix: standardize superblock attribute settings X-Git-Tag: v2.20-rc1~168 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7a173d7f5c59a59297178b078ffffb566f986c19;p=thirdparty%2Futil-linux.git mkfs.minix: standardize superblock attribute settings Because of the dependence of fs_version, some superblock attributes will vary, so simplify the logic of assigning values to maxsize and the amount of zones related to each filesystem, thus making setup_tables() more readable. Signed-off-by: Davidlohr Bueso --- diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c index d2d800f355..213b98fa12 100644 --- a/disk-utils/mkfs.minix.c +++ b/disk-utils/mkfs.minix.c @@ -370,6 +370,29 @@ static void make_root_inode(void) return make_root_inode_v2(); } +static void super_set_nzones(void) +{ + switch (fs_version) { + case 2: + Super.s_zones = BLOCKS; + break; + default: /* v1 */ + Super.s_nzones = BLOCKS; + break; + } +} + +static void super_init_maxsize(void) +{ + switch (fs_version) { + case 2: + Super.s_max_size = 0x7fffffff; + default: /* v1 */ + Super.s_max_size = (7+512+512*512)*1024; + break; + } +} + static void setup_tables(void) { int i; unsigned long inodes, zmaps, imaps, zones; @@ -382,11 +405,10 @@ static void setup_tables(void) { memset(boot_block_buffer,0,512); Super.s_magic = magic; Super.s_log_zone_size = 0; - Super.s_max_size = version2 ? 0x7fffffff : (7+512+512*512)*1024; - if (fs_version == 2) - zones = Super.s_zones = BLOCKS; - else - zones = Super.s_nzones = BLOCKS; + + super_init_maxsize(); + super_set_nzones(); + zones = get_nzones(); /* some magic nrs: 1 inode / 3 blocks */ if ( req_nr_inodes == 0 )