diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2016-09-29 17:48:42 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-10-07 20:10:44 -0400 |
commit | 5d6c31910bc0713e37628dc0ce677dcb13c8ccf4 (patch) | |
tree | a28f96e71f09da2fbbde50882d56e5d5657c0ede /fs/ecryptfs/inode.c | |
parent | f5c244383725a6de06bc62fa7c54c0ea0d942eec (diff) | |
download | linux-stable-5d6c31910bc0713e37628dc0ce677dcb13c8ccf4.tar.gz linux-stable-5d6c31910bc0713e37628dc0ce677dcb13c8ccf4.tar.bz2 linux-stable-5d6c31910bc0713e37628dc0ce677dcb13c8ccf4.zip |
xattr: Add __vfs_{get,set,remove}xattr helpers
Right now, various places in the kernel check for the existence of
getxattr, setxattr, and removexattr inode operations and directly call
those operations. Switch to helper functions and test for the IOP_XATTR
flag instead.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Acked-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ecryptfs/inode.c')
-rw-r--r-- | fs/ecryptfs/inode.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index cef32ccc3fcb..32fee255d7b5 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -1005,15 +1005,14 @@ ecryptfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags) { - int rc = 0; + int rc; struct dentry *lower_dentry; lower_dentry = ecryptfs_dentry_to_lower(dentry); - if (!d_inode(lower_dentry)->i_op->setxattr) { + if (!(d_inode(lower_dentry)->i_opflags & IOP_XATTR)) { rc = -EOPNOTSUPP; goto out; } - rc = vfs_setxattr(lower_dentry, name, value, size, flags); if (!rc && inode) fsstack_copy_attr_all(inode, d_inode(lower_dentry)); @@ -1025,15 +1024,14 @@ ssize_t ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode, const char *name, void *value, size_t size) { - int rc = 0; + int rc; - if (!lower_inode->i_op->getxattr) { + if (!(lower_inode->i_opflags & IOP_XATTR)) { rc = -EOPNOTSUPP; goto out; } inode_lock(lower_inode); - rc = lower_inode->i_op->getxattr(lower_dentry, lower_inode, - name, value, size); + rc = __vfs_getxattr(lower_dentry, lower_inode, name, value, size); inode_unlock(lower_inode); out: return rc; @@ -1069,18 +1067,18 @@ out: static int ecryptfs_removexattr(struct dentry *dentry, struct inode *inode, const char *name) { - int rc = 0; + int rc; struct dentry *lower_dentry; struct inode *lower_inode; lower_dentry = ecryptfs_dentry_to_lower(dentry); lower_inode = ecryptfs_inode_to_lower(inode); - if (!lower_inode->i_op->removexattr) { + if (!(lower_inode->i_opflags & IOP_XATTR)) { rc = -EOPNOTSUPP; goto out; } inode_lock(lower_inode); - rc = lower_inode->i_op->removexattr(lower_dentry, name); + rc = __vfs_removexattr(lower_dentry, name); inode_unlock(lower_inode); out: return rc; |