提交 4134bf81 编写于 作者: A Al Viro

qnx4: reduce the insane nesting in qnx4_checkroot()

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 1aab323e
...@@ -179,45 +179,33 @@ static const char *qnx4_checkroot(struct super_block *sb) ...@@ -179,45 +179,33 @@ static const char *qnx4_checkroot(struct super_block *sb)
struct qnx4_inode_entry *rootdir; struct qnx4_inode_entry *rootdir;
int rd, rl; int rd, rl;
int i, j; int i, j;
int found = 0;
if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/') { if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/')
return "no qnx4 filesystem (no root dir)."; return "no qnx4 filesystem (no root dir).";
} else {
QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id)); QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id));
rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1; rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1;
rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size); rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size);
for (j = 0; j < rl; j++) { for (j = 0; j < rl; j++) {
bh = sb_bread(sb, rd + j); /* root dir, first block */ bh = sb_bread(sb, rd + j); /* root dir, first block */
if (bh == NULL) { if (bh == NULL)
return "unable to read root entry."; return "unable to read root entry.";
} rootdir = (struct qnx4_inode_entry *) bh->b_data;
for (i = 0; i < QNX4_INODES_PER_BLOCK; i++) { for (i = 0; i < QNX4_INODES_PER_BLOCK; i++, rootdir++) {
rootdir = (struct qnx4_inode_entry *) (bh->b_data + i * QNX4_DIR_ENTRY_SIZE);
QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname)); QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname));
if (!strcmp(rootdir->di_fname, if (strcmp(rootdir->di_fname, QNX4_BMNAME) != 0)
QNX4_BMNAME)) { continue;
found = 1;
qnx4_sb(sb)->BitMap = kmemdup(rootdir, qnx4_sb(sb)->BitMap = kmemdup(rootdir,
sizeof(struct qnx4_inode_entry), sizeof(struct qnx4_inode_entry),
GFP_KERNEL); GFP_KERNEL);
if (!qnx4_sb(sb)->BitMap) { brelse(bh);
brelse (bh); if (!qnx4_sb(sb)->BitMap)
return "not enough memory for bitmap inode"; return "not enough memory for bitmap inode";
}/* keep bitmap inode known */ /* keep bitmap inode known */
break; return NULL;
}
} }
brelse(bh); brelse(bh);
if (found != 0) {
break;
}
} }
if (found == 0) {
return "bitmap file not found."; return "bitmap file not found.";
}
}
return NULL;
} }
static int qnx4_fill_super(struct super_block *s, void *data, int silent) static int qnx4_fill_super(struct super_block *s, void *data, int silent)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册