aboutsummaryrefslogtreecommitdiff
path: root/fs/sdfat/sdfat.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sdfat/sdfat.h')
-rw-r--r--fs/sdfat/sdfat.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/fs/sdfat/sdfat.h b/fs/sdfat/sdfat.h
index 5ac46598a..1fda91ff4 100644
--- a/fs/sdfat/sdfat.h
+++ b/fs/sdfat/sdfat.h
@@ -33,6 +33,38 @@
#include "dfr.h"
#endif
+/*************************************************************************
+ * FUNCTIONS WHICH HAS KERNEL VERSION DEPENDENCY
+ *************************************************************************/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
+#include <linux/iversion.h>
+#define INC_IVERSION(x) (inode_inc_iversion(x))
+#define GET_IVERSION(x) (inode_peek_iversion_raw(x))
+#define SET_IVERSION(x,y) (inode_set_iversion(x, y))
+#else
+#define INC_IVERSION(x) (x->i_version++)
+#define GET_IVERSION(x) (x->i_version)
+#define SET_IVERSION(x,y) (x->i_version = y)
+#endif
+
+#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, 18, 0)
+#define CURRENT_TIME_SEC timespec64_trunc(current_kernel_time64(), NSEC_PER_SEC)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+#define CURRENT_TIME_SEC timespec_trunc(current_kernel_time(), NSEC_PER_SEC)
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
+#define SDFAT_IS_SB_RDONLY(sb) ((sb)->s_flags & MS_RDONLY)
+#else
+#define SDFAT_IS_SB_RDONLY(sb) ((sb)->s_flags & SB_RDONLY)
+#endif
+
/*
* sdfat error flags
*/
@@ -365,9 +397,9 @@ __sdfat_msg(struct super_block *sb, const char *lv, int st, const char *fmt, ...
#define sdfat_log_msg(sb, lv, fmt, args...) \
__sdfat_msg(sb, lv, 1, fmt, ## args)
extern void sdfat_log_version(void);
-extern void sdfat_time_fat2unix(struct sdfat_sb_info *sbi, struct timespec *ts,
+extern void sdfat_time_fat2unix(struct sdfat_sb_info *sbi, struct timespec_compat *ts,
DATE_TIME_T *tp);
-extern void sdfat_time_unix2fat(struct sdfat_sb_info *sbi, struct timespec *ts,
+extern void sdfat_time_unix2fat(struct sdfat_sb_info *sbi, struct timespec_compat *ts,
DATE_TIME_T *tp);
extern TIMESTAMP_T *tm_now(struct sdfat_sb_info *sbi, TIMESTAMP_T *tm);