sysfs: consolidate cgroup processing code in a single function

This commit is contained in:
William Hubbs 2015-10-13 14:53:43 -05:00
parent b81317bdf8
commit 9d53d436ae

View File

@ -61,16 +61,6 @@ mount_misc()
fi fi
fi fi
# set up kernel support for cgroups
if [ -d /sys/fs/cgroup ] && ! mountinfo -q /sys/fs/cgroup; then
if grep -qs cgroup /proc/filesystems; then
ebegin "Mounting cgroup filesystem"
local opts="${sysfs_opts},mode=755,size=${rc_cgroupsize:-10m}"
mount -n -t tmpfs -o ${opts} cgroup_root /sys/fs/cgroup
eend $?
fi
fi
# set up kernel support for fusectl # set up kernel support for fusectl
if [ -d /sys/fs/fuse/connections ] \ if [ -d /sys/fs/fuse/connections ] \
&& ! mountinfo -q /sys/fs/fuse/connections; then && ! mountinfo -q /sys/fs/fuse/connections; then
@ -108,6 +98,16 @@ mount_misc()
mount_cgroups() mount_cgroups()
{ {
# set up kernel support for cgroups
if [ -d /sys/fs/cgroup ] && ! mountinfo -q /sys/fs/cgroup; then
if grep -qs cgroup /proc/filesystems; then
ebegin "Mounting cgroup filesystem"
local opts="${sysfs_opts},mode=755,size=${rc_cgroupsize:-10m}"
mount -n -t tmpfs -o ${opts} cgroup_root /sys/fs/cgroup
eend $?
fi
fi
mountinfo -q /sys/fs/cgroup || return 0 mountinfo -q /sys/fs/cgroup || return 0
if ! mountinfo -q /sys/fs/cgroup/openrc; then if ! mountinfo -q /sys/fs/cgroup/openrc; then