diff options
| author | KNnut <9387720+KNnut@users.noreply.github.com> | 2019-01-20 21:38:32 +0800 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2019-05-02 14:30:26 +0200 |
| commit | 9411ce1e9c402b34d66877dead2dd9e1e0510620 (patch) | |
| tree | ce3b44f31d8589f865db5c4adbc55e2c11c645f2 /fs/sdfat/sdfat.h | |
| parent | 6b97f43fee3117f8f49c79830c0771399dba75e1 (diff) | |
fs: sdfat: Fix compilation on Linux >= 4.16
Change-Id: If510b954c3f92fdcad2a27e5f65a1dcea11f57f3
Diffstat (limited to 'fs/sdfat/sdfat.h')
| -rw-r--r-- | fs/sdfat/sdfat.h | 36 |
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); |
