]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
cgroup: implement CFTYPE_ONLY_ON_DFL
authorTejun Heo <tj@kernel.org>
Wed, 19 Mar 2014 14:23:55 +0000 (10:23 -0400)
committerTejun Heo <tj@kernel.org>
Wed, 19 Mar 2014 14:23:55 +0000 (10:23 -0400)
This cftype flag makes the file only appear on the default hierarchy.
This will later be used for cgroup.controllers file.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
include/linux/cgroup.h
kernel/cgroup.c

index 7e9fa505b7bbb31d078c37110509c14006c2416a..43d1ed30bae3a76ce83b1007886d813c561419b1 100644 (file)
@@ -384,6 +384,7 @@ enum {
        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 */
+       CFTYPE_ONLY_ON_DFL      = (1 << 4),     /* only on default hierarchy */
 };
 
 #define MAX_CFTYPE_NAME                64
index 69b4939e9f6dfc9c8fce1ca73ef917ac157b0a13..37b6d534b0cab8c7b8084b7d1b43b67cbc9c66fc 100644 (file)
@@ -2356,6 +2356,8 @@ static int cgroup_addrm_files(struct cgroup *cgrp, struct cftype cfts[],
 
        for (cft = cfts; cft->name[0] != '\0'; cft++) {
                /* does cft->flags tell us to skip this file on @cgrp? */
+               if ((cft->flags & CFTYPE_ONLY_ON_DFL) && !cgroup_on_dfl(cgrp))
+                       continue;
                if ((cft->flags & CFTYPE_INSANE) && cgroup_sane_behavior(cgrp))
                        continue;
                if ((cft->flags & CFTYPE_NOT_ON_ROOT) && !cgrp->parent)