Skip to content

Commit

Permalink
For Linux kernel >= 5.0 patch dorimanx#145
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DraceWang committed Aug 5, 2020
1 parent 01c30ad commit 640c4a7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions exfat_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down
12 changes: 12 additions & 0 deletions exfat_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,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);
Expand Down Expand Up @@ -2136,7 +2140,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;
}

Expand Down Expand Up @@ -2489,7 +2497,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;
Expand Down

0 comments on commit 640c4a7

Please sign in to comment.