linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gao Xiang via Linux-erofs <linux-erofs@lists.ozlabs.org>
To: linux-erofs@lists.ozlabs.org
Subject: [PATCH] erofs-utils: pass down inode for erofs_prepare_xattr_ibody
Date: Wed, 17 Jun 2020 15:27:44 +0800	[thread overview]
Message-ID: <20200617072744.7979-1-hsiangkao@aol.com> (raw)
In-Reply-To: 20200617072744.7979-1-hsiangkao.ref@aol.com

From: Gao Xiang <hsiangkao@redhat.com>

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

Signed-off-by: Gao Xiang <hsiangkao@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


       reply	other threads:[~2020-06-17  7:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200617072744.7979-1-hsiangkao.ref@aol.com>
2020-06-17  7:27 ` Gao Xiang via Linux-erofs [this message]
2020-06-19 16:34   ` [PATCH] erofs-utils: pass down inode for erofs_prepare_xattr_ibody Li GuiFu via Linux-erofs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200617072744.7979-1-hsiangkao@aol.com \
    --to=linux-erofs@lists.ozlabs.org \
    --cc=hsiangkao@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).