selinux-policy/refpolicy/policy/support/loadable_module.spt

100 lines
1.5 KiB
Cheetah
Raw Normal View History

########################################
#
# Macros for switching between source policy
# and loadable policy module support
#
##############################
#
# For adding the module statement
#
define(`policy_module',`
ifdef(`monolithic_policy',`',`
module $1 $2;
')
')
##############################
#
# For use in interfaces, to optionally insert a require block
#
define(`gen_require',`
ifdef(`monolithic_policy',`',`
require {
$1
}
')
')
2005-06-08 13:11:47 +00:00
##############################
#
# In the future interfaces could be in loadable modules
#
# module_interface(name,rules)
#
define(`module_interface',`
define(`$1',`
gen_require(`$1'_depend)
2005-06-08 13:11:47 +00:00
$2
')
')
##############################
#
# Optional policy handling
#
define(`optional_policy',`
ifdef(`monolithic_policy',`
ifdef(`$1',$2,$3)
',`
optional {
$2
} else {
$3
}
')
')
2005-06-07 22:26:39 +00:00
##############################
#
# Determine if we should use the default
# tunable value as specified by the policy
# or if the override value should be used
#
define(`dflt_or_overr',`ifdef(`$1',$1,$2)')
2005-06-07 22:26:39 +00:00
##############################
#
# Tunable declaration
#
define(`gen_tunable',`
2005-06-07 22:26:39 +00:00
ifdef(`monolithic_policy',`
bool $1 dflt_or_overr(`$1'_conf,$2);
2005-06-07 22:26:39 +00:00
',`
# loadable module tunable
# declaration will go here
# for $1 $2
')
')
##############################
#
# Tunable policy handling
#
define(`tunable_policy',`
ifdef(`monolithic_policy',`
if (`$1') {
$2
} else {
$3
}
',`
optional {
require { `$1' }
$2
} else {
$3
}
')
')