mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
hpfs: convert to ctime accessor functions
In later patches, we're going to change how the inode's ctime field is used. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Signed-off-by: Jeff Layton <jlayton@kernel.org> Message-Id: <20230705190309.579783-49-jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
66e79d8934
commit
3200d07d33
@ -277,10 +277,10 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, unsigned in
|
||||
* inode.
|
||||
*/
|
||||
|
||||
if (!result->i_ctime.tv_sec) {
|
||||
if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date))))
|
||||
result->i_ctime.tv_sec = 1;
|
||||
result->i_ctime.tv_nsec = 0;
|
||||
if (!inode_get_ctime(result).tv_sec) {
|
||||
time64_t csec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date));
|
||||
|
||||
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));
|
||||
result->i_mtime.tv_nsec = 0;
|
||||
result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date));
|
||||
|
@ -36,7 +36,7 @@ void hpfs_init_inode(struct inode *i)
|
||||
hpfs_inode->i_rddir_off = NULL;
|
||||
hpfs_inode->i_dirty = 0;
|
||||
|
||||
i->i_ctime.tv_sec = i->i_ctime.tv_nsec = 0;
|
||||
inode_set_ctime(i, 0, 0);
|
||||
i->i_mtime.tv_sec = i->i_mtime.tv_nsec = 0;
|
||||
i->i_atime.tv_sec = i->i_atime.tv_nsec = 0;
|
||||
}
|
||||
@ -232,7 +232,7 @@ void hpfs_write_inode_nolock(struct inode *i)
|
||||
if (de) {
|
||||
de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec));
|
||||
de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec));
|
||||
de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec));
|
||||
de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_ctime(i).tv_sec));
|
||||
de->read_only = !(i->i_mode & 0222);
|
||||
de->ea_size = cpu_to_le32(hpfs_inode->i_ea_size);
|
||||
hpfs_mark_4buffers_dirty(&qbh);
|
||||
@ -242,7 +242,7 @@ void hpfs_write_inode_nolock(struct inode *i)
|
||||
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->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec));
|
||||
de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec));
|
||||
de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_ctime(i).tv_sec));
|
||||
de->read_only = !(i->i_mode & 0222);
|
||||
de->ea_size = cpu_to_le32(/*hpfs_inode->i_ea_size*/0);
|
||||
de->file_size = cpu_to_le32(0);
|
||||
|
@ -13,10 +13,9 @@ static void hpfs_update_directory_times(struct inode *dir)
|
||||
{
|
||||
time64_t t = local_to_gmt(dir->i_sb, local_get_seconds(dir->i_sb));
|
||||
if (t == dir->i_mtime.tv_sec &&
|
||||
t == dir->i_ctime.tv_sec)
|
||||
t == inode_get_ctime(dir).tv_sec)
|
||||
return;
|
||||
dir->i_mtime.tv_sec = dir->i_ctime.tv_sec = t;
|
||||
dir->i_mtime.tv_nsec = dir->i_ctime.tv_nsec = 0;
|
||||
dir->i_mtime = inode_set_ctime(dir, t, 0);
|
||||
hpfs_write_inode_nolock(dir);
|
||||
}
|
||||
|
||||
@ -59,10 +58,8 @@ static int hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||
result->i_ino = fno;
|
||||
hpfs_i(result)->i_parent_dir = dir->i_ino;
|
||||
hpfs_i(result)->i_dno = dno;
|
||||
result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
|
||||
result->i_ctime.tv_nsec = 0;
|
||||
result->i_mtime.tv_nsec = 0;
|
||||
result->i_atime.tv_nsec = 0;
|
||||
result->i_mtime = result->i_atime =
|
||||
inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
|
||||
hpfs_i(result)->i_ea_size = 0;
|
||||
result->i_mode |= S_IFDIR;
|
||||
result->i_op = &hpfs_dir_iops;
|
||||
@ -167,10 +164,8 @@ static int hpfs_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||
result->i_fop = &hpfs_file_ops;
|
||||
set_nlink(result, 1);
|
||||
hpfs_i(result)->i_parent_dir = dir->i_ino;
|
||||
result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
|
||||
result->i_ctime.tv_nsec = 0;
|
||||
result->i_mtime.tv_nsec = 0;
|
||||
result->i_atime.tv_nsec = 0;
|
||||
result->i_mtime = result->i_atime =
|
||||
inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
|
||||
hpfs_i(result)->i_ea_size = 0;
|
||||
if (dee.read_only)
|
||||
result->i_mode &= ~0222;
|
||||
@ -250,10 +245,8 @@ static int hpfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
|
||||
hpfs_init_inode(result);
|
||||
result->i_ino = fno;
|
||||
hpfs_i(result)->i_parent_dir = dir->i_ino;
|
||||
result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
|
||||
result->i_ctime.tv_nsec = 0;
|
||||
result->i_mtime.tv_nsec = 0;
|
||||
result->i_atime.tv_nsec = 0;
|
||||
result->i_mtime = result->i_atime =
|
||||
inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
|
||||
hpfs_i(result)->i_ea_size = 0;
|
||||
result->i_uid = current_fsuid();
|
||||
result->i_gid = current_fsgid();
|
||||
@ -326,10 +319,8 @@ static int hpfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
|
||||
result->i_ino = fno;
|
||||
hpfs_init_inode(result);
|
||||
hpfs_i(result)->i_parent_dir = dir->i_ino;
|
||||
result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date));
|
||||
result->i_ctime.tv_nsec = 0;
|
||||
result->i_mtime.tv_nsec = 0;
|
||||
result->i_atime.tv_nsec = 0;
|
||||
result->i_mtime = result->i_atime =
|
||||
inode_set_ctime(result, local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0);
|
||||
hpfs_i(result)->i_ea_size = 0;
|
||||
result->i_mode = S_IFLNK | 0777;
|
||||
result->i_uid = current_fsuid();
|
||||
|
@ -729,8 +729,9 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
|
||||
root->i_atime.tv_nsec = 0;
|
||||
root->i_mtime.tv_sec = local_to_gmt(s, le32_to_cpu(de->write_date));
|
||||
root->i_mtime.tv_nsec = 0;
|
||||
root->i_ctime.tv_sec = local_to_gmt(s, le32_to_cpu(de->creation_date));
|
||||
root->i_ctime.tv_nsec = 0;
|
||||
inode_set_ctime(root,
|
||||
local_to_gmt(s, le32_to_cpu(de->creation_date)),
|
||||
0);
|
||||
hpfs_i(root)->i_ea_size = le32_to_cpu(de->ea_size);
|
||||
hpfs_i(root)->i_parent_dir = root->i_ino;
|
||||
if (root->i_size == -1)
|
||||
|
Loading…
Reference in New Issue
Block a user