summaryrefslogtreecommitdiffstats
path: root/fs/adfs
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-12-09 11:11:33 +0000
committerAl Viro <viro@zeniv.linux.org.uk>2020-01-20 20:12:42 -0500
commit08ead1b8b98d90795bf934d93a718328d11f6ce6 (patch)
tree308a771820acfbf2d9fa6d6e7535045f9c5b3a32 /fs/adfs
parente3858e125bd57b827af52dfb38df6c8602559886 (diff)
downloadlinux-08ead1b8b98d90795bf934d93a718328d11f6ce6.tar.bz2
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 <rmk+kernel@armlinux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/adfs')
-rw-r--r--fs/adfs/super.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 4c06b2d5a861..a3cc8ecb50da 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -347,6 +347,20 @@ static int adfs_validate_bblk(struct super_block *sb, struct buffer_head *bh,
return 0;
}
+static int adfs_validate_dr0(struct super_block *sb, struct buffer_head *bh,
+ struct adfs_discrecord **drp)
+{
+ struct adfs_discrecord *dr;
+
+ /* Do some sanity checks on the ADFS disc record */
+ dr = (struct adfs_discrecord *)(bh->b_data + 4);
+ if (adfs_checkdiscrecord(dr) || dr->nzones_high || dr->nzones != 1)
+ return -EILSEQ;
+
+ *drp = dr;
+ return 0;
+}
+
static int adfs_fill_super(struct super_block *sb, void *data, int silent)
{
struct adfs_discrecord *dr;
@@ -376,7 +390,9 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
goto error;
/* Try to probe the filesystem boot block */
- ret = adfs_probe(sb, ADFS_DISCRECORD, silent, adfs_validate_bblk);
+ ret = adfs_probe(sb, ADFS_DISCRECORD, 1, adfs_validate_bblk);
+ if (ret == -EILSEQ)
+ ret = adfs_probe(sb, 0, silent, adfs_validate_dr0);
if (ret == -EILSEQ) {
if (!silent)
adfs_msg(sb, KERN_ERR,