aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-06-03 22:14:34 -0400
committerTejun Heo <tj@kernel.org>2013-06-05 15:00:33 -0400
commitd5c56ced775f6bdc32b689b01c9c4f9b66e18610 (patch)
treee9b82f9fa20c1babd4477ad88595c27f10422b28 /kernel/cgroup.c
parentcc5943a7816ba6c00639837a62131386619548dc (diff)
cgroup: clean up the cftype array for the base cgroup files
* Rename it from files[] (really?) to cgroup_base_files[]. * Drop CGROUP_FILE_GENERIC_PREFIX which was defined as "cgroup." and used inconsistently. Just use "cgroup." directly. * Collect insane files at the end. Note that only the insane ones are missing "cgroup." prefix. This patch doesn't introduce any functional changes. 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.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index b3bb8a393642..bc53d5014b28 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4029,35 +4029,16 @@ static int cgroup_clone_children_write(struct cgroup *cgrp,
4029 return 0; 4029 return 0;
4030} 4030}
4031 4031
4032/* 4032static struct cftype cgroup_base_files[] = {
4033 * for the common functions, 'private' gives the type of file
4034 */
4035/* for hysterical raisins, we can't put this on the older files */
4036#define CGROUP_FILE_GENERIC_PREFIX "cgroup."
4037static struct cftype files[] = {
4038 { 4033 {
4039 .name = "tasks", 4034 .name = "cgroup.procs",
4040 .flags = CFTYPE_INSANE, /* use "procs" instead */
4041 .open = cgroup_tasks_open,
4042 .write_u64 = cgroup_tasks_write,
4043 .release = cgroup_pidlist_release,
4044 .mode = S_IRUGO | S_IWUSR,
4045 },
4046 {
4047 .name = CGROUP_FILE_GENERIC_PREFIX "procs",
4048 .open = cgroup_procs_open, 4035 .open = cgroup_procs_open,
4049 .write_u64 = cgroup_procs_write, 4036 .write_u64 = cgroup_procs_write,
4050 .release = cgroup_pidlist_release, 4037 .release = cgroup_pidlist_release,
4051 .mode = S_IRUGO | S_IWUSR, 4038 .mode = S_IRUGO | S_IWUSR,
4052 }, 4039 },
4053 { 4040 {
4054 .name = "notify_on_release", 4041 .name = "cgroup.event_control",
4055 .flags = CFTYPE_INSANE,
4056 .read_u64 = cgroup_read_notify_on_release,
4057 .write_u64 = cgroup_write_notify_on_release,
4058 },
4059 {
4060 .name = CGROUP_FILE_GENERIC_PREFIX "event_control",
4061 .write_string = cgroup_write_event_control, 4042 .write_string = cgroup_write_event_control,
4062 .mode = S_IWUGO, 4043 .mode = S_IWUGO,
4063 }, 4044 },
@@ -4072,6 +4053,26 @@ static struct cftype files[] = {
4072 .flags = CFTYPE_ONLY_ON_ROOT, 4053 .flags = CFTYPE_ONLY_ON_ROOT,
4073 .read_seq_string = cgroup_sane_behavior_show, 4054 .read_seq_string = cgroup_sane_behavior_show,
4074 }, 4055 },
4056
4057 /*
4058 * Historical crazy stuff. These don't have "cgroup." prefix and
4059 * don't exist if sane_behavior. If you're depending on these, be
4060 * prepared to be burned.
4061 */
4062 {
4063 .name = "tasks",
4064 .flags = CFTYPE_INSANE, /* use "procs" instead */
4065 .open = cgroup_tasks_open,
4066 .write_u64 = cgroup_tasks_write,
4067 .release = cgroup_pidlist_release,
4068 .mode = S_IRUGO | S_IWUSR,
4069 },
4070 {
4071 .name = "notify_on_release",
4072 .flags = CFTYPE_INSANE,
4073 .read_u64 = cgroup_read_notify_on_release,
4074 .write_u64 = cgroup_write_notify_on_release,
4075 },
4075 { 4076 {
4076 .name = "release_agent", 4077 .name = "release_agent",
4077 .flags = CFTYPE_INSANE | CFTYPE_ONLY_ON_ROOT, 4078 .flags = CFTYPE_INSANE | CFTYPE_ONLY_ON_ROOT,
@@ -4095,7 +4096,7 @@ static int cgroup_populate_dir(struct cgroup *cgrp, bool base_files,
4095 struct cgroup_subsys *ss; 4096 struct cgroup_subsys *ss;
4096 4097
4097 if (base_files) { 4098 if (base_files) {
4098 err = cgroup_addrm_files(cgrp, NULL, files, true); 4099 err = cgroup_addrm_files(cgrp, NULL, cgroup_base_files, true);
4099 if (err < 0) 4100 if (err < 0)
4100 return err; 4101 return err;
4101 } 4102 }