Skip to content
Snippets Groups Projects
Commit 1e91a9fe authored by Steve Kondik's avatar Steve Kondik
Browse files

exfat: Stop using CURRENT_TIME_SEC

 * This is going away in 4.12 and is not y2038 safe.
 * Use current_time(inode) and ktime_get_real_ts where appropriate.
parent ef703b26
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -128,10 +128,16 @@ static time_t accum_days_in_year[] = {
 
TIMESTAMP_T *tm_current(TIMESTAMP_T *tp)
{
struct timespec ts = CURRENT_TIME_SEC;
time_t second = ts.tv_sec;
time_t day, leap_day, month, year;
struct timespec ts;
time_t second, day, leap_day, month, year;
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
ts = CURRENT_TIME_SEC;
#else
ktime_get_real_ts(&ts);
#endif
second = ts.tv_sec;
second -= sys_tz.tz_minuteswest * SECS_PER_MIN;
 
/* Jan 1 GMT 00:00:00 1980. But what about another time zone? */
Loading
Loading
Loading
Loading
@@ -95,6 +95,10 @@ static char exfat_default_iocharset[] = CONFIG_EXFAT_DEFAULT_IOCHARSET;
 
extern struct timezone sys_tz;
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
#define current_time(x) (CURRENT_TIME_SEC)
#endif
#define CHECK_ERR(x) BUG_ON(x)
 
#define UNIX_SECS_1980 315532800L
Loading
Loading
@@ -721,7 +725,6 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, int mode,
{
struct super_block *sb = dir->i_sb;
struct inode *inode;
struct timespec ts;
FILE_ID_T fid;
loff_t i_pos;
int err;
Loading
Loading
@@ -730,8 +733,6 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, int mode,
 
DPRINTK("exfat_create entered\n");
 
ts = CURRENT_TIME_SEC;
err = FsCreateFile(dir, (u8 *) dentry->d_name.name, FM_REGULAR, &fid);
if (err) {
if (err == FFS_INVALIDPATH)
Loading
Loading
@@ -747,7 +748,7 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, int mode,
goto out;
}
dir->i_version++;
dir->i_ctime = dir->i_mtime = dir->i_atime = ts;
dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
(void) exfat_sync_inode(dir);
else
Loading
Loading
@@ -761,7 +762,7 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, int mode,
goto out;
}
inode->i_version++;
inode->i_mtime = inode->i_atime = inode->i_ctime = ts;
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
/* timestamp is already written, so mark_inode_dirty() is unnecessary. */
 
dentry->d_time = dentry->d_parent->d_inode->i_version;
Loading
Loading
@@ -879,15 +880,12 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
struct super_block *sb = dir->i_sb;
struct timespec ts;
int err;
 
__lock_super(sb);
 
DPRINTK("exfat_unlink entered\n");
 
ts = CURRENT_TIME_SEC;
EXFAT_I(inode)->fid.size = i_size_read(inode);
 
err = FsRemoveFile(dir, &(EXFAT_I(inode)->fid));
Loading
Loading
@@ -899,14 +897,14 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
goto out;
}
dir->i_version++;
dir->i_mtime = dir->i_atime = ts;
dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
(void) exfat_sync_inode(dir);
else
mark_inode_dirty(dir);
 
clear_nlink(inode);
inode->i_mtime = inode->i_atime = ts;
inode->i_mtime = inode->i_atime = current_time(inode);
exfat_detach(inode);
remove_inode_hash(inode);
 
Loading
Loading
@@ -920,7 +918,6 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry, const char *t
{
struct super_block *sb = dir->i_sb;
struct inode *inode;
struct timespec ts;
FILE_ID_T fid;
loff_t i_pos;
int err;
Loading
Loading
@@ -931,8 +928,6 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry, const char *t
 
DPRINTK("exfat_symlink entered\n");
 
ts = CURRENT_TIME_SEC;
err = FsCreateFile(dir, (u8 *) dentry->d_name.name, FM_SYMLINK, &fid);
if (err) {
if (err == FFS_INVALIDPATH)
Loading
Loading
@@ -959,7 +954,7 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry, const char *t
}
 
dir->i_version++;
dir->i_ctime = dir->i_mtime = dir->i_atime = ts;
dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
(void) exfat_sync_inode(dir);
else
Loading
Loading
@@ -973,7 +968,7 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry, const char *t
goto out;
}
inode->i_version++;
inode->i_mtime = inode->i_atime = inode->i_ctime = ts;
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
/* timestamp is already written, so mark_inode_dirty() is unneeded. */
 
EXFAT_I(inode)->target = kmalloc(len+1, GFP_KERNEL);
Loading
Loading
@@ -1000,7 +995,6 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
struct super_block *sb = dir->i_sb;
struct inode *inode;
struct timespec ts;
FILE_ID_T fid;
loff_t i_pos;
int err;
Loading
Loading
@@ -1009,8 +1003,6 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 
DPRINTK("exfat_mkdir entered\n");
 
ts = CURRENT_TIME_SEC;
err = FsCreateDir(dir, (u8 *) dentry->d_name.name, &fid);
if (err) {
if (err == FFS_INVALIDPATH)
Loading
Loading
@@ -1026,7 +1018,7 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, int mode)
goto out;
}
dir->i_version++;
dir->i_ctime = dir->i_mtime = dir->i_atime = ts;
dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
(void) exfat_sync_inode(dir);
else
Loading
Loading
@@ -1041,7 +1033,7 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, int mode)
goto out;
}
inode->i_version++;
inode->i_mtime = inode->i_atime = inode->i_ctime = ts;
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
/* timestamp is already written, so mark_inode_dirty() is unneeded. */
 
dentry->d_time = dentry->d_parent->d_inode->i_version;
Loading
Loading
@@ -1057,15 +1049,12 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
struct super_block *sb = dir->i_sb;
struct timespec ts;
int err;
 
__lock_super(sb);
 
DPRINTK("exfat_rmdir entered\n");
 
ts = CURRENT_TIME_SEC;
EXFAT_I(inode)->fid.size = i_size_read(inode);
 
err = FsRemoveDir(dir, &(EXFAT_I(inode)->fid));
Loading
Loading
@@ -1083,7 +1072,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
goto out;
}
dir->i_version++;
dir->i_mtime = dir->i_atime = ts;
dir->i_mtime = dir->i_atime = current_time(dir);
if (IS_DIRSYNC(dir))
(void) exfat_sync_inode(dir);
else
Loading
Loading
@@ -1091,7 +1080,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
drop_nlink(dir);
 
clear_nlink(inode);
inode->i_mtime = inode->i_atime = ts;
inode->i_mtime = inode->i_atime = current_time(inode);
exfat_detach(inode);
remove_inode_hash(inode);
 
Loading
Loading
@@ -1112,7 +1101,6 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
{
struct inode *old_inode, *new_inode;
struct super_block *sb = old_dir->i_sb;
struct timespec ts;
loff_t i_pos;
int err;
 
Loading
Loading
@@ -1128,8 +1116,6 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
old_inode = old_dentry->d_inode;
new_inode = new_dentry->d_inode;
 
ts = CURRENT_TIME_SEC;
EXFAT_I(old_inode)->fid.size = i_size_read(old_inode);
 
err = FsMoveFile(old_dir, &(EXFAT_I(old_inode)->fid), new_dir, new_dentry);
Loading
Loading
@@ -1149,7 +1135,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
goto out;
}
new_dir->i_version++;
new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime = ts;
new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime = current_time(new_dir);
if (IS_DIRSYNC(new_dir))
(void) exfat_sync_inode(new_dir);
else
Loading
Loading
@@ -1172,7 +1158,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
}
 
old_dir->i_version++;
old_dir->i_ctime = old_dir->i_mtime = ts;
old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
if (IS_DIRSYNC(old_dir))
(void) exfat_sync_inode(old_dir);
else
Loading
Loading
@@ -1183,7 +1169,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
drop_nlink(new_inode);
if (S_ISDIR(new_inode->i_mode))
drop_nlink(new_inode);
new_inode->i_ctime = ts;
new_inode->i_ctime = current_time(new_inode);
}
 
out:
Loading
Loading
@@ -1202,7 +1188,7 @@ static int exfat_cont_expand(struct inode *inode, loff_t size)
if (err != 0)
return err;
 
inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
inode->i_ctime = inode->i_mtime = current_time(inode);
mark_inode_dirty(inode);
 
if (IS_SYNC(inode)) {
Loading
Loading
@@ -1496,7 +1482,7 @@ static void _exfat_truncate(struct inode *inode, loff_t old_size)
if (err)
goto out;
 
inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
inode->i_ctime = inode->i_mtime = current_time(inode);
if (IS_DIRSYNC(inode))
(void) exfat_sync_inode(inode);
else
Loading
Loading
@@ -1692,7 +1678,7 @@ static int exfat_write_end(struct file *file, struct address_space *mapping,
#endif
 
if (!(err < 0) && !(fid->attr & ATTR_ARCHIVE)) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
inode->i_mtime = inode->i_ctime = current_time(inode);
fid->attr |= ATTR_ARCHIVE;
mark_inode_dirty(inode);
}
Loading
Loading
@@ -2418,12 +2404,9 @@ static int exfat_read_root(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
struct exfat_sb_info *sbi = EXFAT_SB(sb);
struct timespec ts;
FS_INFO_T *p_fs = &(sbi->fs_info);
DIR_ENTRY_T info;
 
ts = CURRENT_TIME_SEC;
EXFAT_I(inode)->fid.dir.dir = p_fs->root_dir;
EXFAT_I(inode)->fid.dir.flags = 0x01;
EXFAT_I(inode)->fid.entry = -1;
Loading
Loading
@@ -2452,7 +2435,7 @@ static int exfat_read_root(struct inode *inode)
EXFAT_I(inode)->mmu_private = i_size_read(inode);
 
exfat_save_attr(inode, ATTR_SUBDIR);
inode->i_mtime = inode->i_atime = inode->i_ctime = ts;
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,00)
set_nlink(inode, info.NumSubdirs + 2);
#else
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment