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

Linux 4.18/4.20 fix #137

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Linux 4.18/4.20 fix #137

wants to merge 8 commits into from

Conversation

barrybingo
Copy link

@barrybingo barrybingo commented Aug 18, 2018

Simple change which seems to work fine for issue #136

@alphazo
Copy link

alphazo commented Aug 18, 2018

Thanks @barrybingo for this fix.

@makefu
Copy link

makefu commented Aug 21, 2018

I'd love to see this merged!

exfat_super.c Outdated
void exfat_time_fat2unix(struct exfat_sb_info *sbi, struct timespec *ts,
DATE_TIME_T *tp)
#endif
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be:

#if LINUX_VERSION_CODE < KERNEL_VERSION(4,18,01)
#define timespec64 timespec
#endif

a good idea?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up to the repo owner I guess

Also this change is because of this commit
torvalds/linux@95582b0

Which went into kernel v4.18-rc1 so maybe use KERNEL_VERSION(4,18) as the test

You want me to use your change and resubmit the pr?

Copy link

@tommyjcarpenter tommyjcarpenter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixed exfat-dmks-git on my system today (Aug 24 2018) with the latest LInux Kernel on Arch. Was unable to modprobe exfat without this. So, an anecdotal "it works" from me. Thanks!

@EasyNetDev
Copy link

EasyNetDev commented Sep 13, 2018

Hi,

I've faced the same issue today.
I'm proposing this patch for backwards compatibility for Kernels < 4.18:

diff --git a/exfat_super.c b/exfat_super.c
index 312de36..262b74d 100644
--- a/exfat_super.c
+++ b/exfat_super.c
@@ -97,6 +97,11 @@ static int exfat_default_codepage = CONFIG_EXFAT_DEFAULT_CODEPAGE;
 static char exfat_default_iocharset[] = CONFIG_EXFAT_DEFAULT_IOCHARSET;
 
 extern struct timezone sys_tz;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0)
+#define timespec_compat timespec64
+#else
+#define timespec_compat timespec
+#endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
 #define current_time(x)        (CURRENT_TIME_SEC)
@@ -147,7 +152,7 @@ static time_t accum_days_in_year[] = {
 static void _exfat_truncate(struct inode *inode, loff_t old_size);
 
 /* Convert a FAT time/date pair to a UNIX date (seconds since 1 1 70). */
-void exfat_time_fat2unix(struct exfat_sb_info *sbi, struct timespec *ts,
+void exfat_time_fat2unix(struct exfat_sb_info *sbi, struct timespec_compat *ts,
                                                 DATE_TIME_T *tp)
 {
        time_t year = tp->Year;
@@ -166,7 +171,7 @@ void exfat_time_fat2unix(struct exfat_sb_info *sbi, struct timespec *ts,
 }
 
 /* Convert linear UNIX date to a FAT time/date pair. */
-void exfat_time_unix2fat(struct exfat_sb_info *sbi, struct timespec *ts,
+void exfat_time_unix2fat(struct exfat_sb_info *sbi, struct timespec_compat *ts,
                                                 DATE_TIME_T *tp)
 {
        time_t second = ts->tv_sec;
diff --git a/exfat_version.h b/exfat_version.h
index a93fa46..ca2cfc4 100644
--- a/exfat_version.h
+++ b/exfat_version.h
@@ -16,4 +16,4 @@
 /*                                                                      */
 /************************************************************************/
 
-#define EXFAT_VERSION  "1.2.9"
+#define EXFAT_VERSION  "1.2.10"

@barrybingo
Copy link
Author

Let's go with Adrian's patch then.

@dpashev
Copy link

dpashev commented Sep 28, 2018

diff --git a/exfat_super.c b/exfat_super.c
index 312de36..75b84b6 100644
--- a/exfat_super.c
+++ b/exfat_super.c
@@ -1924,9 +1924,9 @@ static int exfat_fill_inode(struct inode *inode, FILE_ID_T *fid)
        inode->i_blocks = ((i_size_read(inode) + (p_fs->cluster_size - 1))
                                           & ~((loff_t)p_fs->cluster_size - 1)) >> 9;
 
-       exfat_time_fat2unix(sbi, &inode->i_mtime, &info.ModifyTimestamp);
-       exfat_time_fat2unix(sbi, &inode->i_ctime, &info.CreateTimestamp);
-       exfat_time_fat2unix(sbi, &inode->i_atime, &info.AccessTimestamp);
+       exfat_time_fat2unix(sbi, (struct timespec *)&inode->i_mtime, &info.ModifyTimestamp);
+       exfat_time_fat2unix(sbi, (struct timespec *)&inode->i_ctime, &info.CreateTimestamp);
+       exfat_time_fat2unix(sbi, (struct timespec *)&inode->i_atime, &info.AccessTimestamp);
 
        return 0;
 }
@@ -2007,9 +2007,9 @@ static int exfat_write_inode(struct inode *inode, struct writeback_control *wbc)
        info.Attr = exfat_make_attr(inode);
        info.Size = i_size_read(inode);
 
-       exfat_time_unix2fat(sbi, &inode->i_mtime, &info.ModifyTimestamp);
-       exfat_time_unix2fat(sbi, &inode->i_ctime, &info.CreateTimestamp);
-       exfat_time_unix2fat(sbi, &inode->i_atime, &info.AccessTimestamp);
+       exfat_time_unix2fat(sbi, (struct timespec *)&inode->i_mtime, &info.ModifyTimestamp);
+       exfat_time_unix2fat(sbi, (struct timespec *)&inode->i_ctime, &info.CreateTimestamp);
+       exfat_time_unix2fat(sbi, (struct timespec *)&inode->i_atime, &info.AccessTimestamp);
 
        FsWriteStat(inode, &info);
 

@satmandu
Copy link

satmandu commented Oct 3, 2018

@dpashev Are those changes needed?

@EasyNetDev
Copy link

Is this source alive? We requested those changes for about 2 months ago and is still the old version.

dengqf6 added a commit to dengqf6/packages that referenced this pull request Dec 17, 2018
dengqf6 added a commit to dengqf6/packages that referenced this pull request Dec 18, 2018
dengqf6 added a commit to dengqf6/packages that referenced this pull request Dec 18, 2018
@makefu
Copy link

makefu commented Jan 9, 2019

any chance to get this PR merged?

In torvalds/linux@e462ec50cb a new set of superblock flags was added
to replace the original MS_* ones, and in torvalds/linux@e262e32d6b
the MS_* flags are suppressed unless uapi/linux/mount.h is included.
As is suggested, we should use the new API now.
@barrybingo barrybingo changed the title Linux 4.18 fix Linux 4.18/4.20 fix Jan 11, 2019
exfat_{core,super}.c: fix build on 5.0-rc1, MS_* -> SB_*
@makefu
Copy link

makefu commented Jan 13, 2019

@barrybingo thanks so much for your work. If work cannot be moved forward it may be a good thing if you could continue the maintenance in your repository.

The last merged PR was "Apr 16, 2018"

@tommyjcarpenter
Copy link

I agree, but more importantly, the Arch package should switch over to this repo. The upstream looks dead. It looks like the author hasn't made any commits in github for several months. Are you willing to have the arch package point here?

@makefu
Copy link

makefu commented Jan 14, 2019

I will change the NixOS repository once we can decide on a new maintainer. I do not want another dead repo in 2 months ;)

@barrybingo
Copy link
Author

I use Arch and require this package working for the foreseeable future and am willing to maintain it in the sense of patching it to work for future kernels as well as compiling, testing and looking over pull requests. I'll open up issues on my fork and look through the outstanding pull requests and issues on this repo to see which require migrating. I've also requested the Arch AUR use my fork.

@makefu
Copy link

makefu commented Jan 14, 2019

@barrybingo awesome! I will change the upstream source to your repo in the next days and remove the manual patches we apply right now.

@tommyjcarpenter
Copy link

tommyjcarpenter commented Jan 14, 2019

Awesome, thanks for your hard work! Just to clarify, we are talking about exfat-dkms-git right? https://aur.archlinux.org/packages/exfat-dkms-git/

@rumatoest
Copy link

I can confirm that this is working on debian 4.19.0-2-amd64

… type. This is tested and works on 5.6.3 as well as 5.5.17. The _TIME_T seems to have been introduced in 2.6.12 and was removed in 412c53a680a97cb1ae2c0ab60230e193bee86387
@tommyjcarpenter
Copy link

thank you for the latest fix! (I'm the one who bothered you in the Arch package). That said, it would seem that Exfat works even without this package on 5.6.3 so I ended up uninstalling it. But Im happy to test this anyway.

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

Successfully merging this pull request may close these issues.

10 participants