diff options
author | rwatson <rwatson@FreeBSD.org> | 2006-12-29 20:21:21 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2006-12-29 20:21:21 +0000 |
commit | c2bdc9dc5c518c1a3f29bb61d0d469bb1b6b68a9 (patch) | |
tree | ce5979ff95a444e7b76804b15e0bab0cda65a02f /sys | |
parent | 468e5443ba51fa69fdac5946eaaffc74b21e1729 (diff) | |
download | FreeBSD-src-c2bdc9dc5c518c1a3f29bb61d0d469bb1b6b68a9.zip FreeBSD-src-c2bdc9dc5c518c1a3f29bb61d0d469bb1b6b68a9.tar.gz |
Slightly resort functions in file so that no forward function prototypes
are required.
Obtained from: TrustedBSD Project
Diffstat (limited to 'sys')
-rw-r--r-- | sys/security/mac/mac_framework.c | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index 2b45bab..b76aa29 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -142,9 +142,6 @@ static int mac_late = 0; int mac_labelmbufs = 0; #endif -static int mac_policy_register(struct mac_policy_conf *mpc); -static int mac_policy_unregister(struct mac_policy_conf *mpc); - MALLOC_DEFINE(M_MACTEMP, "mactemp", "MAC temporary label storage"); /* @@ -352,52 +349,6 @@ mac_policy_updateflags(void) #endif } -/* - * Allow MAC policy modules to register during boot, etc. - */ -int -mac_policy_modevent(module_t mod, int type, void *data) -{ - struct mac_policy_conf *mpc; - int error; - - error = 0; - mpc = (struct mac_policy_conf *) data; - -#ifdef MAC_STATIC - if (mac_late) { - printf("mac_policy_modevent: MAC_STATIC and late\n"); - return (EBUSY); - } -#endif - - switch (type) { - case MOD_LOAD: - if (mpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_NOTLATE && - mac_late) { - printf("mac_policy_modevent: can't load %s policy " - "after booting\n", mpc->mpc_name); - error = EBUSY; - break; - } - error = mac_policy_register(mpc); - break; - case MOD_UNLOAD: - /* Don't unregister the module if it was never registered. */ - if ((mpc->mpc_runtime_flags & MPC_RUNTIME_FLAG_REGISTERED) - != 0) - error = mac_policy_unregister(mpc); - else - error = 0; - break; - default: - error = EOPNOTSUPP; - break; - } - - return (error); -} - static int mac_policy_register(struct mac_policy_conf *mpc) { @@ -524,6 +475,52 @@ mac_policy_unregister(struct mac_policy_conf *mpc) } /* + * Allow MAC policy modules to register during boot, etc. + */ +int +mac_policy_modevent(module_t mod, int type, void *data) +{ + struct mac_policy_conf *mpc; + int error; + + error = 0; + mpc = (struct mac_policy_conf *) data; + +#ifdef MAC_STATIC + if (mac_late) { + printf("mac_policy_modevent: MAC_STATIC and late\n"); + return (EBUSY); + } +#endif + + switch (type) { + case MOD_LOAD: + if (mpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_NOTLATE && + mac_late) { + printf("mac_policy_modevent: can't load %s policy " + "after booting\n", mpc->mpc_name); + error = EBUSY; + break; + } + error = mac_policy_register(mpc); + break; + case MOD_UNLOAD: + /* Don't unregister the module if it was never registered. */ + if ((mpc->mpc_runtime_flags & MPC_RUNTIME_FLAG_REGISTERED) + != 0) + error = mac_policy_unregister(mpc); + else + error = 0; + break; + default: + error = EOPNOTSUPP; + break; + } + + return (error); +} + +/* * Define an error value precedence, and given two arguments, selects the * value with the higher precedence. */ |