mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-04-13 09:59:31 +00:00
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 <jack.qiu@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
1fd280188d
commit
8fa41016f0
1 changed files with 4 additions and 2 deletions
|
@ -29,6 +29,8 @@
|
||||||
#include "f2fs.h"
|
#include "f2fs.h"
|
||||||
#include "xattr.h"
|
#include "xattr.h"
|
||||||
|
|
||||||
|
#define F2FS_VERIFY_VER (1)
|
||||||
|
|
||||||
static inline loff_t f2fs_verity_metadata_pos(const struct inode *inode)
|
static inline loff_t f2fs_verity_metadata_pos(const struct inode *inode)
|
||||||
{
|
{
|
||||||
return round_up(inode->i_size, 65536);
|
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);
|
struct inode *inode = file_inode(filp);
|
||||||
u64 desc_pos = f2fs_verity_metadata_pos(inode) + merkle_tree_size;
|
u64 desc_pos = f2fs_verity_metadata_pos(inode) + merkle_tree_size;
|
||||||
struct fsverity_descriptor_location dloc = {
|
struct fsverity_descriptor_location dloc = {
|
||||||
.version = cpu_to_le32(1),
|
.version = cpu_to_le32(F2FS_VERIFY_VER),
|
||||||
.size = cpu_to_le32(desc_size),
|
.size = cpu_to_le32(desc_size),
|
||||||
.pos = cpu_to_le64(desc_pos),
|
.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);
|
F2FS_XATTR_NAME_VERITY, &dloc, sizeof(dloc), NULL);
|
||||||
if (res < 0 && res != -ERANGE)
|
if (res < 0 && res != -ERANGE)
|
||||||
return res;
|
return res;
|
||||||
if (res != sizeof(dloc) || dloc.version != cpu_to_le32(1)) {
|
if (res != sizeof(dloc) || dloc.version != cpu_to_le32(F2FS_VERIFY_VER)) {
|
||||||
f2fs_warn(F2FS_I_SB(inode), "unknown verity xattr format");
|
f2fs_warn(F2FS_I_SB(inode), "unknown verity xattr format");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue