## <summary>Patch to facilitate interface to interact with cgroup fs.</summary>
## <desc>
##	<p>
##		Add interfaces to allow for interaction with cgroupfs
##		for initrc (cfconfig) and for cfrulesengd.
##	</p>
## </desc>

########################################
## <summary>
##	Mount a cgroup filesystem.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`fs_mount_cgroup_fs', `
	gen_require(`
		type cgroup_t;
	')

	allow $1 cgroup_t:filesystem mount;
')

########################################
## <summary>
##	Remount a cgroup filesystem  This allows
##	some mount options to be changed.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`fs_remount_cgroup_fs', `
	gen_require(`
		type cgroup_t;
	')

	allow $1 cgroup_t:filesystem remount;
')

########################################
## <summary>
##	Unmount a cgroup file system.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`fs_unmount_cgroup_fs', `
	gen_require(`
		type cgroup_t;
	')

	allow $1 cgroup_t:filesystem unmount;
')

########################################
## <summary>
##	Read and write files on cgroup
##	file systems.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`fs_rw_cgroup_files',`
	gen_require(`
		type cgroup_t;

	')

	rw_files_pattern($1, cgroup_t, cgroup_t)
	fs_search_cgroup_dirs($1)
')

########################################
## <summary>
##	Set attributes of files on cgroup
##	file systems.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`fs_setattr_cgroup_files',`
	gen_require(`
		type cgroup_t;

	')

	setattr_files_pattern($1, cgroup_t, cgroup_t)
	fs_search_cgroup_dirs($1)
')

########################################
## <summary>
##	Manage dirs on cgroup
##	file systems.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`fs_manage_cgroup_dirs',`
	gen_require(`
		type cgroup_t;

	')

	manage_dirs_pattern($1, cgroup_t, cgroup_t)
')

########################################
## <summary>
##	Search dirs on cgroup
##	file systems.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`fs_search_cgroup_dirs', `
	gen_require(`
		type cgroup_t;

	')

	allow $1 cgroup_t:dir search;
')

########################################
## <summary>
##	Search dirs on cgroup
##	file systems.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`fs_write_cgroup_files', `
	gen_require(`
		type cgroup_t;

	')

	write_files_pattern($1, cgroup_t, cgroup_t)
	fs_search_cgroup_dirs($1)
')
