Skip to contentSkip to conversation

erofs-utils: pass down inode for erofs_prepare_xattr_ibody

PATCH In review Gao Xiang via Linux-erofs 1 participant 2 messages Jun 17, 2020 – Jun 19, 2020 1 message not in the archive Library code

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 erofs-utils: pass down inode for erofs_prepare_xattr_ibody

From: Gao Xiang <[email protected]>

Instead of several independent arguments for convenience. No logic changes.

---
 include/erofs/xattr.h | 3 +--
 lib/inode.c           | 4 +---
 lib/xattr.c           | 7 ++++---
 3 files changed, 6 insertions(+), 8 deletions(-)
include/erofs/xattr.h +1 -2
index 2e99669..9e2e1ea 100644
@@ -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);
 
lib/inode.c +1 -3
index dff5f2c..5013184 100644
@@ -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)) {
lib/xattr.c +4 -3
index aa614f6..769ab9c 100644
@@ -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;
 }
 
Signature · 1 line
2.24.0