Open barrybingo opened 5 years ago
Thanks @barrybingo for this fix.
I'd love to see this merged!
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"
Let's go with Adrian's patch then.
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);
@dpashev Are those changes needed?
Is this source alive? We requested those changes for about 2 months ago and is still the old version.
any chance to get this PR merged?
@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"
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?
I will change the NixOS repository once we can decide on a new maintainer. I do not want another dead repo in 2 months ;)
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.
@barrybingo awesome! I will change the upstream source to your repo in the next days and remove the manual patches we apply right now.
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/
I can confirm that this is working on debian 4.19.0-2-amd64
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.
Simple change which seems to work fine for issue #136