aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-04-14 23:15:25 -0400
committerTejun Heo <tj@kernel.org>2013-04-14 23:15:25 -0400
commit25a7e6848db76e22677aff202d9c4ef3503be15b (patch)
treee3f944266f4a6ded61ce5d88a5c2c9c33794c366
parent9343862945fdd3dd5cb7648bb24cabe40faa9ad9 (diff)
move cgroupfs_root to include/linux/cgroup.h
While controllers shouldn't be accessing cgroupfs_root directly, it being hidden inside kern/cgroup.c makes somethings pretty silly. This makes routing hierarchy-wide settings which need to be visible to controllers cumbersome. We're gonna add another hierarchy-wide setting which needs to be accessed from controllers. Move cgroupfs_root and its flags to the header file so that we can access root settings with inline helpers. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com> Acked-by: Li Zefan <lizefan@huawei.com>
-rw-r--r--include/linux/cgroup.h57
-rw-r--r--kernel/cgroup.c57
2 files changed, 57 insertions, 57 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 45aee0fc6b98..b21881e1ea08 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -19,6 +19,7 @@
19#include <linux/idr.h> 19#include <linux/idr.h>
20#include <linux/workqueue.h> 20#include <linux/workqueue.h>
21#include <linux/xattr.h> 21#include <linux/xattr.h>
22#include <linux/fs.h>
22 23
23#ifdef CONFIG_CGROUPS 24#ifdef CONFIG_CGROUPS
24 25
@@ -238,6 +239,62 @@ struct cgroup {
238 struct simple_xattrs xattrs; 239 struct simple_xattrs xattrs;
239}; 240};
240 241
242#define MAX_CGROUP_ROOT_NAMELEN 64
243
244/* cgroupfs_root->flags */
245enum {
246 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */
247 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */
248};
249
250/*
251 * A cgroupfs_root represents the root of a cgroup hierarchy, and may be
252 * associated with a superblock to form an active hierarchy. This is
253 * internal to cgroup core. Don't access directly from controllers.
254 */
255struct cgroupfs_root {
256 struct super_block *sb;
257
258 /*
259 * The bitmask of subsystems intended to be attached to this
260 * hierarchy
261 */
262 unsigned long subsys_mask;
263
264 /* Unique id for this hierarchy. */
265 int hierarchy_id;
266
267 /* The bitmask of subsystems currently attached to this hierarchy */
268 unsigned long actual_subsys_mask;
269
270 /* A list running through the attached subsystems */
271 struct list_head subsys_list;
272
273 /* The root cgroup for this hierarchy */
274 struct cgroup top_cgroup;
275
276 /* Tracks how many cgroups are currently defined in hierarchy.*/
277 int number_of_cgroups;
278
279 /* A list running through the active hierarchies */
280 struct list_head root_list;
281
282 /* All cgroups on this root, cgroup_mutex protected */
283 struct list_head allcg_list;
284
285 /* Hierarchy-specific flags */
286 unsigned long flags;
287
288 /* IDs for cgroups in this hierarchy */
289 struct ida cgroup_ida;
290
291 /* The path to use for release notifications. */
292 char release_agent_path[PATH_MAX];
293
294 /* The name for this hierarchy - may be empty */
295 char name[MAX_CGROUP_ROOT_NAMELEN];
296};
297
241/* 298/*
242 * A css_set is a structure holding pointers to a set of 299 * A css_set is a structure holding pointers to a set of
243 * cgroup_subsys_state objects. This saves space in the task struct 300 * cgroup_subsys_state objects. This saves space in the task struct
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 67428d84e38b..8b8eb7c168ff 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -30,7 +30,6 @@
30#include <linux/cred.h> 30#include <linux/cred.h>
31#include <linux/ctype.h> 31#include <linux/ctype.h>
32#include <linux/errno.h> 32#include <linux/errno.h>
33#include <linux/fs.h>
34#include <linux/init_task.h> 33#include <linux/init_task.h>
35#include <linux/kernel.h> 34#include <linux/kernel.h>
36#include <linux/list.h> 35#include <linux/list.h>
@@ -104,56 +103,6 @@ static struct cgroup_subsys *subsys[CGROUP_SUBSYS_COUNT] = {
104#include <linux/cgroup_subsys.h> 103#include <linux/cgroup_subsys.h>
105}; 104};
106 105
107#define MAX_CGROUP_ROOT_NAMELEN 64
108
109/*
110 * A cgroupfs_root represents the root of a cgroup hierarchy,
111 * and may be associated with a superblock to form an active
112 * hierarchy
113 */
114struct cgroupfs_root {
115 struct super_block *sb;
116
117 /*
118 * The bitmask of subsystems intended to be attached to this
119 * hierarchy
120 */
121 unsigned long subsys_mask;
122
123 /* Unique id for this hierarchy. */
124 int hierarchy_id;
125
126 /* The bitmask of subsystems currently attached to this hierarchy */
127 unsigned long actual_subsys_mask;
128
129 /* A list running through the attached subsystems */
130 struct list_head subsys_list;
131
132 /* The root cgroup for this hierarchy */
133 struct cgroup top_cgroup;
134
135 /* Tracks how many cgroups are currently defined in hierarchy.*/
136 int number_of_cgroups;
137
138 /* A list running through the active hierarchies */
139 struct list_head root_list;
140
141 /* All cgroups on this root, cgroup_mutex protected */
142 struct list_head allcg_list;
143
144 /* Hierarchy-specific flags */
145 unsigned long flags;
146
147 /* IDs for cgroups in this hierarchy */
148 struct ida cgroup_ida;
149
150 /* The path to use for release notifications. */
151 char release_agent_path[PATH_MAX];
152
153 /* The name for this hierarchy - may be empty */
154 char name[MAX_CGROUP_ROOT_NAMELEN];
155};
156
157/* 106/*
158 * The "rootnode" hierarchy is the "dummy hierarchy", reserved for the 107 * The "rootnode" hierarchy is the "dummy hierarchy", reserved for the
159 * subsystems that are otherwise unattached - it never has more than a 108 * subsystems that are otherwise unattached - it never has more than a
@@ -296,12 +245,6 @@ bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor)
296} 245}
297EXPORT_SYMBOL_GPL(cgroup_is_descendant); 246EXPORT_SYMBOL_GPL(cgroup_is_descendant);
298 247
299/* cgroupfs_root->flags */
300enum {
301 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */
302 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */
303};
304
305static int cgroup_is_releasable(const struct cgroup *cgrp) 248static int cgroup_is_releasable(const struct cgroup *cgrp)
306{ 249{
307 const int bits = 250 const int bits =