[PATCH] erofs-utils: pass down inode for erofs_prepare_xattr_ibody
Gao Xiang
hsiangkao at aol.com
Wed Jun 17 17:27:44 AEST 2020
From: Gao Xiang <hsiangkao at redhat.com>
Instead of several independent arguments for convenience.
No logic changes.
Signed-off-by: Gao Xiang <hsiangkao at redhat.com>
---
include/erofs/xattr.h | 3 +--
lib/inode.c | 4 +---
lib/xattr.c | 7 ++++---
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/include/erofs/xattr.h b/include/erofs/xattr.h
index 2e99669..9e2e1ea 100644
--- a/include/erofs/xattr.h
+++ b/include/erofs/xattr.h
@@ -42,8 +42,7 @@
#define XATTR_NAME_POSIX_ACL_DEFAULT "system.posix_acl_default"
#endif
-int erofs_prepare_xattr_ibody(const char *path, mode_t mode,
- struct list_head *ixattrs);
+int erofs_prepare_xattr_ibody(struct erofs_inode *inode);
char *erofs_export_xattr_ibody(struct list_head *ixattrs, unsigned int size);
int erofs_build_shared_xattrs_from_path(const char *path);
diff --git a/lib/inode.c b/lib/inode.c
index dff5f2c..5013184 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -827,11 +827,9 @@ struct erofs_inode *erofs_mkfs_build_tree(struct erofs_inode *dir)
struct dirent *dp;
struct erofs_dentry *d;
- ret = erofs_prepare_xattr_ibody(dir->i_srcpath,
- dir->i_mode, &dir->i_xattrs);
+ ret = erofs_prepare_xattr_ibody(dir);
if (ret < 0)
return ERR_PTR(ret);
- dir->xattr_isize = ret;
if (!S_ISDIR(dir->i_mode)) {
if (S_ISLNK(dir->i_mode)) {
diff --git a/lib/xattr.c b/lib/xattr.c
index aa614f6..769ab9c 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -352,17 +352,17 @@ err:
return ret;
}
-int erofs_prepare_xattr_ibody(const char *path, mode_t mode,
- struct list_head *ixattrs)
+int erofs_prepare_xattr_ibody(struct erofs_inode *inode)
{
int ret;
struct inode_xattr_node *node;
+ struct list_head *ixattrs = &inode->i_xattrs;
/* check if xattr is disabled */
if (cfg.c_inline_xattr_tolerance < 0)
return 0;
- ret = read_xattrs_from_file(path, mode, ixattrs);
+ ret = read_xattrs_from_file(inode->i_srcpath, inode->i_mode, ixattrs);
if (ret < 0)
return ret;
@@ -381,6 +381,7 @@ int erofs_prepare_xattr_ibody(const char *path, mode_t mode,
ret += sizeof(struct erofs_xattr_entry);
ret = EROFS_XATTR_ALIGN(ret + item->len[0] + item->len[1]);
}
+ inode->xattr_isize = ret;
return ret;
}
--
2.24.0
More information about the Linux-erofs
mailing list