[Yaffs] Linux 5.4.0 build fixes

Top Page
Attachments:
Message as email
+ (text/plain)
+ yaffs-5.4.0.patch (text/x-patch)
Delete this message
Reply to this message
Author: Andre Renaud
Date:  
To: yaffs
Subject: [Yaffs] Linux 5.4.0 build fixes
Hi,
I had some issues when building against a new kernel, and applied the
following changes.
These may apply to earlier versions as well.

Regards,
Andre
diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
index 07b347630a38..b1252470af60 100644
--- a/fs/yaffs2/yaffs_vfs.c
+++ b/fs/yaffs2/yaffs_vfs.c
@@ -170,6 +170,11 @@ static uint32_t YCALCBLOCKS(uint64_t partition_size, uint32_t block_size)
#define YCALCBLOCKS(s, b) ((s)/(b))
#endif

+#if (LINUX_VERSION_CODE > KERNEL_VERSION(5,4,0))
+#define MS_RDONLY SB_RDONLY
+#define MS_NOATIME SB_NOATIME
+#endif
+
#include <linux/uaccess.h>
#include <linux/mtd/mtd.h>

@@ -272,10 +277,14 @@ MODULE_PARM(yaffs_gc_control, "i");
 #define update_dir_time(dir) do {\
         (dir)->i_ctime = (dir)->i_mtime = current_kernel_time(); \
     } while (0)
-#else
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0))
 #define update_dir_time(dir) do {\
         (dir)->i_ctime = (dir)->i_mtime = current_kernel_time64(); \
     } while (0)
+#else
+#define update_dir_time(dir) do {\
+        (dir)->i_ctime = (dir)->i_mtime = ktime_to_timespec64(ktime_get_real()); \
+    } while (0)
 #endif


#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0))
diff --git a/fs/yaffs2/yportenv.h b/fs/yaffs2/yportenv.h
index 68c239c07435..750ac3ebd3cf 100644
--- a/fs/yaffs2/yportenv.h
+++ b/fs/yaffs2/yportenv.h
@@ -63,8 +63,10 @@
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
#define Y_CURRENT_TIME CURRENT_TIME.tv_sec
-#else
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0))
#define Y_CURRENT_TIME current_kernel_time().tv_sec
+#else
+#define Y_CURRENT_TIME ktime_get_real_seconds()
#endif
#define Y_TIME_CONVERT(x) (x).tv_sec
#else