* [PATCH 1/2] mkfs.minix: standardize superblock attribute settings
@ 2011-06-09 16:48 Davidlohr Bueso
2011-06-14 14:58 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Davidlohr Bueso @ 2011-06-09 16:48 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
From: Davidlohr Bueso <dave@gnu.org>
Date: Thu, 9 Jun 2011 12:01:09 -0400
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 <dave@gnu.org>
---
disk-utils/mkfs.minix.c | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index d2d800f..1cebcda 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,12 +405,11 @@ 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 )
inodes = BLOCKS/3;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] mkfs.minix: standardize superblock attribute settings
2011-06-09 16:48 [PATCH 1/2] mkfs.minix: standardize superblock attribute settings Davidlohr Bueso
@ 2011-06-14 14:58 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2011-06-14 14:58 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: util-linux
On Thu, Jun 09, 2011 at 12:48:35PM -0400, Davidlohr Bueso wrote:
> disk-utils/mkfs.minix.c | 32 +++++++++++++++++++++++++++-----
> 1 files changed, 27 insertions(+), 5 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-14 14:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-09 16:48 [PATCH 1/2] mkfs.minix: standardize superblock attribute settings Davidlohr Bueso
2011-06-14 14:58 ` Karel Zak
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.