Skip to content

Commit 8fa4101

Browse files
Jack QiuJaegeuk Kim
authored andcommitted
f2fs: use macro instead of f2fs verity version
Because fsverity_descriptor_location.version is constant, so use macro for better reading. Signed-off-by: Jack Qiu <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 1fd2801 commit 8fa4101

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/f2fs/verity.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include "f2fs.h"
3030
#include "xattr.h"
3131

32+
#define F2FS_VERIFY_VER (1)
33+
3234
static inline loff_t f2fs_verity_metadata_pos(const struct inode *inode)
3335
{
3436
return round_up(inode->i_size, 65536);
@@ -152,7 +154,7 @@ static int f2fs_end_enable_verity(struct file *filp, const void *desc,
152154
struct inode *inode = file_inode(filp);
153155
u64 desc_pos = f2fs_verity_metadata_pos(inode) + merkle_tree_size;
154156
struct fsverity_descriptor_location dloc = {
155-
.version = cpu_to_le32(1),
157+
.version = cpu_to_le32(F2FS_VERIFY_VER),
156158
.size = cpu_to_le32(desc_size),
157159
.pos = cpu_to_le64(desc_pos),
158160
};
@@ -199,7 +201,7 @@ static int f2fs_get_verity_descriptor(struct inode *inode, void *buf,
199201
F2FS_XATTR_NAME_VERITY, &dloc, sizeof(dloc), NULL);
200202
if (res < 0 && res != -ERANGE)
201203
return res;
202-
if (res != sizeof(dloc) || dloc.version != cpu_to_le32(1)) {
204+
if (res != sizeof(dloc) || dloc.version != cpu_to_le32(F2FS_VERIFY_VER)) {
203205
f2fs_warn(F2FS_I_SB(inode), "unknown verity xattr format");
204206
return -EINVAL;
205207
}

0 commit comments

Comments
 (0)