Unified · Split
| @@ -179,45 +179,33 @@ static const char *qnx4_checkroot(struct super_block *sb) · 178 unmodified lines | ||
| 179 | 179 | struct qnx4_inode_entry *rootdir; |
| 180 | 180 | int rd, rl; |
| 181 | 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 | 184 | return "no qnx4 filesystem (no root dir)."; |
| 186 | − } else { | |
| 187 | − QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id)); | |
| 188 | − rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1; | |
| 189 | − rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size); | |
| 190 | − for (j = 0; j < rl; j++) { | |
| 191 | − bh = sb_bread(sb, rd + j); /* root dir, first block */ | |
| 192 | − if (bh == NULL) { | |
| 193 | − return "unable to read root entry."; | |
| 194 | − } | |
| 195 | − for (i = 0; i < QNX4_INODES_PER_BLOCK; i++) { | |
| 196 | − rootdir = (struct qnx4_inode_entry *) (bh->b_data + i * QNX4_DIR_ENTRY_SIZE); | |
| 197 | − QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname)); | |
| 198 | − if (!strcmp(rootdir->di_fname, | |
| 199 | − QNX4_BMNAME)) { | |
| 200 | − found = 1; | |
| 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 | − } | |
| 185 | + 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; | |
| 187 | + rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size); | |
| 188 | + for (j = 0; j < rl; j++) { | |
| 189 | + bh = sb_bread(sb, rd + j); /* root dir, first block */ | |
| 190 | + if (bh == NULL) | |
| 191 | + return "unable to read root entry."; | |
| 192 | + rootdir = (struct qnx4_inode_entry *) bh->b_data; | |
| 193 | + for (i = 0; i < QNX4_INODES_PER_BLOCK; i++, rootdir++) { | |
| 194 | + QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname)); | |
| 195 | + if (strcmp(rootdir->di_fname, QNX4_BMNAME) != 0) | |
| 196 | + continue; | |
| 197 | + qnx4_sb(sb)->BitMap = kmemdup(rootdir, | |
| 198 | + sizeof(struct qnx4_inode_entry), | |
| 199 | + GFP_KERNEL); | |
| 211 | 200 | brelse(bh); |
| 212 | − if (found != 0) { | |
| 213 | − break; | |
| 214 | − } | |
| 215 | − } | |
| 216 | − if (found == 0) { | |
| 217 | − return "bitmap file not found."; | |
| 201 | + if (!qnx4_sb(sb)->BitMap) | |
| 202 | + return "not enough memory for bitmap inode"; | |
| 203 | + /* keep bitmap inode known */ | |
| 204 | + return NULL; | |
| 218 | 205 | } |
| 206 | + brelse(bh); | |
| 219 | 207 | } |
| 220 | − return NULL; | |
| 208 | + return "bitmap file not found."; | |
| 221 | 209 | } |
| 222 | 210 | |
| 223 | 211 | static int qnx4_fill_super(struct super_block *s, void *data, int silent) |