Skip to content

Commit 08ead1b

Browse files
Russell KingAl Viro
authored andcommitted
fs/adfs: super: add support for E and E+ floppy image formats
Add support for ADFS E and E+ floppy image formats, which, unlike their hard disk variants, do not have a filesystem boot block - they have a single map zone, with the map fragment stored at sector 0. Signed-off-by: Russell King <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent e3858e1 commit 08ead1b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

fs/adfs/super.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,20 @@ static int adfs_validate_bblk(struct super_block *sb, struct buffer_head *bh,
347347
return 0;
348348
}
349349

350+
static int adfs_validate_dr0(struct super_block *sb, struct buffer_head *bh,
351+
struct adfs_discrecord **drp)
352+
{
353+
struct adfs_discrecord *dr;
354+
355+
/* Do some sanity checks on the ADFS disc record */
356+
dr = (struct adfs_discrecord *)(bh->b_data + 4);
357+
if (adfs_checkdiscrecord(dr) || dr->nzones_high || dr->nzones != 1)
358+
return -EILSEQ;
359+
360+
*drp = dr;
361+
return 0;
362+
}
363+
350364
static int adfs_fill_super(struct super_block *sb, void *data, int silent)
351365
{
352366
struct adfs_discrecord *dr;
@@ -376,7 +390,9 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
376390
goto error;
377391

378392
/* Try to probe the filesystem boot block */
379-
ret = adfs_probe(sb, ADFS_DISCRECORD, silent, adfs_validate_bblk);
393+
ret = adfs_probe(sb, ADFS_DISCRECORD, 1, adfs_validate_bblk);
394+
if (ret == -EILSEQ)
395+
ret = adfs_probe(sb, 0, silent, adfs_validate_dr0);
380396
if (ret == -EILSEQ) {
381397
if (!silent)
382398
adfs_msg(sb, KERN_ERR,

0 commit comments

Comments
 (0)