From aa7c5241c380adb7e6913549292c1b83c1469bda Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Wed, 2 Dec 2015 14:44:38 +0100 Subject: tmpfs: Use xattr handler infrastructure Use the VFS xattr handler infrastructure and get rid of similar code in the filesystem. For implementing shmem_xattr_handler_set, we need a version of simple_xattr_set which removes the attribute when value is NULL. Use this to implement kernfs_iop_removexattr as well. Signed-off-by: Andreas Gruenbacher Reviewed-by: James Morris Cc: Hugh Dickins Cc: linux-mm@kvack.org Signed-off-by: Al Viro --- fs/kernfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/kernfs') diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index 756dd56aaf60..f97e1f7790b1 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c @@ -205,7 +205,7 @@ int kernfs_iop_removexattr(struct dentry *dentry, const char *name) if (!attrs) return -ENOMEM; - return simple_xattr_remove(&attrs->xattrs, name); + return simple_xattr_set(&attrs->xattrs, name, NULL, 0, XATTR_REPLACE); } ssize_t kernfs_iop_getxattr(struct dentry *dentry, const char *name, void *buf, -- cgit From 786534b92f3ce68f4afc8a761c80b76887797b0a Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Wed, 2 Dec 2015 14:44:39 +0100 Subject: tmpfs: listxattr should include POSIX ACL xattrs When a file on tmpfs has an ACL or a Default ACL, listxattr should include the corresponding xattr name. Signed-off-by: Andreas Gruenbacher Reviewed-by: James Morris Cc: Hugh Dickins Cc: linux-mm@kvack.org Signed-off-by: Al Viro --- fs/kernfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/kernfs') diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index f97e1f7790b1..16405ae88d2d 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c @@ -230,7 +230,7 @@ ssize_t kernfs_iop_listxattr(struct dentry *dentry, char *buf, size_t size) if (!attrs) return -ENOMEM; - return simple_xattr_list(&attrs->xattrs, buf, size); + return simple_xattr_list(d_inode(dentry), &attrs->xattrs, buf, size); } static inline void set_default_inode_attr(struct inode *inode, umode_t mode) -- cgit