|
Kmods SIG |
50e2b3 |
From 181a9e8009a8a8bdb19c2e24eeeae7d8e77c8c47 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
50e2b3 |
From: Tetsuhiro Kohada <kohada.t2@gmail.com>
|
|
Kmods SIG |
50e2b3 |
Date: Fri, 29 May 2020 19:14:56 +0900
|
|
Kmods SIG |
50e2b3 |
Subject: [Backport 181a9e8009a8] exfat: redefine PBR as boot_sector
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Aggregate PBR related definitions and redefine as "boot_sector" to comply
|
|
Kmods SIG |
50e2b3 |
with the exFAT specification.
|
|
Kmods SIG |
50e2b3 |
And, rename variable names including 'pbr'.
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Tetsuhiro Kohada <kohada.t2@gmail.com>
|
|
Kmods SIG |
50e2b3 |
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
50e2b3 |
---
|
|
Kmods SIG |
50e2b3 |
src/exfat_fs.h | 2 +-
|
|
Kmods SIG |
50e2b3 |
src/exfat_raw.h | 79 +++++++++++++++--------------------------
|
|
Kmods SIG |
50e2b3 |
src/super.c | 84 ++++++++++++++++++++++----------------------
|
|
Kmods SIG |
50e2b3 |
3 files changed, 72 insertions(+), 93 deletions(-)
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/exfat_fs.h b/src/exfat_fs.h
|
|
Kmods SIG |
50e2b3 |
index c84ae9e605085e0a5b19a2dbe8a9c36ab7efdce6..911f58b93f3d257bce04b645a2ada62d0f51a3c0 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/exfat_fs.h
|
|
Kmods SIG |
50e2b3 |
+++ b/src/exfat_fs.h
|
|
Kmods SIG |
50e2b3 |
@@ -227,7 +227,7 @@ struct exfat_sb_info {
|
|
Kmods SIG |
50e2b3 |
unsigned int root_dir; /* root dir cluster */
|
|
Kmods SIG |
50e2b3 |
unsigned int dentries_per_clu; /* num of dentries per cluster */
|
|
Kmods SIG |
50e2b3 |
unsigned int vol_flag; /* volume dirty flag */
|
|
Kmods SIG |
50e2b3 |
- struct buffer_head *pbr_bh; /* buffer_head of PBR sector */
|
|
Kmods SIG |
50e2b3 |
+ struct buffer_head *boot_bh; /* buffer_head of BOOT sector */
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
unsigned int map_clu; /* allocation bitmap start cluster */
|
|
Kmods SIG |
50e2b3 |
unsigned int map_sectors; /* num of allocation bitmap sectors */
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/exfat_raw.h b/src/exfat_raw.h
|
|
Kmods SIG |
50e2b3 |
index 8d6c64a7546d8bc8899e677bfd7f9d91f4e0cb4d..07f74190df44b215128d4dcf2a8ee33d32a7cf21 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/exfat_raw.h
|
|
Kmods SIG |
50e2b3 |
+++ b/src/exfat_raw.h
|
|
Kmods SIG |
50e2b3 |
@@ -8,7 +8,8 @@
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
#include <linux/types.h>
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
-#define PBR_SIGNATURE 0xAA55
|
|
Kmods SIG |
50e2b3 |
+#define BOOT_SIGNATURE 0xAA55
|
|
Kmods SIG |
50e2b3 |
+#define EXBOOT_SIGNATURE 0xAA550000
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
#define EXFAT_MAX_FILE_LEN 255
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
@@ -55,7 +56,7 @@
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* checksum types */
|
|
Kmods SIG |
50e2b3 |
#define CS_DIR_ENTRY 0
|
|
Kmods SIG |
50e2b3 |
-#define CS_PBR_SECTOR 1
|
|
Kmods SIG |
50e2b3 |
+#define CS_BOOT_SECTOR 1
|
|
Kmods SIG |
50e2b3 |
#define CS_DEFAULT 2
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* file attributes */
|
|
Kmods SIG |
50e2b3 |
@@ -69,57 +70,35 @@
|
|
Kmods SIG |
50e2b3 |
#define ATTR_RWMASK (ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME | \
|
|
Kmods SIG |
50e2b3 |
ATTR_SUBDIR | ATTR_ARCHIVE)
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
-#define PBR64_JUMP_BOOT_LEN 3
|
|
Kmods SIG |
50e2b3 |
-#define PBR64_OEM_NAME_LEN 8
|
|
Kmods SIG |
50e2b3 |
-#define PBR64_RESERVED_LEN 53
|
|
Kmods SIG |
50e2b3 |
+#define BOOTSEC_JUMP_BOOT_LEN 3
|
|
Kmods SIG |
50e2b3 |
+#define BOOTSEC_FS_NAME_LEN 8
|
|
Kmods SIG |
50e2b3 |
+#define BOOTSEC_OLDBPB_LEN 53
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
#define EXFAT_FILE_NAME_LEN 15
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
-/* EXFAT BIOS parameter block (64 bytes) */
|
|
Kmods SIG |
50e2b3 |
-struct bpb64 {
|
|
Kmods SIG |
50e2b3 |
- __u8 jmp_boot[PBR64_JUMP_BOOT_LEN];
|
|
Kmods SIG |
50e2b3 |
- __u8 oem_name[PBR64_OEM_NAME_LEN];
|
|
Kmods SIG |
50e2b3 |
- __u8 res_zero[PBR64_RESERVED_LEN];
|
|
Kmods SIG |
50e2b3 |
-} __packed;
|
|
Kmods SIG |
50e2b3 |
-
|
|
Kmods SIG |
50e2b3 |
-/* EXFAT EXTEND BIOS parameter block (56 bytes) */
|
|
Kmods SIG |
50e2b3 |
-struct bsx64 {
|
|
Kmods SIG |
50e2b3 |
- __le64 vol_offset;
|
|
Kmods SIG |
50e2b3 |
- __le64 vol_length;
|
|
Kmods SIG |
50e2b3 |
- __le32 fat_offset;
|
|
Kmods SIG |
50e2b3 |
- __le32 fat_length;
|
|
Kmods SIG |
50e2b3 |
- __le32 clu_offset;
|
|
Kmods SIG |
50e2b3 |
- __le32 clu_count;
|
|
Kmods SIG |
50e2b3 |
- __le32 root_cluster;
|
|
Kmods SIG |
50e2b3 |
- __le32 vol_serial;
|
|
Kmods SIG |
50e2b3 |
- __u8 fs_version[2];
|
|
Kmods SIG |
50e2b3 |
- __le16 vol_flags;
|
|
Kmods SIG |
50e2b3 |
- __u8 sect_size_bits;
|
|
Kmods SIG |
50e2b3 |
- __u8 sect_per_clus_bits;
|
|
Kmods SIG |
50e2b3 |
- __u8 num_fats;
|
|
Kmods SIG |
50e2b3 |
- __u8 phy_drv_no;
|
|
Kmods SIG |
50e2b3 |
- __u8 perc_in_use;
|
|
Kmods SIG |
50e2b3 |
- __u8 reserved2[7];
|
|
Kmods SIG |
50e2b3 |
-} __packed;
|
|
Kmods SIG |
50e2b3 |
-
|
|
Kmods SIG |
50e2b3 |
-/* EXFAT PBR[BPB+BSX] (120 bytes) */
|
|
Kmods SIG |
50e2b3 |
-struct pbr64 {
|
|
Kmods SIG |
50e2b3 |
- struct bpb64 bpb;
|
|
Kmods SIG |
50e2b3 |
- struct bsx64 bsx;
|
|
Kmods SIG |
50e2b3 |
-} __packed;
|
|
Kmods SIG |
50e2b3 |
-
|
|
Kmods SIG |
50e2b3 |
-/* Common PBR[Partition Boot Record] (512 bytes) */
|
|
Kmods SIG |
50e2b3 |
-struct pbr {
|
|
Kmods SIG |
50e2b3 |
- union {
|
|
Kmods SIG |
50e2b3 |
- __u8 raw[64];
|
|
Kmods SIG |
50e2b3 |
- struct bpb64 f64;
|
|
Kmods SIG |
50e2b3 |
- } bpb;
|
|
Kmods SIG |
50e2b3 |
- union {
|
|
Kmods SIG |
50e2b3 |
- __u8 raw[56];
|
|
Kmods SIG |
50e2b3 |
- struct bsx64 f64;
|
|
Kmods SIG |
50e2b3 |
- } bsx;
|
|
Kmods SIG |
50e2b3 |
- __u8 boot_code[390];
|
|
Kmods SIG |
50e2b3 |
- __le16 signature;
|
|
Kmods SIG |
50e2b3 |
+/* EXFAT: Main and Backup Boot Sector (512 bytes) */
|
|
Kmods SIG |
50e2b3 |
+struct boot_sector {
|
|
Kmods SIG |
50e2b3 |
+ __u8 jmp_boot[BOOTSEC_JUMP_BOOT_LEN];
|
|
Kmods SIG |
50e2b3 |
+ __u8 fs_name[BOOTSEC_FS_NAME_LEN];
|
|
Kmods SIG |
50e2b3 |
+ __u8 must_be_zero[BOOTSEC_OLDBPB_LEN];
|
|
Kmods SIG |
50e2b3 |
+ __le64 partition_offset;
|
|
Kmods SIG |
50e2b3 |
+ __le64 vol_length;
|
|
Kmods SIG |
50e2b3 |
+ __le32 fat_offset;
|
|
Kmods SIG |
50e2b3 |
+ __le32 fat_length;
|
|
Kmods SIG |
50e2b3 |
+ __le32 clu_offset;
|
|
Kmods SIG |
50e2b3 |
+ __le32 clu_count;
|
|
Kmods SIG |
50e2b3 |
+ __le32 root_cluster;
|
|
Kmods SIG |
50e2b3 |
+ __le32 vol_serial;
|
|
Kmods SIG |
50e2b3 |
+ __u8 fs_revision[2];
|
|
Kmods SIG |
50e2b3 |
+ __le16 vol_flags;
|
|
Kmods SIG |
50e2b3 |
+ __u8 sect_size_bits;
|
|
Kmods SIG |
50e2b3 |
+ __u8 sect_per_clus_bits;
|
|
Kmods SIG |
50e2b3 |
+ __u8 num_fats;
|
|
Kmods SIG |
50e2b3 |
+ __u8 drv_sel;
|
|
Kmods SIG |
50e2b3 |
+ __u8 percent_in_use;
|
|
Kmods SIG |
50e2b3 |
+ __u8 reserved[7];
|
|
Kmods SIG |
50e2b3 |
+ __u8 boot_code[390];
|
|
Kmods SIG |
50e2b3 |
+ __le16 signature;
|
|
Kmods SIG |
50e2b3 |
} __packed;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
struct exfat_dentry {
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/super.c b/src/super.c
|
|
Kmods SIG |
50e2b3 |
index c1f47f4071a80449d7fbbdf81d4f1d7079419d56..e60d28e73ff007b85eafc751693d332911fbcfd3 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/super.c
|
|
Kmods SIG |
50e2b3 |
+++ b/src/super.c
|
|
Kmods SIG |
50e2b3 |
@@ -49,7 +49,7 @@ static void exfat_put_super(struct super_block *sb)
|
|
Kmods SIG |
50e2b3 |
sync_blockdev(sb->s_bdev);
|
|
Kmods SIG |
50e2b3 |
exfat_set_vol_flags(sb, VOL_CLEAN);
|
|
Kmods SIG |
50e2b3 |
exfat_free_bitmap(sbi);
|
|
Kmods SIG |
50e2b3 |
- brelse(sbi->pbr_bh);
|
|
Kmods SIG |
50e2b3 |
+ brelse(sbi->boot_bh);
|
|
Kmods SIG |
50e2b3 |
mutex_unlock(&sbi->s_lock);
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
call_rcu(&sbi->rcu, exfat_delayed_free);
|
|
Kmods SIG |
50e2b3 |
@@ -101,7 +101,7 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
|
|
Kmods SIG |
50e2b3 |
int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
|
|
Kmods SIG |
50e2b3 |
{
|
|
Kmods SIG |
50e2b3 |
struct exfat_sb_info *sbi = EXFAT_SB(sb);
|
|
Kmods SIG |
50e2b3 |
- struct pbr64 *bpb = (struct pbr64 *)sbi->pbr_bh->b_data;
|
|
Kmods SIG |
50e2b3 |
+ struct boot_sector *p_boot = (struct boot_sector *)sbi->boot_bh->b_data;
|
|
Kmods SIG |
50e2b3 |
bool sync;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* flags are not changed */
|
|
Kmods SIG |
50e2b3 |
@@ -116,18 +116,18 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
|
|
Kmods SIG |
50e2b3 |
if (sb_rdonly(sb))
|
|
Kmods SIG |
50e2b3 |
return 0;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- bpb->bsx.vol_flags = cpu_to_le16(new_flag);
|
|
Kmods SIG |
50e2b3 |
+ p_boot->vol_flags = cpu_to_le16(new_flag);
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- if (new_flag == VOL_DIRTY && !buffer_dirty(sbi->pbr_bh))
|
|
Kmods SIG |
50e2b3 |
+ if (new_flag == VOL_DIRTY && !buffer_dirty(sbi->boot_bh))
|
|
Kmods SIG |
50e2b3 |
sync = true;
|
|
Kmods SIG |
50e2b3 |
else
|
|
Kmods SIG |
50e2b3 |
sync = false;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- set_buffer_uptodate(sbi->pbr_bh);
|
|
Kmods SIG |
50e2b3 |
- mark_buffer_dirty(sbi->pbr_bh);
|
|
Kmods SIG |
50e2b3 |
+ set_buffer_uptodate(sbi->boot_bh);
|
|
Kmods SIG |
50e2b3 |
+ mark_buffer_dirty(sbi->boot_bh);
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
if (sync)
|
|
Kmods SIG |
50e2b3 |
- sync_dirty_buffer(sbi->pbr_bh);
|
|
Kmods SIG |
50e2b3 |
+ sync_dirty_buffer(sbi->boot_bh);
|
|
Kmods SIG |
50e2b3 |
return 0;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
@@ -366,13 +366,14 @@ static int exfat_read_root(struct inode *inode)
|
|
Kmods SIG |
50e2b3 |
return 0;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
-static struct pbr *exfat_read_pbr_with_logical_sector(struct super_block *sb)
|
|
Kmods SIG |
50e2b3 |
+static struct boot_sector *exfat_read_boot_with_logical_sector(
|
|
Kmods SIG |
50e2b3 |
+ struct super_block *sb)
|
|
Kmods SIG |
50e2b3 |
{
|
|
Kmods SIG |
50e2b3 |
struct exfat_sb_info *sbi = EXFAT_SB(sb);
|
|
Kmods SIG |
50e2b3 |
- struct pbr *p_pbr = (struct pbr *) (sbi->pbr_bh)->b_data;
|
|
Kmods SIG |
50e2b3 |
+ struct boot_sector *p_boot = (struct boot_sector *)sbi->boot_bh->b_data;
|
|
Kmods SIG |
50e2b3 |
unsigned short logical_sect = 0;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- logical_sect = 1 << p_pbr->bsx.f64.sect_size_bits;
|
|
Kmods SIG |
50e2b3 |
+ logical_sect = 1 << p_boot->sect_size_bits;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
if (!is_power_of_2(logical_sect) ||
|
|
Kmods SIG |
50e2b3 |
logical_sect < 512 || logical_sect > 4096) {
|
|
Kmods SIG |
50e2b3 |
@@ -387,49 +388,48 @@ static struct pbr *exfat_read_pbr_with_logical_sector(struct super_block *sb)
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
if (logical_sect > sb->s_blocksize) {
|
|
Kmods SIG |
50e2b3 |
- brelse(sbi->pbr_bh);
|
|
Kmods SIG |
50e2b3 |
- sbi->pbr_bh = NULL;
|
|
Kmods SIG |
50e2b3 |
+ brelse(sbi->boot_bh);
|
|
Kmods SIG |
50e2b3 |
+ sbi->boot_bh = NULL;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
if (!sb_set_blocksize(sb, logical_sect)) {
|
|
Kmods SIG |
50e2b3 |
exfat_err(sb, "unable to set blocksize %u",
|
|
Kmods SIG |
50e2b3 |
logical_sect);
|
|
Kmods SIG |
50e2b3 |
return NULL;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
- sbi->pbr_bh = sb_bread(sb, 0);
|
|
Kmods SIG |
50e2b3 |
- if (!sbi->pbr_bh) {
|
|
Kmods SIG |
50e2b3 |
+ sbi->boot_bh = sb_bread(sb, 0);
|
|
Kmods SIG |
50e2b3 |
+ if (!sbi->boot_bh) {
|
|
Kmods SIG |
50e2b3 |
exfat_err(sb, "unable to read boot sector (logical sector size = %lu)",
|
|
Kmods SIG |
50e2b3 |
sb->s_blocksize);
|
|
Kmods SIG |
50e2b3 |
return NULL;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- p_pbr = (struct pbr *)sbi->pbr_bh->b_data;
|
|
Kmods SIG |
50e2b3 |
+ p_boot = (struct boot_sector *)sbi->boot_bh->b_data;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
- return p_pbr;
|
|
Kmods SIG |
50e2b3 |
+ return p_boot;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* mount the file system volume */
|
|
Kmods SIG |
50e2b3 |
static int __exfat_fill_super(struct super_block *sb)
|
|
Kmods SIG |
50e2b3 |
{
|
|
Kmods SIG |
50e2b3 |
int ret;
|
|
Kmods SIG |
50e2b3 |
- struct pbr *p_pbr;
|
|
Kmods SIG |
50e2b3 |
- struct pbr64 *p_bpb;
|
|
Kmods SIG |
50e2b3 |
+ struct boot_sector *p_boot;
|
|
Kmods SIG |
50e2b3 |
struct exfat_sb_info *sbi = EXFAT_SB(sb);
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* set block size to read super block */
|
|
Kmods SIG |
50e2b3 |
sb_min_blocksize(sb, 512);
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* read boot sector */
|
|
Kmods SIG |
50e2b3 |
- sbi->pbr_bh = sb_bread(sb, 0);
|
|
Kmods SIG |
50e2b3 |
- if (!sbi->pbr_bh) {
|
|
Kmods SIG |
50e2b3 |
+ sbi->boot_bh = sb_bread(sb, 0);
|
|
Kmods SIG |
50e2b3 |
+ if (!sbi->boot_bh) {
|
|
Kmods SIG |
50e2b3 |
exfat_err(sb, "unable to read boot sector");
|
|
Kmods SIG |
50e2b3 |
return -EIO;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* PRB is read */
|
|
Kmods SIG |
50e2b3 |
- p_pbr = (struct pbr *)sbi->pbr_bh->b_data;
|
|
Kmods SIG |
50e2b3 |
+ p_boot = (struct boot_sector *)sbi->boot_bh->b_data;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- /* check the validity of PBR */
|
|
Kmods SIG |
50e2b3 |
- if (le16_to_cpu((p_pbr->signature)) != PBR_SIGNATURE) {
|
|
Kmods SIG |
50e2b3 |
+ /* check the validity of BOOT */
|
|
Kmods SIG |
50e2b3 |
+ if (le16_to_cpu((p_boot->signature)) != BOOT_SIGNATURE) {
|
|
Kmods SIG |
50e2b3 |
exfat_err(sb, "invalid boot record signature");
|
|
Kmods SIG |
50e2b3 |
ret = -EINVAL;
|
|
Kmods SIG |
50e2b3 |
goto free_bh;
|
|
Kmods SIG |
50e2b3 |
@@ -437,8 +437,8 @@ static int __exfat_fill_super(struct super_block *sb)
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
/* check logical sector size */
|
|
Kmods SIG |
50e2b3 |
- p_pbr = exfat_read_pbr_with_logical_sector(sb);
|
|
Kmods SIG |
50e2b3 |
- if (!p_pbr) {
|
|
Kmods SIG |
50e2b3 |
+ p_boot = exfat_read_boot_with_logical_sector(sb);
|
|
Kmods SIG |
50e2b3 |
+ if (!p_boot) {
|
|
Kmods SIG |
50e2b3 |
ret = -EIO;
|
|
Kmods SIG |
50e2b3 |
goto free_bh;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
@@ -447,43 +447,43 @@ static int __exfat_fill_super(struct super_block *sb)
|
|
Kmods SIG |
50e2b3 |
* res_zero field must be filled with zero to prevent mounting
|
|
Kmods SIG |
50e2b3 |
* from FAT volume.
|
|
Kmods SIG |
50e2b3 |
*/
|
|
Kmods SIG |
50e2b3 |
- if (memchr_inv(p_pbr->bpb.f64.res_zero, 0,
|
|
Kmods SIG |
50e2b3 |
- sizeof(p_pbr->bpb.f64.res_zero))) {
|
|
Kmods SIG |
50e2b3 |
+ if (memchr_inv(p_boot->must_be_zero, 0,
|
|
Kmods SIG |
50e2b3 |
+ sizeof(p_boot->must_be_zero))) {
|
|
Kmods SIG |
50e2b3 |
ret = -EINVAL;
|
|
Kmods SIG |
50e2b3 |
goto free_bh;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- p_bpb = (struct pbr64 *)p_pbr;
|
|
Kmods SIG |
50e2b3 |
- if (!p_bpb->bsx.num_fats) {
|
|
Kmods SIG |
50e2b3 |
+ p_boot = (struct boot_sector *)p_boot;
|
|
Kmods SIG |
50e2b3 |
+ if (!p_boot->num_fats) {
|
|
Kmods SIG |
50e2b3 |
exfat_err(sb, "bogus number of FAT structure");
|
|
Kmods SIG |
50e2b3 |
ret = -EINVAL;
|
|
Kmods SIG |
50e2b3 |
goto free_bh;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- sbi->sect_per_clus = 1 << p_bpb->bsx.sect_per_clus_bits;
|
|
Kmods SIG |
50e2b3 |
- sbi->sect_per_clus_bits = p_bpb->bsx.sect_per_clus_bits;
|
|
Kmods SIG |
50e2b3 |
+ sbi->sect_per_clus = 1 << p_boot->sect_per_clus_bits;
|
|
Kmods SIG |
50e2b3 |
+ sbi->sect_per_clus_bits = p_boot->sect_per_clus_bits;
|
|
Kmods SIG |
50e2b3 |
sbi->cluster_size_bits = sbi->sect_per_clus_bits + sb->s_blocksize_bits;
|
|
Kmods SIG |
50e2b3 |
sbi->cluster_size = 1 << sbi->cluster_size_bits;
|
|
Kmods SIG |
50e2b3 |
- sbi->num_FAT_sectors = le32_to_cpu(p_bpb->bsx.fat_length);
|
|
Kmods SIG |
50e2b3 |
- sbi->FAT1_start_sector = le32_to_cpu(p_bpb->bsx.fat_offset);
|
|
Kmods SIG |
50e2b3 |
- sbi->FAT2_start_sector = p_bpb->bsx.num_fats == 1 ?
|
|
Kmods SIG |
50e2b3 |
+ sbi->num_FAT_sectors = le32_to_cpu(p_boot->fat_length);
|
|
Kmods SIG |
50e2b3 |
+ sbi->FAT1_start_sector = le32_to_cpu(p_boot->fat_offset);
|
|
Kmods SIG |
50e2b3 |
+ sbi->FAT2_start_sector = p_boot->num_fats == 1 ?
|
|
Kmods SIG |
50e2b3 |
sbi->FAT1_start_sector :
|
|
Kmods SIG |
50e2b3 |
sbi->FAT1_start_sector + sbi->num_FAT_sectors;
|
|
Kmods SIG |
50e2b3 |
- sbi->data_start_sector = le32_to_cpu(p_bpb->bsx.clu_offset);
|
|
Kmods SIG |
50e2b3 |
- sbi->num_sectors = le64_to_cpu(p_bpb->bsx.vol_length);
|
|
Kmods SIG |
50e2b3 |
+ sbi->data_start_sector = le32_to_cpu(p_boot->clu_offset);
|
|
Kmods SIG |
50e2b3 |
+ sbi->num_sectors = le64_to_cpu(p_boot->vol_length);
|
|
Kmods SIG |
50e2b3 |
/* because the cluster index starts with 2 */
|
|
Kmods SIG |
50e2b3 |
- sbi->num_clusters = le32_to_cpu(p_bpb->bsx.clu_count) +
|
|
Kmods SIG |
50e2b3 |
+ sbi->num_clusters = le32_to_cpu(p_boot->clu_count) +
|
|
Kmods SIG |
50e2b3 |
EXFAT_RESERVED_CLUSTERS;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- sbi->root_dir = le32_to_cpu(p_bpb->bsx.root_cluster);
|
|
Kmods SIG |
50e2b3 |
+ sbi->root_dir = le32_to_cpu(p_boot->root_cluster);
|
|
Kmods SIG |
50e2b3 |
sbi->dentries_per_clu = 1 <<
|
|
Kmods SIG |
50e2b3 |
(sbi->cluster_size_bits - DENTRY_SIZE_BITS);
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- sbi->vol_flag = le16_to_cpu(p_bpb->bsx.vol_flags);
|
|
Kmods SIG |
50e2b3 |
+ sbi->vol_flag = le16_to_cpu(p_boot->vol_flags);
|
|
Kmods SIG |
50e2b3 |
sbi->clu_srch_ptr = EXFAT_FIRST_CLUSTER;
|
|
Kmods SIG |
50e2b3 |
sbi->used_clusters = EXFAT_CLUSTERS_UNTRACKED;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- if (le16_to_cpu(p_bpb->bsx.vol_flags) & VOL_DIRTY) {
|
|
Kmods SIG |
50e2b3 |
+ if (le16_to_cpu(p_boot->vol_flags) & VOL_DIRTY) {
|
|
Kmods SIG |
50e2b3 |
sbi->vol_flag |= VOL_DIRTY;
|
|
Kmods SIG |
50e2b3 |
exfat_warn(sb, "Volume was not properly unmounted. Some data may be corrupt. Please run fsck.");
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
@@ -517,7 +517,7 @@ static int __exfat_fill_super(struct super_block *sb)
|
|
Kmods SIG |
50e2b3 |
free_upcase_table:
|
|
Kmods SIG |
50e2b3 |
exfat_free_upcase_table(sbi);
|
|
Kmods SIG |
50e2b3 |
free_bh:
|
|
Kmods SIG |
50e2b3 |
- brelse(sbi->pbr_bh);
|
|
Kmods SIG |
50e2b3 |
+ brelse(sbi->boot_bh);
|
|
Kmods SIG |
50e2b3 |
return ret;
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
@@ -608,7 +608,7 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc)
|
|
Kmods SIG |
50e2b3 |
free_table:
|
|
Kmods SIG |
50e2b3 |
exfat_free_upcase_table(sbi);
|
|
Kmods SIG |
50e2b3 |
exfat_free_bitmap(sbi);
|
|
Kmods SIG |
50e2b3 |
- brelse(sbi->pbr_bh);
|
|
Kmods SIG |
50e2b3 |
+ brelse(sbi->boot_bh);
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
check_nls_io:
|
|
Kmods SIG |
50e2b3 |
unload_nls(sbi->nls_io);
|
|
Kmods SIG |
50e2b3 |
--
|
|
Kmods SIG |
50e2b3 |
2.31.1
|
|
Kmods SIG |
50e2b3 |
|