Commit 676db4af authored by Greg KH's avatar Greg KH Committed by Greg Kroah-Hartman

cgroupfs: create /sys/fs/cgroup to mount cgroupfs on

We really shouldn't be asking userspace to create new root filesystems.
So follow along with all of the other in-kernel filesystems, and provide
a mount point in sysfs.

For cgroupfs, this should be in /sys/fs/cgroup/  This change provides
that mount point when the cgroup filesystem is registered in the kernel.
Acked-by: default avatarPaul Menage <menage@google.com>
Acked-by: default avatarDhaval Giani <dhaval.giani@gmail.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Lennart Poettering <lennart@poettering.net>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 45daef0f
...@@ -1623,6 +1623,8 @@ static struct file_system_type cgroup_fs_type = { ...@@ -1623,6 +1623,8 @@ static struct file_system_type cgroup_fs_type = {
.kill_sb = cgroup_kill_sb, .kill_sb = cgroup_kill_sb,
}; };
static struct kobject *cgroup_kobj;
static inline struct cgroup *__d_cgrp(struct dentry *dentry) static inline struct cgroup *__d_cgrp(struct dentry *dentry)
{ {
return dentry->d_fsdata; return dentry->d_fsdata;
...@@ -3894,9 +3896,18 @@ int __init cgroup_init(void) ...@@ -3894,9 +3896,18 @@ int __init cgroup_init(void)
hhead = css_set_hash(init_css_set.subsys); hhead = css_set_hash(init_css_set.subsys);
hlist_add_head(&init_css_set.hlist, hhead); hlist_add_head(&init_css_set.hlist, hhead);
BUG_ON(!init_root_id(&rootnode)); BUG_ON(!init_root_id(&rootnode));
cgroup_kobj = kobject_create_and_add("cgroup", fs_kobj);
if (!cgroup_kobj) {
err = -ENOMEM;
goto out;
}
err = register_filesystem(&cgroup_fs_type); err = register_filesystem(&cgroup_fs_type);
if (err < 0) if (err < 0) {
kobject_put(cgroup_kobj);
goto out; goto out;
}
proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations); proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment