[OpenWrt-Devel] [PATCH] exfat-nofuse: fix kernel 5.4 compilation issue
Paul Blazejowski
paulb at blazebox.homeip.net
Thu Mar 5 16:16:43 EST 2020
Patch taken from
https://github.com/barrybingo/exfat-nofuse/commit/8b59e1f338fdd87f1d5a9db2a119a3745bb467d5
Signed-off-by: Paul Blazejowski <paulb at blazebox.homeip.net>
---
kernel/exfat-nofuse/Makefile | 2 +-
kernel/exfat-nofuse/patches/0003-5.0.patch | 88 ++++++++++++++++++++++
2 files changed, 89 insertions(+), 1 deletion(-)
create mode 100644 kernel/exfat-nofuse/patches/0003-5.0.patch
diff --git a/kernel/exfat-nofuse/Makefile b/kernel/exfat-nofuse/Makefile
index 8354f5621..ebc101144 100644
--- a/kernel/exfat-nofuse/Makefile
+++ b/kernel/exfat-nofuse/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=exfat-nofuse
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE_URL:=https://github.com/dorimanx/exfat-nofuse.git
PKG_SOURCE_PROTO:=git
diff --git a/kernel/exfat-nofuse/patches/0003-5.0.patch b/kernel/exfat-nofuse/patches/0003-5.0.patch
new file mode 100644
index 000000000..da28fc03c
--- /dev/null
+++ b/kernel/exfat-nofuse/patches/0003-5.0.patch
@@ -0,0 +1,88 @@
+From 8b59e1f338fdd87f1d5a9db2a119a3745bb467d5 Mon Sep 17 00:00:00 2001
+From: Junde Yhi <lmy441900 at aosc.xyz>
+Date: Thu, 10 Jan 2019 21:19:49 +0800
+Subject: [PATCH] exfat_{core,super}.c: fix build on 5.0-rc1, MS_* -> SB_*
+
+In torvalds/linux at e462ec50cb a new set of superblock flags was added
+to replace the original MS_* ones, and in torvalds/linux at e262e32d6b
+the MS_* flags are suppressed unless uapi/linux/mount.h is included.
+As is suggested, we should use the new API now.
+---
+ exfat_core.c | 6 +++++-
+ exfat_core.h | 6 ++++++
+ exfat_super.c | 11 ++++++++++-
+ 3 files changed, 21 insertions(+), 2 deletions(-)
+
+diff --git a/exfat_core.c b/exfat_core.c
+index 143b721..397afd6 100644
+--- a/exfat_core.c
++++ b/exfat_core.c
+@@ -1757,8 +1757,12 @@ void fs_error(struct super_block *sb)
+
+ if (opts->errors == EXFAT_ERRORS_PANIC)
+ panic("[EXFAT] Filesystem panic from previous error\n");
+- else if ((opts->errors == EXFAT_ERRORS_RO) && !(sb->s_flags & MS_RDONLY)) {
++ else if ((opts->errors == EXFAT_ERRORS_RO) && !EXFAT_IS_SB_RDONLY(sb)) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
+ sb->s_flags |= MS_RDONLY;
++#else
++ sb->s_flags |= SB_RDONLY;
++#endif
+ printk(KERN_ERR "[EXFAT] Filesystem has been set read-only\n");
+ }
+ }
+diff --git a/exfat_core.h b/exfat_core.h
+index 52d05c7..3d023b7 100644
+--- a/exfat_core.h
++++ b/exfat_core.h
+@@ -45,6 +45,12 @@
+ #include "exfat_api.h"
+ #include "exfat_cache.h"
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
++#define EXFAT_IS_SB_RDONLY(sb) ((sb)->s_flags & MS_RDONLY)
++#else
++#define EXFAT_IS_SB_RDONLY(sb) ((sb)->s_flags & SB_RDONLY)
++#endif
++
+ #ifdef CONFIG_EXFAT_KERNEL_DEBUG
+ /* For Debugging Purpose */
+ /* IOCTL code 'f' used by
+diff --git a/exfat_super.c b/exfat_super.c
+index 79ff5f9..6452b54 100644
+--- a/exfat_super.c
++++ b/exfat_super.c
+@@ -2086,7 +2086,7 @@ static void exfat_write_super(struct super_block *sb)
+
+ __set_sb_clean(sb);
+
+- if (!(sb->s_flags & MS_RDONLY))
++ if (!EXFAT_IS_SB_RDONLY(sb))
+ FsSyncVol(sb, 1);
+
+ __unlock_super(sb);
+@@ -2142,7 +2142,12 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
+
+ static int exfat_remount(struct super_block *sb, int *flags, char *data)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
+ *flags |= MS_NODIRATIME;
++#else
++ *flags |= SB_NODIRATIME;
++#endif
++
+ return 0;
+ }
+
+@@ -2495,7 +2500,11 @@ static int exfat_fill_super(struct super_block *sb, void *data, int silent)
+ mutex_init(&sbi->s_lock);
+ #endif
+ sb->s_fs_info = sbi;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
+ sb->s_flags |= MS_NODIRATIME;
++#else
++ sb->s_flags |= SB_NODIRATIME;
++#endif
+ sb->s_magic = EXFAT_SUPER_MAGIC;
+ sb->s_op = &exfat_sops;
+ sb->s_export_op = &exfat_export_ops;
--
2.25.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list