PERFORCE change 111490 for review

Todd Miller millert at FreeBSD.org
Mon Dec 11 14:15:37 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=111490

Change 111490 by millert at millert_g5tower on 2006/12/11 21:43:09

	Remove mac_policy_list_conditional_busy_noblock() and
	the MAC_CHECK_NOBLOCK and MAC_PERFORM_NOBLOCK macros.
	They are not used.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/security/mac_base.c#30 edit
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/security/mac_internal.h#12 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/security/mac_base.c#30 (text+ko) ====

@@ -346,23 +346,6 @@
 }
 
 int
-mac_policy_list_conditional_busy_noblock(void)
-{
-	int ret;
-
-	if (!lck_mtx_try_lock(mac_policy_mtx))
-		return (-1);
-
-	if (mac_policy_list.numloaded > mac_policy_list.staticmax) {
-		mac_policy_busy++;
-		ret = 1;
-	} else
-		ret = 0;
-	lck_mtx_unlock(mac_policy_mtx);
-	return (ret);
-}
-
-int
 mac_policy_list_conditional_busy(void)
 {
 	int ret;

==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/security/mac_internal.h#12 (text+ko) ====

@@ -170,7 +170,6 @@
 
 void  mac_policy_list_busy(void);
 int   mac_policy_list_conditional_busy(void);
-int   mac_policy_list_conditional_busy_noblock(void);
 void  mac_policy_list_unbusy(void);
 
 void           mac_labelzone_init(void);
@@ -238,45 +237,6 @@
 } while (0)
 
 /*
- * MAC_CHECK_NOBLOCK has the same semantics as MAC_CHECK,
- * except that it will not block for the policy lock.  It sets check_failed to
- * 1 if it could not get the lock.  This function should only be called
- * on policy entry points that support the waitok flag, or which are 
- * guaranteed not to block.
- */
-#define	MAC_CHECK_NOBLOCK(check, args...) do {					\
-	struct mac_policy_conf *mpc;					\
-	int busy;							\
-	u_int i;							\
-									\
-	error = 0;							\
-	for (i = 0; i < mac_policy_list.staticmax; i++) {		\
-		mpc = mac_policy_list_entries[i].mpc;			\
-		if (mpc == NULL)                                	\
-			continue;                               	\
-									\
-		if (mpc->mpc_ops->mpo_ ## check != NULL)		\
-			error = mac_error_select(      			\
-			    mpc->mpc_ops->mpo_ ## check (args),		\
-			    error);					\
-	}								\
-	if ((busy = mac_policy_list_conditional_busy_noblock()) > 0) {	\
-		for (; i <= mac_policy_list.maxindex; i++) {		\
-			mpc = mac_policy_list.entries[i].mpc;		\
-			if (mpc == NULL)                                \
-				continue;                               \
-                                                                        \
-			if (mpc->mpc_ops->mpo_ ## check != NULL)	\
-				error = mac_error_select(      		\
-				    mpc->mpc_ops->mpo_ ## check (args),	\
-				    error);				\
-		}							\
-		mac_policy_list_unbusy();				\
-	} else if (busy < 0)						\
-		check_failed = 1;					\
-} while (0)
-
-/*
  * MAC_BOOLEAN performs the designated boolean composition by walking
  * the module list, invoking each instance of the operation, and
  * combining the results using the passed C operator.  Note that it
@@ -351,36 +311,6 @@
 	}								\
 } while (0)
 
-/*
- * MAC_PERFORM_NOBLOCK differs from MAC_PERFORM in that it will not block.
- * If it cannot grab the policy mutex, it will set error to -1.  Otherwise, it
- * it is the same.
- */
-#define MAC_PERFORM_NOBLOCK(operation, args...) do {			\
-	struct mac_policy_conf *mpc;					\
-	int busy;							\
-	u_int i;							\
-									\
-	for (i = 0; i < mac_policy_list.staticmax; i++) {		\
-		mpc = mac_policy_list.entries[i].mpc;			\
-		if (mpc == NULL)					\
-			continue;					\
-		if (mpc->mpc_ops->mpo_ ## operation != NULL)		\
-			mpc->mpc_ops->mpo_ ## operation (args);		\
-	}								\
-	if ((busy = mac_policy_list_conditional_busy_noblock()) > 0) {	\
-		for (; i <= mac_policy_list.maxindex; i++) {		\
-			mpc = mac_policy_list.entries[i].mpc;		\
-			if (mpc == NULL)				\
-				continue;				\
-			if (mpc->mpc_ops->mpo_ ## operation != NULL)	\
-				mpc->mpc_ops->mpo_ ## operation (args);	\
-		}							\
-		mac_policy_list_unbusy();				\
-	} else if (busy < 0)						\
-		error = -1;						\
-} while (0)
-
 struct __mac_get_pid_args;
 struct __mac_get_proc_args;
 struct __mac_set_proc_args;


More information about the trustedbsd-cvs mailing list