summaryrefslogtreecommitdiffstats
path: root/fs/kernfs/kernfs-internal.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-23 23:40:02 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-04 16:34:45 +0100
commit2322392b020badfe49730f1529b9c1a15248c387 (patch)
treeda17c0d183045351ae25f8173f2c0cfd7c7b8a55 /fs/kernfs/kernfs-internal.h
parentkernfs: update sysfs_init_inode_attrs() (diff)
downloadlinux-2322392b020badfe49730f1529b9c1a15248c387.tar.xz
linux-2322392b020badfe49730f1529b9c1a15248c387.zip
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 <tj@kernel.org> Cc: David P. Quigley <dpquigl@tycho.nsa.gov> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs/kernfs-internal.h')
-rw-r--r--fs/kernfs/kernfs-internal.h7
1 files changed, 7 insertions, 0 deletions
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 <linux/lockdep.h>
#include <linux/fs.h>
#include <linux/mutex.h>
+#include <linux/xattr.h>
#include <linux/kernfs.h>
@@ -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);
/*