Skip to content
This repository was archived by the owner on Mar 3, 2024. It is now read-only.

Commit 5c4c05c

Browse files
committed
fix build compat with kernel < 4.18.0
Signed-off-by: Chen Minqiang <[email protected]>
1 parent ed23452 commit 5c4c05c

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ int exfat_init_dir_entry(struct inode *inode, struct exfat_chain *p_dir,
439439
{
440440
struct super_block *sb = inode->i_sb;
441441
struct exfat_sb_info *sbi = EXFAT_SB(sb);
442-
struct timespec64 ts = current_time(inode);
442+
exfat_timespec_t ts = current_time(inode);
443443
sector_t sector;
444444
struct exfat_dentry *ep;
445445
struct buffer_head *bh;

exfat_fs.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222

2323
#define EXFAT_CLUSTERS_UNTRACKED (~0u)
2424

25+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
26+
typedef struct timespec64 exfat_timespec_t;
27+
#else
28+
typedef struct timespec exfat_timespec_t;
29+
#endif
30+
2531
/*
2632
* exfat error flags
2733
*/
@@ -190,9 +196,9 @@ struct exfat_dir_entry {
190196
unsigned short attr;
191197
loff_t size;
192198
unsigned int num_subdirs;
193-
struct timespec64 atime;
194-
struct timespec64 mtime;
195-
struct timespec64 crtime;
199+
exfat_timespec_t atime;
200+
exfat_timespec_t mtime;
201+
exfat_timespec_t crtime;
196202
struct exfat_dentry_namebuf namebuf;
197203
};
198204

@@ -303,7 +309,7 @@ struct exfat_inode_info {
303309
struct rw_semaphore truncate_lock;
304310
struct inode vfs_inode;
305311
/* File creation time */
306-
struct timespec64 i_crtime;
312+
exfat_timespec_t i_crtime;
307313
};
308314

309315
static inline struct exfat_sb_info *EXFAT_SB(struct super_block *sb)
@@ -530,10 +536,10 @@ void exfat_msg(struct super_block *sb, const char *lv, const char *fmt, ...)
530536
#define exfat_info(sb, fmt, ...) \
531537
exfat_msg(sb, KERN_INFO, fmt, ##__VA_ARGS__)
532538

533-
void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
539+
void exfat_get_entry_time(struct exfat_sb_info *sbi, exfat_timespec_t *ts,
534540
u8 tz, __le16 time, __le16 date, u8 time_cs);
535-
void exfat_truncate_atime(struct timespec64 *ts);
536-
void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
541+
void exfat_truncate_atime(exfat_timespec_t *ts);
542+
void exfat_set_entry_time(struct exfat_sb_info *sbi, exfat_timespec_t *ts,
537543
u8 *tz, __le16 *time, __le16 *date, u8 *time_cs);
538544
u16 exfat_calc_chksum16(void *data, int len, u16 chksum, int type);
539545
u32 exfat_calc_chksum32(void *data, int len, u32 chksum, int type);

file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ int __exfat_truncate(struct inode *inode, loff_t new_size)
150150

151151
/* update the directory entry */
152152
if (!evict) {
153-
struct timespec64 ts;
153+
exfat_timespec_t ts;
154154
struct exfat_dentry *ep, *ep2;
155155
struct exfat_entry_set_cache *es;
156156

misc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void exfat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
6464
#define SECS_PER_MIN (60)
6565
#define TIMEZONE_SEC(x) ((x) * 15 * SECS_PER_MIN)
6666

67-
static void exfat_adjust_tz(struct timespec64 *ts, u8 tz_off)
67+
static void exfat_adjust_tz(exfat_timespec_t *ts, u8 tz_off)
6868
{
6969
if (tz_off <= 0x3F)
7070
ts->tv_sec -= TIMEZONE_SEC(tz_off);
@@ -73,7 +73,7 @@ static void exfat_adjust_tz(struct timespec64 *ts, u8 tz_off)
7373
}
7474

7575
/* Convert a EXFAT time/date pair to a UNIX date (seconds since 1 1 70). */
76-
void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
76+
void exfat_get_entry_time(struct exfat_sb_info *sbi, exfat_timespec_t *ts,
7777
u8 tz, __le16 time, __le16 date, u8 time_cs)
7878
{
7979
u16 t = le16_to_cpu(time);
@@ -99,7 +99,7 @@ void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
9999
}
100100

101101
/* Convert linear UNIX date to a EXFAT time/date pair. */
102-
void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
102+
void exfat_set_entry_time(struct exfat_sb_info *sbi, exfat_timespec_t *ts,
103103
u8 *tz, __le16 *time, __le16 *date, u8 *time_cs)
104104
{
105105
struct tm tm;
@@ -129,7 +129,7 @@ void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
129129
* (There is no 10msIncrement field for access_time unlike create/modify_time)
130130
* atime also has only a 2-second resolution.
131131
*/
132-
void exfat_truncate_atime(struct timespec64 *ts)
132+
void exfat_truncate_atime(exfat_timespec_t *ts)
133133
{
134134
ts->tv_sec = round_down(ts->tv_sec, 2);
135135
ts->tv_nsec = 0;

0 commit comments

Comments
 (0)