FreeBSD/sys/security/mac/mac_framework.c
/*
 * Given a policy, derive from its set of non-NULL label init methods what
 * object types the policy is interested in.
 */
Given a policy, derive from its set of non-NULL label init methods what
object types the policy is interested in.
Given a policy derive from its set of non - NULL label init methods what object types the policy is interested in .
static uint64_t
mac_policy_getlabeled(struct mac_policy_conf *mpc)
{
	uint64_t labeled;
#define	MPC_FLAG(method, flag)					\
	if (mpc->mpc_ops->mpo_ ## method != NULL)			\
		labeled |= (flag);					\
	labeled = 0;
	MPC_FLAG(cred_init_label, MPC_OBJECT_CRED);
	MPC_FLAG(proc_init_label, MPC_OBJECT_PROC);
	MPC_FLAG(vnode_init_label, MPC_OBJECT_VNODE);
	MPC_FLAG(inpcb_init_label, MPC_OBJECT_INPCB);
	MPC_FLAG(socket_init_label, MPC_OBJECT_SOCKET);
	MPC_FLAG(devfs_init_label, MPC_OBJECT_DEVFS);
	MPC_FLAG(mbuf_init_label, MPC_OBJECT_MBUF);
	MPC_FLAG(ipq_init_label, MPC_OBJECT_IPQ);
	MPC_FLAG(ifnet_init_label, MPC_OBJECT_IFNET);
	MPC_FLAG(bpfdesc_init_label, MPC_OBJECT_BPFDESC);
	MPC_FLAG(pipe_init_label, MPC_OBJECT_PIPE);
	MPC_FLAG(mount_init_label, MPC_OBJECT_MOUNT);
	MPC_FLAG(posixsem_init_label, MPC_OBJECT_POSIXSEM);
	MPC_FLAG(posixshm_init_label, MPC_OBJECT_POSIXSHM);
	MPC_FLAG(sysvmsg_init_label, MPC_OBJECT_SYSVMSG);
	MPC_FLAG(sysvmsq_init_label, MPC_OBJECT_SYSVMSQ);
	MPC_FLAG(sysvsem_init_label, MPC_OBJECT_SYSVSEM);
	MPC_FLAG(sysvshm_init_label, MPC_OBJECT_SYSVSHM);
	MPC_FLAG(syncache_init_label, MPC_OBJECT_SYNCACHE);
	MPC_FLAG(ip6q_init_label, MPC_OBJECT_IP6Q);
#undef MPC_FLAG
	return (labeled);
}
static uint64_t mac_policy_getlabeled ( struct mac_policy_conf * mpc ) { uint64_t labeled ; #define MPC_FLAG ( method , flag ) 					\
	if (mpc->mpc_ops->mpo_ ## method != NULL)			\
		labeled |= (flag);					\
 labeled = 0 ; MPC_FLAG ( cred_init_label , MPC_OBJECT_CRED ) ; MPC_FLAG ( proc_init_label , MPC_OBJECT_PROC ) ; MPC_FLAG ( vnode_init_label , MPC_OBJECT_VNODE ) ; MPC_FLAG ( inpcb_init_label , MPC_OBJECT_INPCB ) ; MPC_FLAG ( socket_init_label , MPC_OBJECT_SOCKET ) ; MPC_FLAG ( devfs_init_label , MPC_OBJECT_DEVFS ) ; MPC_FLAG ( mbuf_init_label , MPC_OBJECT_MBUF ) ; MPC_FLAG ( ipq_init_label , MPC_OBJECT_IPQ ) ; MPC_FLAG ( ifnet_init_label , MPC_OBJECT_IFNET ) ; MPC_FLAG ( bpfdesc_init_label , MPC_OBJECT_BPFDESC ) ; MPC_FLAG ( pipe_init_label , MPC_OBJECT_PIPE ) ; MPC_FLAG ( mount_init_label , MPC_OBJECT_MOUNT ) ; MPC_FLAG ( posixsem_init_label , MPC_OBJECT_POSIXSEM ) ; MPC_FLAG ( posixshm_init_label , MPC_OBJECT_POSIXSHM ) ; MPC_FLAG ( sysvmsg_init_label , MPC_OBJECT_SYSVMSG ) ; MPC_FLAG ( sysvmsq_init_label , MPC_OBJECT_SYSVMSQ ) ; MPC_FLAG ( sysvsem_init_label , MPC_OBJECT_SYSVSEM ) ; MPC_FLAG ( sysvshm_init_label , MPC_OBJECT_SYSVSHM ) ; MPC_FLAG ( syncache_init_label , MPC_OBJECT_SYNCACHE ) ; MPC_FLAG ( ip6q_init_label , MPC_OBJECT_IP6Q ) ; #undef  MPC_FLAG return ( labeled ) ; }
Given a policy, derive from its set of non-NULL label init methods what
 object types the policy is interested in.
Given a policy derive from its set of non - NULL label init methods what object types the policy is interested in .