From: Martin Kaiser <
martin@kaiser.cx>
This is another fix to allow compiling on Linux 4.14-rc1.
The CURRENT_TIME macro was removed from the kernel in 4.12. The
recommended way to get the current time is now current_time(inode),
which was introduced in 4.9. Use this function if it's supported and if
we have an inode to reference.
Replace CURRENT_TIME with current_kernel_time() in other places, this
function has been available at least since 2.6.11.
(To be on the safe side, I didn't touch the pre 2.5.0 code.)
Signed-off-by: Martin Kaiser <
martin@kaiser.cx>
---
yaffs_vfs_multi.c | 8 +++++++-
yportenv_multi.h | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c
index acb0c4a..00834b9 100644
--- a/yaffs_vfs_multi.c
+++ b/yaffs_vfs_multi.c
@@ -263,8 +263,14 @@ MODULE_PARM(yaffs_gc_control, "i");
#define YAFFS_NEW_GET_LINK 0
#endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
+#define __CURRENT_TIME(_inode) current_time(_inode)
+#else
+#define __CURRENT_TIME(_inode) current_kernel_time()
+#endif
+
#define update_dir_time(dir) do {\
- (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \
+ (dir)->i_ctime = (dir)->i_mtime = __CURRENT_TIME(dir); \
} while (0)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0))
diff --git a/yportenv_multi.h b/yportenv_multi.h
index 8975af3..8f526d6 100644
--- a/yportenv_multi.h
+++ b/yportenv_multi.h
@@ -62,7 +62,7 @@
#define YAFFS_LOSTNFOUND_MODE 0700
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
-#define Y_CURRENT_TIME CURRENT_TIME.tv_sec
+#define Y_CURRENT_TIME current_kernel_time().tv_sec
#define Y_TIME_CONVERT(x) (x).tv_sec
#else
#define Y_CURRENT_TIME CURRENT_TIME
--
2.1.4