mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 15:10:38 +00:00
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>
This commit is contained in:
parent
cc5943a781
commit
d5c56ced77
@ -4029,35 +4029,16 @@ static int cgroup_clone_children_write(struct cgroup *cgrp,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static struct cftype cgroup_base_files[] = {
|
||||||
* for the common functions, 'private' gives the type of file
|
|
||||||
*/
|
|
||||||
/* for hysterical raisins, we can't put this on the older files */
|
|
||||||
#define CGROUP_FILE_GENERIC_PREFIX "cgroup."
|
|
||||||
static struct cftype files[] = {
|
|
||||||
{
|
{
|
||||||
.name = "tasks",
|
.name = "cgroup.procs",
|
||||||
.flags = CFTYPE_INSANE, /* use "procs" instead */
|
|
||||||
.open = cgroup_tasks_open,
|
|
||||||
.write_u64 = cgroup_tasks_write,
|
|
||||||
.release = cgroup_pidlist_release,
|
|
||||||
.mode = S_IRUGO | S_IWUSR,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = CGROUP_FILE_GENERIC_PREFIX "procs",
|
|
||||||
.open = cgroup_procs_open,
|
.open = cgroup_procs_open,
|
||||||
.write_u64 = cgroup_procs_write,
|
.write_u64 = cgroup_procs_write,
|
||||||
.release = cgroup_pidlist_release,
|
.release = cgroup_pidlist_release,
|
||||||
.mode = S_IRUGO | S_IWUSR,
|
.mode = S_IRUGO | S_IWUSR,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "notify_on_release",
|
.name = "cgroup.event_control",
|
||||||
.flags = CFTYPE_INSANE,
|
|
||||||
.read_u64 = cgroup_read_notify_on_release,
|
|
||||||
.write_u64 = cgroup_write_notify_on_release,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = CGROUP_FILE_GENERIC_PREFIX "event_control",
|
|
||||||
.write_string = cgroup_write_event_control,
|
.write_string = cgroup_write_event_control,
|
||||||
.mode = S_IWUGO,
|
.mode = S_IWUGO,
|
||||||
},
|
},
|
||||||
@ -4072,6 +4053,26 @@ static struct cftype files[] = {
|
|||||||
.flags = CFTYPE_ONLY_ON_ROOT,
|
.flags = CFTYPE_ONLY_ON_ROOT,
|
||||||
.read_seq_string = cgroup_sane_behavior_show,
|
.read_seq_string = cgroup_sane_behavior_show,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Historical crazy stuff. These don't have "cgroup." prefix and
|
||||||
|
* don't exist if sane_behavior. If you're depending on these, be
|
||||||
|
* prepared to be burned.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
.name = "tasks",
|
||||||
|
.flags = CFTYPE_INSANE, /* use "procs" instead */
|
||||||
|
.open = cgroup_tasks_open,
|
||||||
|
.write_u64 = cgroup_tasks_write,
|
||||||
|
.release = cgroup_pidlist_release,
|
||||||
|
.mode = S_IRUGO | S_IWUSR,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "notify_on_release",
|
||||||
|
.flags = CFTYPE_INSANE,
|
||||||
|
.read_u64 = cgroup_read_notify_on_release,
|
||||||
|
.write_u64 = cgroup_write_notify_on_release,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "release_agent",
|
.name = "release_agent",
|
||||||
.flags = CFTYPE_INSANE | CFTYPE_ONLY_ON_ROOT,
|
.flags = CFTYPE_INSANE | CFTYPE_ONLY_ON_ROOT,
|
||||||
@ -4095,7 +4096,7 @@ static int cgroup_populate_dir(struct cgroup *cgrp, bool base_files,
|
|||||||
struct cgroup_subsys *ss;
|
struct cgroup_subsys *ss;
|
||||||
|
|
||||||
if (base_files) {
|
if (base_files) {
|
||||||
err = cgroup_addrm_files(cgrp, NULL, files, true);
|
err = cgroup_addrm_files(cgrp, NULL, cgroup_base_files, true);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user