]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
cgroup: implement CFTYPE_NO_PREFIX
authorTejun Heo <tj@kernel.org>
Mon, 26 Aug 2013 22:40:56 +0000 (18:40 -0400)
committerTejun Heo <tj@kernel.org>
Mon, 26 Aug 2013 22:40:56 +0000 (18:40 -0400)
When cgroup files are created, cgroup core automatically prepends the
name of the subsystem as prefix.  This patch adds CFTYPE_NO_ which
disables the automatic prefix.  This is to work around historical
baggages and shouldn't be used for new files.

This will be used to move "cgroup.event_control" from cgroup core to
memcg.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Glauber Costa <glommer@gmail.com>
include/linux/cgroup.h
kernel/cgroup.c

index 21ba29869eb8787af242551795df80c50e6a4338..3561d305b1e0a2108f79030d0d8b3525db966bad 100644 (file)
@@ -411,6 +411,7 @@ enum {
        CFTYPE_ONLY_ON_ROOT     = (1 << 0),     /* only create on root cgrp */
        CFTYPE_NOT_ON_ROOT      = (1 << 1),     /* don't create on root cgrp */
        CFTYPE_INSANE           = (1 << 2),     /* don't create if sane_behavior */
+       CFTYPE_NO_PREFIX        = (1 << 3),     /* (DON'T USE FOR NEW FILES) no subsys prefix */
 };
 
 #define MAX_CFTYPE_NAME                64
index 7516668d8325729879c8e78640134c3d00c326fa..a41dc87cd07e77a24e5803c53b1b50282d1ff101 100644 (file)
@@ -2756,7 +2756,8 @@ static int cgroup_add_file(struct cgroup *cgrp, struct cftype *cft)
        umode_t mode;
        char name[MAX_CGROUP_TYPE_NAMELEN + MAX_CFTYPE_NAME + 2] = { 0 };
 
-       if (cft->ss && !(cgrp->root->flags & CGRP_ROOT_NOPREFIX)) {
+       if (cft->ss && !(cft->flags & CFTYPE_NO_PREFIX) &&
+           !(cgrp->root->flags & CGRP_ROOT_NOPREFIX)) {
                strcpy(name, cft->ss->name);
                strcat(name, ".");
        }