Skip to content

Commit

Permalink
fs: set sdfat as exfat
Browse files Browse the repository at this point in the history
Fix sdcard not mounting with exfat file system on AOSP roms/gsi
Original commit: yuichigojo/kernel_m51@0b80575
  • Loading branch information
Andrey0800770 committed Feb 7, 2025
1 parent 130f194 commit f3431aa
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions arch/arm64/configs/crownqlte_chn_open_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5529,6 +5529,7 @@ CONFIG_SDP=y
# CONFIG_SDP_KEY_DUMP is not set
CONFIG_DLP=y
CONFIG_SDCARD_FS=y
CONFIG_SDFAT_USE_FOR_EXFAT=y
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/star2qlte_chn_open_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5529,6 +5529,7 @@ CONFIG_SDP=y
# CONFIG_SDP_KEY_DUMP is not set
CONFIG_DLP=y
CONFIG_SDCARD_FS=y
CONFIG_SDFAT_USE_FOR_EXFAT=y
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/star2qlte_usa_single_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5529,6 +5529,7 @@ CONFIG_SDP=y
# CONFIG_SDP_KEY_DUMP is not set
CONFIG_DLP=y
CONFIG_SDCARD_FS=y
CONFIG_SDFAT_USE_FOR_EXFAT=y
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/starqlte_chn_open_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5528,6 +5528,7 @@ CONFIG_SDP=y
# CONFIG_SDP_KEY_DUMP is not set
CONFIG_DLP=y
CONFIG_SDCARD_FS=y
CONFIG_SDFAT_USE_FOR_EXFAT=y
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/starqlte_jpn_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5461,6 +5461,7 @@ CONFIG_SDP=y
# CONFIG_SDP_KEY_DUMP is not set
CONFIG_DLP=y
CONFIG_SDCARD_FS=y
CONFIG_SDFAT_USE_FOR_EXFAT=y
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/starqlte_usa_single_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5529,6 +5529,7 @@ CONFIG_SDP=y
# CONFIG_SDP_KEY_DUMP is not set
CONFIG_DLP=y
CONFIG_SDCARD_FS=y
CONFIG_SDFAT_USE_FOR_EXFAT=y
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
Expand Down
7 changes: 7 additions & 0 deletions fs/sdfat/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ config SDFAT_FS
To compile this as a module, choose M here: the module will be called
sdfat_core and sdfat_fs.

config SDFAT_USE_FOR_EXFAT
bool "Register sdFAT as exFAT"
default y
depends on SDFAT_FS && !EXFAT_FS
help
If you want to register sdFAT as available for exFAT, say Y.

config SDFAT_DELAYED_META_DIRTY
bool "Enable delayed metadata dirty"
default y
Expand Down
25 changes: 24 additions & 1 deletion fs/sdfat/sdfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -5087,6 +5087,20 @@ static struct file_system_type sdfat_fs_type = {
.fs_flags = FS_REQUIRES_DEV,
};

#ifdef CONFIG_SDFAT_USE_FOR_EXFAT
static struct file_system_type exfat_fs_type = {
.owner = THIS_MODULE,
.name = "exfat",
.mount = sdfat_fs_mount,
#ifdef CONFIG_SDFAT_DBG_IOCTL
.kill_sb = sdfat_debug_kill_sb,
#else
.kill_sb = kill_block_super,
#endif /* CONFIG_SDFAT_DBG_IOCTL */
.fs_flags = FS_REQUIRES_DEV,
};
#endif /* CONFIG_SDFAT_USE_FOR_EXFAT */

static int __init init_sdfat_fs(void)
{
int err;
Expand Down Expand Up @@ -5128,6 +5142,13 @@ static int __init init_sdfat_fs(void)
pr_err("[SDFAT] failed to register filesystem\n");
goto error;
}
#ifdef CONFIG_SDFAT_USE_FOR_EXFAT
err = register_filesystem(&exfat_fs_type);
if (err) {
pr_err("[SDFAT] failed to register for exfat filesystem\n");
goto error;
}
#endif /* CONFIG_SDFAT_USE_FOR_EXFAT */

return 0;
error:
Expand Down Expand Up @@ -5160,7 +5181,9 @@ static void __exit exit_sdfat_fs(void)

sdfat_destroy_inodecache();
unregister_filesystem(&sdfat_fs_type);

#ifdef CONFIG_SDFAT_USE_FOR_EXFAT
unregister_filesystem(&exfat_fs_type);
#endif /* CONFIG_SDFAT_USE_FOR_EXFAT */
fsapi_shutdown();
}

Expand Down

0 comments on commit f3431aa

Please sign in to comment.