aboutsummaryrefslogtreecommitdiffstats
path: root/fs/qnx4
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-01-19 13:40:57 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-19 13:40:57 -0500
commit4134bf81ffd962f4de9bbeca55130d2238bd3698 (patch)
tree5eef377c888d1f8432fa1dbbc397539588fe368e /fs/qnx4
parent1aab323ea5cd67d2d2572a1f2794978583ff8545 (diff)
qnx4: reduce the insane nesting in qnx4_checkroot()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/qnx4')
-rw-r--r--fs/qnx4/inode.c56
1 files changed, 22 insertions, 34 deletions
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 63e0f7471fb5..3fd121c7c30a 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -179,45 +179,33 @@ static const char *qnx4_checkroot(struct super_block *sb)
179 struct qnx4_inode_entry *rootdir; 179 struct qnx4_inode_entry *rootdir;
180 int rd, rl; 180 int rd, rl;
181 int i, j; 181 int i, j;
182 int found = 0;
183 182
184 if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/') { 183 if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/')
185 return "no qnx4 filesystem (no root dir)."; 184 return "no qnx4 filesystem (no root dir).";
186 } else { 185 QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id));
187 QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id)); 186 rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1;
188 rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1; 187 rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size);
189 rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size); 188 for (j = 0; j < rl; j++) {
190 for (j = 0; j < rl; j++) { 189 bh = sb_bread(sb, rd + j); /* root dir, first block */
191 bh = sb_bread(sb, rd + j); /* root dir, first block */ 190 if (bh == NULL)
192 if (bh == NULL) { 191 return "unable to read root entry.";
193 return "unable to read root entry."; 192 rootdir = (struct qnx4_inode_entry *) bh->b_data;
194 } 193 for (i = 0; i < QNX4_INODES_PER_BLOCK; i++, rootdir++) {
195 for (i = 0; i < QNX4_INODES_PER_BLOCK; i++) { 194 QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname));
196 rootdir = (struct qnx4_inode_entry *) (bh->b_data + i * QNX4_DIR_ENTRY_SIZE); 195 if (strcmp(rootdir->di_fname, QNX4_BMNAME) != 0)
197 QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname)); 196 continue;
198 if (!strcmp(rootdir->di_fname, 197 qnx4_sb(sb)->BitMap = kmemdup(rootdir,
199 QNX4_BMNAME)) { 198 sizeof(struct qnx4_inode_entry),
200 found = 1; 199 GFP_KERNEL);
201 qnx4_sb(sb)->BitMap = kmemdup(rootdir,
202 sizeof(struct qnx4_inode_entry),
203 GFP_KERNEL);
204 if (!qnx4_sb(sb)->BitMap) {
205 brelse (bh);
206 return "not enough memory for bitmap inode";
207 }/* keep bitmap inode known */
208 break;
209 }
210 }
211 brelse(bh); 200 brelse(bh);
212 if (found != 0) { 201 if (!qnx4_sb(sb)->BitMap)
213 break; 202 return "not enough memory for bitmap inode";
214 } 203 /* keep bitmap inode known */
215 } 204 return NULL;
216 if (found == 0) {
217 return "bitmap file not found.";
218 } 205 }
206 brelse(bh);
219 } 207 }
220 return NULL; 208 return "bitmap file not found.";
221} 209}
222 210
223static int qnx4_fill_super(struct super_block *s, void *data, int silent) 211static int qnx4_fill_super(struct super_block *s, void *data, int silent)