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