From: Davidlohr Bueso <dave@gnu.org>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: [PATCH] mkfs.minix: use inode wrappers
Date: Thu, 02 Jun 2011 19:11:45 -0400 [thread overview]
Message-ID: <1307056305.4909.1.camel@offworld> (raw)
From: Davidlohr Bueso <dave@gnu.org>
Date: Thu, 2 Jun 2011 19:08:46 -0400
Use a common function for creating the root and bad inode, without worring about the fs version.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
disk-utils/mkfs.minix.c | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index 3de1d66..d2d800f 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -217,7 +217,7 @@ static inline int next(int zone) {
return 0;
}
-static void make_bad_inode(void) {
+static void make_bad_inode_v1(void) {
struct minix_inode * inode = &Inode[MINIX_BAD_INO];
int i,j,zone;
int ind=0,dind=0;
@@ -266,7 +266,7 @@ end_bad:
write_block(dind, (char *) dind_block);
}
-static void make_bad_inode2 (void) {
+static void make_bad_inode_v2 (void) {
struct minix2_inode *inode = &Inode2[MINIX_BAD_INO];
int i, j, zone;
int ind = 0, dind = 0;
@@ -314,7 +314,14 @@ static void make_bad_inode2 (void) {
write_block (dind, (char *) dind_block);
}
-static void make_root_inode(void) {
+static void make_bad_inode(void)
+{
+ if (fs_version < 2)
+ return make_bad_inode_v1();
+ return make_bad_inode_v2();
+}
+
+static void make_root_inode_v1(void) {
struct minix_inode * inode = &Inode[MINIX_ROOT_INO];
mark_inode(MINIX_ROOT_INO);
@@ -335,7 +342,7 @@ static void make_root_inode(void) {
write_block(inode->i_zone[0],root_block);
}
-static void make_root_inode2 (void) {
+static void make_root_inode_v2 (void) {
struct minix2_inode *inode = &Inode2[MINIX_ROOT_INO];
mark_inode (MINIX_ROOT_INO);
@@ -356,6 +363,13 @@ static void make_root_inode2 (void) {
write_block (inode->i_zone[0], root_block);
}
+static void make_root_inode(void)
+{
+ if (fs_version < 2)
+ return make_root_inode_v1();
+ return make_root_inode_v2();
+}
+
static void setup_tables(void) {
int i;
unsigned long inodes, zmaps, imaps, zones;
@@ -651,13 +665,9 @@ int main(int argc, char ** argv) {
check_blocks();
else if (listfile)
get_list_blocks(listfile);
- if (fs_version == 2) {
- make_root_inode2 ();
- make_bad_inode2 ();
- } else {
- make_root_inode();
- make_bad_inode();
- }
+
+ make_root_inode();
+ make_bad_inode();
mark_good_blocks();
write_tables();
--
1.7.4.1
next reply other threads:[~2011-06-02 23:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-02 23:11 Davidlohr Bueso [this message]
2011-06-08 11:43 ` [PATCH] mkfs.minix: use inode wrappers Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1307056305.4909.1.camel@offworld \
--to=dave@gnu.org \
--cc=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox