From 2322392b020badfe49730f1529b9c1a15248c387 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Sat, 23 Nov 2013 17:40:02 -0500 Subject: kernfs: implement "trusted.*" xattr support kernfs inherited "security.*" xattr support from sysfs. This patch extends xattr support to "trusted.*" using simple_xattr_*(). As trusted xattrs are restricted to CAP_SYS_ADMIN, simple_xattr_*() which uses kernel memory for storage shouldn't be problematic. Note that the existing "security.*" support doesn't implement get/remove/list and the this patch only implements those ops for "trusted.*". We probably want to extend those ops to include support for "security.*". This patch will allow using kernfs from cgroup which requires "trusted.*" xattr support. Signed-off-by: Tejun Heo Cc: David P. Quigley Signed-off-by: Greg Kroah-Hartman --- fs/kernfs/kernfs-internal.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'fs/kernfs/kernfs-internal.h') diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h index f25b3548bcca..910e485b7333 100644 --- a/fs/kernfs/kernfs-internal.h +++ b/fs/kernfs/kernfs-internal.h @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -21,6 +22,8 @@ struct sysfs_inode_attrs { struct iattr ia_iattr; void *ia_secdata; u32 ia_secdata_len; + + struct simple_xattrs xattrs; }; #define SD_DEACTIVATED_BIAS INT_MIN @@ -81,6 +84,10 @@ int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags); +int sysfs_removexattr(struct dentry *dentry, const char *name); +ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf, + size_t size); +ssize_t sysfs_listxattr(struct dentry *dentry, char *buf, size_t size); void sysfs_inode_init(void); /* -- cgit v1.2.3-59-g8ed1b