Linux-f2fs-devel Archive on lore.kernel.org
 help / color / Atom feed
* Re: [f2fs-dev] [PATCH] f2fs: use macro instead of f2fs verity version
@ 2020-07-29  0:30 Qiujie (Jack)
  0 siblings, 0 replies; 3+ messages in thread
From: Qiujie (Jack) @ 2020-07-29  0:30 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel

> On 07/25, Jack Qiu wrote:
> > Because fsverity_descriptor_location.version is constant, so use macro
> > for better reading.
> >
> > Signed-off-by: Jack Qiu <jack.qiu@huawei.com>
> > ---
> >  fs/f2fs/verity.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c index
> > 865c9fb774fb..5be8a5790907 100644
> > --- a/fs/f2fs/verity.c
> > +++ b/fs/f2fs/verity.c
> > @@ -29,6 +29,8 @@
> >  #include "f2fs.h"
> >  #include "xattr.h"
> >
> > +#define F2FS_VERIFY_VER	cpu_to_le32(1)
> 
> Should be like this?
> 
> #define F2FS_VERITY_VER		1
> 
> And, use cpu_to_le32(F2FS_VERITY_VER) below?
> 

OK, I will revise this in next version, Thanks.

> > +
> >  static inline loff_t f2fs_verity_metadata_pos(const struct inode
> > *inode)  {
> >  	return round_up(inode->i_size, 65536); @@ -152,7 +154,7 @@ static
> > int f2fs_end_enable_verity(struct file *filp, const void *desc,
> >  	struct inode *inode = file_inode(filp);
> >  	u64 desc_pos = f2fs_verity_metadata_pos(inode) + merkle_tree_size;
> >  	struct fsverity_descriptor_location dloc = {
> > -		.version = cpu_to_le32(1),
> > +		.version = F2FS_VERIFY_VER,
> >  		.size = cpu_to_le32(desc_size),
> >  		.pos = cpu_to_le64(desc_pos),
> >  	};
> > @@ -199,7 +201,7 @@ static int f2fs_get_verity_descriptor(struct inode
> *inode, void *buf,
> >  			    F2FS_XATTR_NAME_VERITY, &dloc, sizeof(dloc), NULL);
> >  	if (res < 0 && res != -ERANGE)
> >  		return res;
> > -	if (res != sizeof(dloc) || dloc.version != cpu_to_le32(1)) {
> > +	if (res != sizeof(dloc) || dloc.version != F2FS_VERIFY_VER) {
> >  		f2fs_warn(F2FS_I_SB(inode), "unknown verity xattr format");
> >  		return -EINVAL;
> >  	}
> > --
> > 2.17.1
> >
> >
> >
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: use macro instead of f2fs verity version
  2020-07-25  3:13 Jack Qiu
@ 2020-07-26 15:12 ` Jaegeuk Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2020-07-26 15:12 UTC (permalink / raw)
  To: Jack Qiu; +Cc: linux-f2fs-devel

On 07/25, Jack Qiu wrote:
> Because fsverity_descriptor_location.version is constant,
> so use macro for better reading.
> 
> Signed-off-by: Jack Qiu <jack.qiu@huawei.com>
> ---
>  fs/f2fs/verity.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c
> index 865c9fb774fb..5be8a5790907 100644
> --- a/fs/f2fs/verity.c
> +++ b/fs/f2fs/verity.c
> @@ -29,6 +29,8 @@
>  #include "f2fs.h"
>  #include "xattr.h"
> 
> +#define F2FS_VERIFY_VER	cpu_to_le32(1)

Should be like this?

#define F2FS_VERITY_VER		1

And, use cpu_to_le32(F2FS_VERITY_VER) below?

> +
>  static inline loff_t f2fs_verity_metadata_pos(const struct inode *inode)
>  {
>  	return round_up(inode->i_size, 65536);
> @@ -152,7 +154,7 @@ static int f2fs_end_enable_verity(struct file *filp, const void *desc,
>  	struct inode *inode = file_inode(filp);
>  	u64 desc_pos = f2fs_verity_metadata_pos(inode) + merkle_tree_size;
>  	struct fsverity_descriptor_location dloc = {
> -		.version = cpu_to_le32(1),
> +		.version = F2FS_VERIFY_VER,
>  		.size = cpu_to_le32(desc_size),
>  		.pos = cpu_to_le64(desc_pos),
>  	};
> @@ -199,7 +201,7 @@ static int f2fs_get_verity_descriptor(struct inode *inode, void *buf,
>  			    F2FS_XATTR_NAME_VERITY, &dloc, sizeof(dloc), NULL);
>  	if (res < 0 && res != -ERANGE)
>  		return res;
> -	if (res != sizeof(dloc) || dloc.version != cpu_to_le32(1)) {
> +	if (res != sizeof(dloc) || dloc.version != F2FS_VERIFY_VER) {
>  		f2fs_warn(F2FS_I_SB(inode), "unknown verity xattr format");
>  		return -EINVAL;
>  	}
> --
> 2.17.1
> 
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [f2fs-dev] [PATCH] f2fs: use macro instead of f2fs verity version
@ 2020-07-25  3:13 Jack Qiu
  2020-07-26 15:12 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Jack Qiu @ 2020-07-25  3:13 UTC (permalink / raw)
  To: linux-f2fs-devel

Because fsverity_descriptor_location.version is constant,
so use macro for better reading.

Signed-off-by: Jack Qiu <jack.qiu@huawei.com>
---
 fs/f2fs/verity.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c
index 865c9fb774fb..5be8a5790907 100644
--- a/fs/f2fs/verity.c
+++ b/fs/f2fs/verity.c
@@ -29,6 +29,8 @@
 #include "f2fs.h"
 #include "xattr.h"

+#define F2FS_VERIFY_VER	cpu_to_le32(1)
+
 static inline loff_t f2fs_verity_metadata_pos(const struct inode *inode)
 {
 	return round_up(inode->i_size, 65536);
@@ -152,7 +154,7 @@ static int f2fs_end_enable_verity(struct file *filp, const void *desc,
 	struct inode *inode = file_inode(filp);
 	u64 desc_pos = f2fs_verity_metadata_pos(inode) + merkle_tree_size;
 	struct fsverity_descriptor_location dloc = {
-		.version = cpu_to_le32(1),
+		.version = F2FS_VERIFY_VER,
 		.size = cpu_to_le32(desc_size),
 		.pos = cpu_to_le64(desc_pos),
 	};
@@ -199,7 +201,7 @@ static int f2fs_get_verity_descriptor(struct inode *inode, void *buf,
 			    F2FS_XATTR_NAME_VERITY, &dloc, sizeof(dloc), NULL);
 	if (res < 0 && res != -ERANGE)
 		return res;
-	if (res != sizeof(dloc) || dloc.version != cpu_to_le32(1)) {
+	if (res != sizeof(dloc) || dloc.version != F2FS_VERIFY_VER) {
 		f2fs_warn(F2FS_I_SB(inode), "unknown verity xattr format");
 		return -EINVAL;
 	}
--
2.17.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29  0:30 [f2fs-dev] [PATCH] f2fs: use macro instead of f2fs verity version Qiujie (Jack)
  -- strict thread matches above, loose matches on Subject: below --
2020-07-25  3:13 Jack Qiu
2020-07-26 15:12 ` Jaegeuk Kim

Linux-f2fs-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-f2fs-devel/0 linux-f2fs-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-f2fs-devel linux-f2fs-devel/ https://lore.kernel.org/linux-f2fs-devel \
		linux-f2fs-devel@lists.sourceforge.net
	public-inbox-index linux-f2fs-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/net.sourceforge.lists.linux-f2fs-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git