From owner-p4-projects@FreeBSD.ORG Thu Jul 31 19:19:47 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A406237B404; Thu, 31 Jul 2003 19:19:46 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5324937B401 for ; Thu, 31 Jul 2003 19:19:46 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E15F643FE0 for ; Thu, 31 Jul 2003 19:19:45 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h712Jj0U028268 for ; Thu, 31 Jul 2003 19:19:45 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h712JjU4028265 for perforce@freebsd.org; Thu, 31 Jul 2003 19:19:45 -0700 (PDT) Date: Thu, 31 Jul 2003 19:19:45 -0700 (PDT) Message-Id: <200308010219.h712JjU4028265@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Subject: PERFORCE change 35307 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2003 02:19:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=35307 Change 35307 by rwatson@rwatson_tislabs on 2003/07/31 19:19:45 Attempt to de-interlace ifdef'd code in the name of readability. Affected files ... .. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#396 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#396 (text+ko) ==== @@ -121,7 +121,6 @@ */ static int ea_warn_once = 0; -#ifndef MAC_ALWAYS_LABEL_MBUF /* * Flag to indicate whether or not we should allocate label storage for * new mbufs. Since most dynamic policies we currently work with don't @@ -133,6 +132,7 @@ * already has to deal with uninitialized labels, this probably won't * be a problem. Note: currently no locking. Will this be a problem? */ +#ifndef MAC_ALWAYS_LABEL_MBUF static int mac_labelmbufs = 0; #endif @@ -520,36 +520,28 @@ /* * After the policy list has changed, walk the list to update any global - * flags. + * flags. Currently, we support only one flag, and it's conditionally + * defined; as a result, the entire function is conditional. Eventually, + * the #else case might also iterate across the policies. */ static void mac_policy_updateflags(void) { +#ifndef MAC_ALWAYS_LABEL_MBUF struct mac_policy_conf *tmpc; -#ifndef MAC_ALWAYS_LABEL_MBUF int labelmbufs; -#endif mac_policy_assert_exclusive(); -#ifndef MAC_ALWAYS_LABEL_MBUF labelmbufs = 0; -#endif - LIST_FOREACH(tmpc, &mac_static_policy_list, mpc_list) { -#ifndef MAC_ALWAYS_LABEL_MBUF if (tmpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_LABELMBUFS) labelmbufs++; -#endif } LIST_FOREACH(tmpc, &mac_policy_list, mpc_list) { -#ifndef MAC_ALWAYS_LABEL_MBUF if (tmpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_LABELMBUFS) labelmbufs++; -#endif } - -#ifndef MAC_ALWAYS_LABEL_MBUF mac_labelmbufs = (labelmbufs != 0); #endif }