Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.0 patch #145

Open
CodeUnit opened this issue Mar 5, 2019 · 5 comments
Open

v5.0 patch #145

CodeUnit opened this issue Mar 5, 2019 · 5 comments

Comments

@CodeUnit
Copy link

CodeUnit commented Mar 5, 2019

For linux-v5.0 this patch is needed (MS_toSB_macros.patch):

index 143b721..7c4d3c2 100644
--- a/exfat_core.c
+++ b/exfat_core.c
@@ -1757,8 +1757,13 @@ void fs_error(struct super_block *sb)
 
 	if (opts->errors == EXFAT_ERRORS_PANIC)
 		panic("[EXFAT] Filesystem panic from previous error\n");
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0)
+        else if ((opts->errors == EXFAT_ERRORS_RO) && !(sb->s_flags & SB_RDONLY)) {
+                sb->s_flags |= SB_RDONLY;
+#else
 	else if ((opts->errors == EXFAT_ERRORS_RO) && !(sb->s_flags & MS_RDONLY)) {
 		sb->s_flags |= MS_RDONLY;
+#endif
 		printk(KERN_ERR "[EXFAT] Filesystem has been set read-only\n");
 	}
 }
diff --git a/exfat_super.c b/exfat_super.c
index 312de36..cee7508 100644
--- a/exfat_super.c
+++ b/exfat_super.c
@@ -2080,7 +2090,11 @@ static void exfat_write_super(struct super_block *sb)
 
 	__set_sb_clean(sb);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0)
+	if (!(sb->s_flags & SB_RDONLY))
+#else
 	if (!(sb->s_flags & MS_RDONLY))
+#endif
 		FsSyncVol(sb, 1);
 
 	__unlock_super(sb);
@@ -2136,7 +2150,11 @@ 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(5,0,0)
+	*flags |= SB_NODIRATIME;
+#else
 	*flags |= MS_NODIRATIME;
+#endif	
 	return 0;
 }
 
@@ -2489,7 +2507,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(5,0,0)
+	sb->s_flags |= SB_NODIRATIME;
+#else
 	sb->s_flags |= MS_NODIRATIME;
+#endif
 	sb->s_magic = EXFAT_SUPER_MAGIC;
 	sb->s_op = &exfat_sops;
 	sb->s_export_op = &exfat_export_ops;
@SchrodingerZhu
Copy link

  CC [M]  /build/bbswitch-0.8/bbswitch.o
  CC [M]  /build/source/exfat_core.o
  CC [M]  /build/source/nvidiabl-module.o
/build/source/exfat_core.c: In function 'fs_error':
/build/source/exfat_core.c:1760:64: error: 'MS_RDONLY' undeclared (first use in this function); did you mean 'IS_RDONLY'?
  else if ((opts->errors == EXFAT_ERRORS_RO) && !(sb->s_flags & MS_RDONLY)) {
                                                                ^~~~~~~~~
                                                                IS_RDONLY
/build/source/exfat_core.c:1760:64: note: each undeclared identifier is reported only once for each function it appears in

Does this patch fix this? @CodeUnit

@CodeUnit
Copy link
Author

CodeUnit commented Mar 8, 2019

Yes, it works for me.

@makefu
Copy link

makefu commented Sep 2, 2019

@CodeUnit thanks for your efforts? care to create a PR for the issue? i'd love to add your patch to the nixpkgs repository similar to 4.18 and 4.20 support we maintain: https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/exfat/default.nix#L31-L36

@EasyNetDev
Copy link

Hi all,

I've forked the project to my github and I've added the patches for 4.18-4.20 and also the patch for >= 5.0.
Please take a look https://github.com/AdrianBan/exfat-nofuse . We can try to continue the project here if you are interested. I'm trying to maintain for myself.

Kind regards,
Adrian

@makefu
Copy link

makefu commented Sep 6, 2019

Hey @adrianban thanks for your efforts and your willingness to continue maintain exfat-nofuse. I will prepare an update in nixpkgs.

makefu added a commit to makefu/nixpkgs that referenced this issue Sep 16, 2019
Upstream repository is unmaintained since 2018, maintainership got taken
over by AdrianBan ( dorimanx/exfat-nofuse#145 (comment) )
Mic92 pushed a commit to NixOS/nixpkgs that referenced this issue Sep 24, 2019
Upstream repository is unmaintained since 2018, maintainership got taken
over by AdrianBan ( dorimanx/exfat-nofuse#145 (comment) )

(cherry picked from commit 8a6e2f5)
DraceWang added a commit to DraceWang/exfat-nofuse that referenced this issue Aug 5, 2020
MS_toSB_macros.patch
to fix compile problem like:
/build/source/exfat_core.c: In function 'fs_error':
/build/source/exfat_core.c:1760:64: error: 'MS_RDONLY' undeclared (first use in this function); did you mean 'IS_RDONLY'?
  else if ((opts->errors == EXFAT_ERRORS_RO) && !(sb->s_flags & MS_RDONLY)) {
                                                                ^~~~~~~~~
                                                                IS_RDONLY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants