Commit 83c1d74c authored by Jeff Layton's avatar Jeff Layton Committed by Christian Brauner

hpfs: convert to new timestamp accessors

Convert to using the new inode timestamp accessor functions.
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20231004185347.80880-42-jlayton@kernel.orgSigned-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent c461ba5d
...@@ -277,14 +277,16 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in ...@@ -277,14 +277,16 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in
* inode. * inode.
*/ */
if (!inode_get_ctime(result).tv_sec) { if (!inode_get_ctime_sec(result)) {
time64_t csec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date)); time64_t csec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date));
inode_set_ctime(result, csec ? csec : 1, 0); inode_set_ctime(result, csec ? csec : 1, 0);
result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->write_date)); inode_set_mtime(result,
result->i_mtime.tv_nsec = 0; local_to_gmt(dir->i_sb, le32_to_cpu(de->write_date)),
result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date)); 0);
result->i_atime.tv_nsec = 0; inode_set_atime(result,
local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date)),
0);
hpfs_result->i_ea_size = le32_to_cpu(de->ea_size); hpfs_result->i_ea_size = le32_to_cpu(de->ea_size);
if (!hpfs_result->i_ea_mode && de->read_only) if (!hpfs_result->i_ea_mode && de->read_only)
result->i_mode &= ~0222; result->i_mode &= ~0222;
......
...@@ -37,8 +37,8 @@ void hpfs_init_inode(struct inode *i) ...@@ -37,8 +37,8 @@ void hpfs_init_inode(struct inode *i)
hpfs_inode->i_dirty = 0; hpfs_inode->i_dirty = 0;
inode_set_ctime(i, 0, 0); inode_set_ctime(i, 0, 0);
i->i_mtime.tv_sec = i->i_mtime.tv_nsec = 0; inode_set_mtime(i, 0, 0);
i->i_atime.tv_sec = i->i_atime.tv_nsec = 0; inode_set_atime(i, 0, 0);
} }
void hpfs_read_inode(struct inode *i) void hpfs_read_inode(struct inode *i)
...@@ -230,9 +230,9 @@ void hpfs_write_inode_nolock(struct inode *i) ...@@ -230,9 +230,9 @@ void hpfs_write_inode_nolock(struct inode *i)
} }
hpfs_write_inode_ea(i, fnode); hpfs_write_inode_ea(i, fnode);
if (de) { if (de) {
de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec)); de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_mtime_sec(i)));
de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec)); de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_atime_sec(i)));
de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_ctime(i).tv_sec)); de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_ctime_sec(i)));
de->read_only = !(i->i_mode & 0222); de->read_only = !(i->i_mode & 0222);
de->ea_size = cpu_to_le32(hpfs_inode->i_ea_size); de->ea_size = cpu_to_le32(hpfs_inode->i_ea_size);
hpfs_mark_4buffers_dirty(&qbh); hpfs_mark_4buffers_dirty(&qbh);
...@@ -240,9 +240,9 @@ void hpfs_write_inode_nolock(struct inode *i) ...@@ -240,9 +240,9 @@ void hpfs_write_inode_nolock(struct inode *i)
} }
if (S_ISDIR(i->i_mode)) { if (S_ISDIR(i->i_mode)) {
if ((de = map_dirent(i, hpfs_inode->i_dno, "\001\001", 2, NULL, &qbh))) { if ((de = map_dirent(i, hpfs_inode->i_dno, "\001\001", 2, NULL, &qbh))) {
de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec)); de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_mtime_sec(i)));
de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec)); de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_atime_sec(i)));
de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_ctime(i).tv_sec)); de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_ctime_sec(i)));
de->read_only = !(i->i_mode & 0222); de->read_only = !(i->i_mode & 0222);
de->ea_size = cpu_to_le32(/*hpfs_inode->i_ea_size*/0); de->ea_size = cpu_to_le32(/*hpfs_inode->i_ea_size*/0);
de->file_size = cpu_to_le32(0); de->file_size = cpu_to_le32(0);
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
static void hpfs_update_directory_times(struct inode *dir) static void hpfs_update_directory_times(struct inode *dir)
{ {
time64_t t = local_to_gmt(dir->i_sb, local_get_seconds(dir->i_sb)); time64_t t = local_to_gmt(dir->i_sb, local_get_seconds(dir->i_sb));
if (t == dir->i_mtime.tv_sec && if (t == inode_get_mtime_sec(dir) &&
t == inode_get_ctime(dir).tv_sec) t == inode_get_ctime_sec(dir))
return; return;
dir->i_mtime = inode_set_ctime(dir, t, 0); inode_set_mtime_to_ts(dir, inode_set_ctime(dir, t, 0));
hpfs_write_inode_nolock(dir); hpfs_write_inode_nolock(dir);
} }
...@@ -58,8 +58,8 @@ static int hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, ...@@ -58,8 +58,8 @@ static int hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
result->i_ino = fno; result->i_ino = fno;
hpfs_i(result)->i_parent_dir = dir->i_ino; hpfs_i(result)->i_parent_dir = dir->i_ino;
hpfs_i(result)->i_dno = dno; hpfs_i(result)->i_dno = dno;
result->i_mtime = result->i_atime = inode_set_mtime_to_ts(result,
inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0); inode_set_atime_to_ts(result, inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0)));
hpfs_i(result)->i_ea_size = 0; hpfs_i(result)->i_ea_size = 0;
result->i_mode |= S_IFDIR; result->i_mode |= S_IFDIR;
result->i_op = &hpfs_dir_iops; result->i_op = &hpfs_dir_iops;
...@@ -164,8 +164,8 @@ static int hpfs_create(struct mnt_idmap *idmap, struct inode *dir, ...@@ -164,8 +164,8 @@ static int hpfs_create(struct mnt_idmap *idmap, struct inode *dir,
result->i_fop = &hpfs_file_ops; result->i_fop = &hpfs_file_ops;
set_nlink(result, 1); set_nlink(result, 1);
hpfs_i(result)->i_parent_dir = dir->i_ino; hpfs_i(result)->i_parent_dir = dir->i_ino;
result->i_mtime = result->i_atime = inode_set_mtime_to_ts(result,
inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0); inode_set_atime_to_ts(result, inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0)));
hpfs_i(result)->i_ea_size = 0; hpfs_i(result)->i_ea_size = 0;
if (dee.read_only) if (dee.read_only)
result->i_mode &= ~0222; result->i_mode &= ~0222;
...@@ -245,8 +245,8 @@ static int hpfs_mknod(struct mnt_idmap *idmap, struct inode *dir, ...@@ -245,8 +245,8 @@ static int hpfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
hpfs_init_inode(result); hpfs_init_inode(result);
result->i_ino = fno; result->i_ino = fno;
hpfs_i(result)->i_parent_dir = dir->i_ino; hpfs_i(result)->i_parent_dir = dir->i_ino;
result->i_mtime = result->i_atime = inode_set_mtime_to_ts(result,
inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0); inode_set_atime_to_ts(result, inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0)));
hpfs_i(result)->i_ea_size = 0; hpfs_i(result)->i_ea_size = 0;
result->i_uid = current_fsuid(); result->i_uid = current_fsuid();
result->i_gid = current_fsgid(); result->i_gid = current_fsgid();
...@@ -319,8 +319,8 @@ static int hpfs_symlink(struct mnt_idmap *idmap, struct inode *dir, ...@@ -319,8 +319,8 @@ static int hpfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
result->i_ino = fno; result->i_ino = fno;
hpfs_init_inode(result); hpfs_init_inode(result);
hpfs_i(result)->i_parent_dir = dir->i_ino; hpfs_i(result)->i_parent_dir = dir->i_ino;
result->i_mtime = result->i_atime = inode_set_mtime_to_ts(result,
inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0); inode_set_atime_to_ts(result, inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0)));
hpfs_i(result)->i_ea_size = 0; hpfs_i(result)->i_ea_size = 0;
result->i_mode = S_IFLNK | 0777; result->i_mode = S_IFLNK | 0777;
result->i_uid = current_fsuid(); result->i_uid = current_fsuid();
......
...@@ -725,10 +725,12 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) ...@@ -725,10 +725,12 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
if (!de) if (!de)
hpfs_error(s, "unable to find root dir"); hpfs_error(s, "unable to find root dir");
else { else {
root->i_atime.tv_sec = local_to_gmt(s, le32_to_cpu(de->read_date)); inode_set_atime(root,
root->i_atime.tv_nsec = 0; local_to_gmt(s, le32_to_cpu(de->read_date)),
root->i_mtime.tv_sec = local_to_gmt(s, le32_to_cpu(de->write_date)); 0);
root->i_mtime.tv_nsec = 0; inode_set_mtime(root,
local_to_gmt(s, le32_to_cpu(de->write_date)),
0);
inode_set_ctime(root, inode_set_ctime(root,
local_to_gmt(s, le32_to_cpu(de->creation_date)), local_to_gmt(s, le32_to_cpu(de->creation_date)),
0); 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment