lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230706124734.ew57trrtzkegqg6y@quack3>
Date:   Thu, 6 Jul 2023 14:47:34 +0200
From:   Jan Kara <jack@...e.cz>
To:     Jeff Layton <jlayton@...nel.org>
Cc:     Christian Brauner <brauner@...nel.org>,
        Mikulas Patocka <mikulas@...ax.karlin.mff.cuni.cz>,
        Al Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 51/92] hpfs: convert to ctime accessor functions

On Wed 05-07-23 15:01:16, Jeff Layton wrote:
> 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@...nel.org>

...

> diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
> index 69fb40b2c99a..36babb78b510 100644
> --- a/fs/hpfs/namei.c
> +++ b/fs/hpfs/namei.c
> @@ -13,10 +13,10 @@ 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.tv_sec = inode_set_ctime(dir, t, 0).tv_sec;
> +	dir->i_mtime.tv_nsec = 0;

Easier to read:

	dir->i_mtime = inode_set_ctime(dir, t, 0);

> @@ -59,8 +59,9 @@ 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; 
> +	inode_set_ctime(result,
> +			result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
> +			0);
>  	result->i_mtime.tv_nsec = 0; 
>  	result->i_atime.tv_nsec = 0; 

Here also:
	result->i_mtime = result->i_atime = inode_set_ctime(result,
		local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)), 0)

> @@ -167,8 +168,9 @@ 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;
> +	inode_set_ctime(result,
> +			result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
> +			0);
>  	result->i_mtime.tv_nsec = 0;
>  	result->i_atime.tv_nsec = 0;

And here exactly the same.

> @@ -250,8 +252,9 @@ 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;
> +	inode_set_ctime(result,
> +			result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
> +			0);
>  	result->i_mtime.tv_nsec = 0;
>  	result->i_atime.tv_nsec = 0;
>  	hpfs_i(result)->i_ea_size = 0;
> @@ -326,8 +329,9 @@ 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;
> +	inode_set_ctime(result,
> +			result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)),
> +			0);
>  	result->i_mtime.tv_nsec = 0;
>  	result->i_atime.tv_nsec = 0;
>  	hpfs_i(result)->i_ea_size = 0;

And in above two as well.

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ