cgroups: add documentation on extended attributes and simple_xattr functions
Subsystems (3)
v2 cover cgroups: add documentation on extended attributes and simple_xattr functions
cgroups: add documentation on extended attributes and simple_xattr functions
These patches add documentation on the new functions and current specific cgroup usage.
v2: include Li Zefan's requested changes
Signature · 1 line
Aristeu
PATCH v2 1/2 cgroups: add documentation on extended attributes usage
v2: update cgroups.txt instead of creating a new file
--- Documentation/cgroups/cgroups.txt | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
Documentation/cgroups/cgroups.txt +22 -2
@@ -29,7 +29,8 @@ 3.1 Overview 3.2 Synchronization 3.3 Subsystem API -4. Questions +4. Extended attributes usage +5. Questions 1. Control Groups =================
@@ -650,7 +651,26 @@ the default hierarchy (which never has sub-cgroups) and a hierarchy that is being created/destroyed (and hence has no sub-cgroups). -4. Questions +4. Extended attribute usage +=========================== + +cgroup filesystem supports certain types of extended attributes in its +directories and files. The current supported types are: + - Trusted (XATTR_TRUSTED) + - Security (XATTR_SECURITY) + +Both require CAP_SYS_ADMIN capability to set. + +Like in tmpfs, the extended attributes in cgroup filesystem are stored +using kernel memory and it's advised to keep the usage at minimum. This +is the reason why user defined extended attributes are not supported, since +any user can do it and there's no limit in the value size. + +The current known users for this feature are SELinux to limit cgroup usage +in containers and systemd for assorted meta data like main PID in a cgroup +(systemd creates a cgroup per service). + +5. Questions ============ Q: what's up with this '/bin/echo' ?
Re: [PATCH v2 1/2] cgroups: add documentation on extended attributes usage
Quoted 9 lines
v2: update cgroups.txt instead of creating a new file
Cc Li Zefan <[email protected]>Cc Tejun Heo <[email protected]>Cc Hugh Dickins <[email protected]>Cc Hillf Danton <[email protected]>Cc Lennart Poettering <[email protected]>Signed-off-by Aristeu Rozanski <[email protected]>
Quoted 3 lines
--- Documentation/cgroups/cgroups.txt | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
PATCH v2 2/2 fs: add missing documentation to simple_xattr functions
In reply to Aristeu Rozanskiv2: add function documentation instead of adding a separate file under
Documentation/
--- fs/xattr.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
fs/xattr.c +16 -2
@@ -892,8 +892,19 @@ } -/* -* xattr SET operation for in-memory/pseudo filesystems +/** +* simple_xattr_set: xattr SET operation for in-memory/pseudo filesystems +* @xattrs: simple_xattr list +* @name: name of the new extended attribute +* @value: value of the new extended attribute. If NULL, will remove the +* attribute +* @flags: if XATTR_CREATE is set, no already existing extended attribute may +* exist. If XATTR_REPLACE is set, the extended attribute should exist. +* +* returns -ENOMEM for allocation failures, -EEXIST in case XATTR_CREATE is +* set in flags and an extended attribute with the same name exists, +* -ENODATA if XATTR_REPLACE is set in flags but no entry with the +* specified name exists. */ int simple_xattr_set (struct simple_xattrs *xattrs,const char *name,const void *value,size_t size,int flags)
@@ -950,6 +961,9 @@return used; } +/* +* Adds an extended attribute to the list +*/ void simple_xattr_list_add (struct simple_xattrs *xattrs,struct simple_xattr *new_xattr) {
Re: [PATCH v2 2/2] fs: add missing documentation to simple_xattr functions
On 09/11/2012 01:28 PM, Aristeu Rozanski wrote:
+/**
+ * simple_xattr_set: xattr SET operation for in-memory/pseudo filesystems
The format for the function name/description uses '-', not ':', as:
* simple_xattr_set - xattr SET operation for in-memory/pseudo filesystems
+ * @xattrs: simple_xattr list
+ * @name: name of the new extended attribute
+ * @value: value of the new extended attribute. If NULL, will remove the
+ * attribute
Missing @size parameter description.
+ * @flags: if XATTR_CREATE is set, no already existing extended attribute may
+ * exist. If XATTR_REPLACE is set, the extended attribute should exist.
+ *
+ * returns -ENOMEM for allocation failures, -EEXIST in case XATTR_CREATE is
+ * set in flags and an extended attribute with the same name exists, + * -ENODATA if XATTR_REPLACE is set in flags but no entry with the + * specified name exists.
*/
int simple_xattr_set(struct simple_xattrs *xattrs, const char *name,
const void *value, size_t size, int flags)
Signature · 1 line
~Randy
Tejun Heo
maintainerRe: [PATCH v2 2/2] fs: add missing documentation to simple_xattr functions
Quoted 8 lines · Randy Dunlap
On 09/11/2012 01:28 PM, Aristeu Rozanski wrote:
+/**
+ *simple_xattr_set: xattr SET operation for in-memory/pseudo filesystemsThe format for the function name/description uses '-', not ':', as:
Quoted 8 lines
*
simple_xattr_set- xattr SET operation for in-memory/pseudo filesystems+ * @xattrs:
simple_xattrlist
+ * @name: name of the new extended attribute
+ * @value: value of the new extended attribute. If NULL, will remove the
+ * attributeMissing @size parameter description.
Updated the patch in place accordingly. Thanks.
From 4895768b6aab55bbdbebcf2da090cb1a5ccf5463 Mon Sep 17 00:00:00 2001
From: Aristeu Rozanski <[email protected]>
Date: Tue, 11 Sep 2012 16:28:11 -0400
Subject: [PATCH] fs: add missing documentation to simple_xattr functions
v2: add function documentation instead of adding a separate file under
Documentation/
tj: Updated comment a bit and rolled in Randy's suggestions.
--- fs/xattr.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
fs/xattr.c +16 -2
@@ -892,8 +892,19 @@ out: } -/* -* xattr SET operation for in-memory/pseudo filesystems +/** +* simple_xattr_set - xattr SET operation for in-memory/pseudo filesystems +* @xattrs: target simple_xattr list +* @name: name of the new extended attribute +* @value: value of the new xattr. If %NULL, will remove the attribute +* @size: size of the new xattr +* @flags: %XATTR_{CREATE|REPLACE} +* +* %XATTR_CREATE is set, the xattr shouldn't exist already; otherwise fails +* with -EEXIST. If %XATTR_REPLACE is set, the xattr should exist; +* otherwise, fails with -ENODATA. +* +* Returns 0 on success, -errno on failure. */ int simple_xattr_set (struct simple_xattrs *xattrs,const char *name,const void *value,size_t size,int flags)
@@ -950,6 +961,9 @@ ssize_t simple_xattr_list(struct simple_xattrs *xattrs, char *buffer,return used; } +/* +* Adds an extended attribute to the list +*/ void simple_xattr_list_add (struct simple_xattrs *xattrs,struct simple_xattr *new_xattr) {
Signature · 1 line
1.7.7.3
Re: [PATCH v2 2/2] fs: add missing documentation to simple_xattr functions
Quoted 11 lines · Tejun Heo
Updated the patch in place accordingly. Thanks.
From
4895768b6aab55bbdbebcf2da090cb1a5ccf5463Mon Sep 17 00:00:00 2001
From: Aristeu Rozanski <[email protected]>
Date: Tue, 11 Sep 2012 16:28:11 -0400
Subject: [PATCH] fs: add missing documentation tosimple_xattrfunctionsv2: add function documentation instead of adding a separate file under
Documentation/tj: Updated comment a bit and rolled in Randy's suggestions.
Thanks Tejun, Randy
Signature · 1 line
Aristeu
Quoted 6 lines · Aristeu Rozanski
cgroups: add documentation on extended attributes and
simple_xattrfunctionsThese patches add documentation on the new functions and current specific cgroup usage.
v2: include Li Zefan's requested changes
Applied to for-3.7. Thanks!
Signature · 1 line
tejun