aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2014-02-12 09:29:48 -0500
committerTejun Heo <tj@kernel.org>2014-02-12 09:29:48 -0500
commit80b13586997d8e584caa772bd99e2a3e55ac6abe (patch)
treeced02346669ef3d032ffe6a4a8f4d064fd46840c /kernel/cgroup.c
parent86bf4b68759141459864ebd36ac3038a9cda895b (diff)
cgroup: relocate cgroup_rm_cftypes()
cftype handling is about to be revamped. Relocate cgroup_rm_cftypes() above cgroup_add_cftypes() in preparation. This is pure relocation. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index a0fab71f200f..a2cbd1549995 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2418,6 +2418,41 @@ static int cgroup_init_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
2418} 2418}
2419 2419
2420/** 2420/**
2421 * cgroup_rm_cftypes - remove an array of cftypes from a subsystem
2422 * @cfts: zero-length name terminated array of cftypes
2423 *
2424 * Unregister @cfts. Files described by @cfts are removed from all
2425 * existing cgroups and all future cgroups won't have them either. This
2426 * function can be called anytime whether @cfts' subsys is attached or not.
2427 *
2428 * Returns 0 on successful unregistration, -ENOENT if @cfts is not
2429 * registered.
2430 */
2431int cgroup_rm_cftypes(struct cftype *cfts)
2432{
2433 struct cftype *found = NULL;
2434 struct cftype_set *set;
2435
2436 if (!cfts || !cfts[0].ss)
2437 return -ENOENT;
2438
2439 cgroup_cfts_prepare();
2440
2441 list_for_each_entry(set, &cfts[0].ss->cftsets, node) {
2442 if (set->cfts == cfts) {
2443 list_del(&set->node);
2444 kfree(set);
2445 found = cfts;
2446 break;
2447 }
2448 }
2449
2450 cgroup_cfts_commit(found, false);
2451 cgroup_exit_cftypes(cfts);
2452 return found ? 0 : -ENOENT;
2453}
2454
2455/**
2421 * cgroup_add_cftypes - add an array of cftypes to a subsystem 2456 * cgroup_add_cftypes - add an array of cftypes to a subsystem
2422 * @ss: target cgroup subsystem 2457 * @ss: target cgroup subsystem
2423 * @cfts: zero-length name terminated array of cftypes 2458 * @cfts: zero-length name terminated array of cftypes
@@ -2455,41 +2490,6 @@ int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
2455EXPORT_SYMBOL_GPL(cgroup_add_cftypes); 2490EXPORT_SYMBOL_GPL(cgroup_add_cftypes);
2456 2491
2457/** 2492/**
2458 * cgroup_rm_cftypes - remove an array of cftypes from a subsystem
2459 * @cfts: zero-length name terminated array of cftypes
2460 *
2461 * Unregister @cfts. Files described by @cfts are removed from all
2462 * existing cgroups and all future cgroups won't have them either. This
2463 * function can be called anytime whether @cfts' subsys is attached or not.
2464 *
2465 * Returns 0 on successful unregistration, -ENOENT if @cfts is not
2466 * registered.
2467 */
2468int cgroup_rm_cftypes(struct cftype *cfts)
2469{
2470 struct cftype *found = NULL;
2471 struct cftype_set *set;
2472
2473 if (!cfts || !cfts[0].ss)
2474 return -ENOENT;
2475
2476 cgroup_cfts_prepare();
2477
2478 list_for_each_entry(set, &cfts[0].ss->cftsets, node) {
2479 if (set->cfts == cfts) {
2480 list_del(&set->node);
2481 kfree(set);
2482 found = cfts;
2483 break;
2484 }
2485 }
2486
2487 cgroup_cfts_commit(found, false);
2488 cgroup_exit_cftypes(cfts);
2489 return found ? 0 : -ENOENT;
2490}
2491
2492/**
2493 * cgroup_task_count - count the number of tasks in a cgroup. 2493 * cgroup_task_count - count the number of tasks in a cgroup.
2494 * @cgrp: the cgroup in question 2494 * @cgrp: the cgroup in question
2495 * 2495 *