From: Sheng Yong <shengyong1@huawei.com>
To: <dedekind1@gmail.com>, <adrian.hunter@intel.com>
Cc: miaoxie@huawei.com, linux-mtd@lists.infradead.org, hujianyang@huawei.com
Subject: [RFC PATCH 1/3] UBIFS: xattr: splite generic set/get xattr functions from ubifs_set/getxattr
Date: Wed, 25 Mar 2015 11:46:03 +0000 [thread overview]
Message-ID: <1427283965-86137-2-git-send-email-shengyong1@huawei.com> (raw)
In-Reply-To: <1427283965-86137-1-git-send-email-shengyong1@huawei.com>
Splite generic set/get xattr functions from ubifs_set/getxattr. Add them
to ubifs.h so that functions outside xattr.c can use them. Because ACL is
implemented based on xattr, this is a preparation for later ACL patchset.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
fs/ubifs/ubifs.h | 2 ++
fs/ubifs/xattr.c | 25 ++++++++++++++++---------
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index bc04b9c..2cb4297 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1758,6 +1758,8 @@ ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size);
int ubifs_removexattr(struct dentry *dentry, const char *name);
int ubifs_init_security(struct inode *dentry, struct inode *inode,
const struct qstr *qstr);
+int __ubifs_setxattr(struct inode *, const char *, const void *, size_t, int);
+ssize_t __ubifs_getxattr(struct inode *, const char *, void *, size_t);
/* super.c */
struct inode *ubifs_iget(struct super_block *sb, unsigned long inum);
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index a92be24..c11c1f6 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -299,7 +299,7 @@ static struct inode *iget_xattr(struct ubifs_info *c, ino_t inum)
return ERR_PTR(-EINVAL);
}
-static int setxattr(struct inode *host, const char *name, const void *value,
+int __ubifs_setxattr(struct inode *host, const char *name, const void *value,
size_t size, int flags)
{
struct inode *inode;
@@ -366,13 +366,13 @@ int ubifs_setxattr(struct dentry *dentry, const char *name,
dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd",
name, dentry->d_inode->i_ino, dentry, size);
- return setxattr(dentry->d_inode, name, value, size, flags);
+ return __ubifs_setxattr(dentry->d_inode, name, value, size, flags);
}
-ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf,
- size_t size)
+ssize_t __ubifs_getxattr(struct inode *host, const char *name, void *buf,
+ size_t size)
{
- struct inode *inode, *host = dentry->d_inode;
+ struct inode *inode;
struct ubifs_info *c = host->i_sb->s_fs_info;
struct qstr nm = QSTR_INIT(name, strlen(name));
struct ubifs_inode *ui;
@@ -380,9 +380,6 @@ ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf,
union ubifs_key key;
int err;
- dbg_gen("xattr '%s', ino %lu ('%pd'), buf size %zd", name,
- host->i_ino, dentry, size);
-
err = check_namespace(&nm);
if (err < 0)
return err;
@@ -429,6 +426,15 @@ out_unlock:
return err;
}
+ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf,
+ size_t size)
+{
+ dbg_gen("xattr '%s', ino %lu ('%pd'), buf size %zd", name,
+ dentry->d_inode->i_ino, dentry, size);
+
+ return __ubifs_getxattr(dentry->d_inode, name, buf, size);
+}
+
ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size)
{
union ubifs_key key;
@@ -638,7 +644,8 @@ static int init_xattrs(struct inode *inode, const struct xattr *xattr_array,
}
strcpy(name, XATTR_SECURITY_PREFIX);
strcpy(name + XATTR_SECURITY_PREFIX_LEN, xattr->name);
- err = setxattr(inode, name, xattr->value, xattr->value_len, 0);
+ err = __ubifs_setxattr(inode, name, xattr->value,
+ xattr->value_len, 0);
kfree(name);
if (err < 0)
break;
--
1.8.3.4
next prev parent reply other threads:[~2015-03-25 11:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 11:46 [RFC PATCH 0/3] UBIFS: add ACL support Sheng Yong
2015-03-25 11:46 ` Sheng Yong [this message]
2015-03-25 11:46 ` [RFC PATCH 2/3] UBIFS: ACL: " Sheng Yong
2015-04-07 1:14 ` Sheng Yong
2015-03-25 11:46 ` [RFC PATCH 3/3] UBIFS: ACL: add ACL config option Sheng Yong
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=1427283965-86137-2-git-send-email-shengyong1@huawei.com \
--to=shengyong1@huawei.com \
--cc=adrian.hunter@intel.com \
--cc=dedekind1@gmail.com \
--cc=hujianyang@huawei.com \
--cc=linux-mtd@lists.infradead.org \
--cc=miaoxie@huawei.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).