From owner-p4-projects@FreeBSD.ORG Thu Jul 31 19:23:52 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3FB3F37B404; Thu, 31 Jul 2003 19:23:52 -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 0DBF537B401 for ; Thu, 31 Jul 2003 19:23:52 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9E99C43FB1 for ; Thu, 31 Jul 2003 19:23:51 -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 h712Np0U028488 for ; Thu, 31 Jul 2003 19:23:51 -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 h712NpvH028485 for perforce@freebsd.org; Thu, 31 Jul 2003 19:23:51 -0700 (PDT) Date: Thu, 31 Jul 2003 19:23:51 -0700 (PDT) Message-Id: <200308010223.h712NpvH028485@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 35308 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:23:53 -0000 http://perforce.freebsd.org/chv.cgi?CH=35308 Change 35308 by rwatson@rwatson_tislabs on 2003/07/31 19:22:55 Further attempts to make the mbuf allocation code more readable: try to avoid large indented conditionally defined code blocks. Affected files ... .. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#397 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#397 (text+ko) ==== @@ -869,24 +869,22 @@ #ifndef MAC_ALWAYS_LABEL_MBUF /* - * Don't reserve space for labels on mbufs unless we have a policy - * that uses the labels. + * If conditionally allocating mbuf labels, don't allocate unless + * they are required. */ - if (mac_labelmbufs) { + if (!mac_labelmbufs) + return (0); #endif - tag = m_tag_get(PACKET_TAG_MACLABEL, sizeof(struct label), - flag); - if (tag == NULL) - return (ENOMEM); - error = mac_init_mbuf_tag(tag, flag); - if (error) { - m_tag_free(tag); - return (error); - } - m_tag_prepend(m, tag); -#ifndef MAC_ALWAYS_LABEL_MBUF + tag = m_tag_get(PACKET_TAG_MACLABEL, sizeof(struct label), + flag); + if (tag == NULL) + return (ENOMEM); + error = mac_init_mbuf_tag(tag, flag); + if (error) { + m_tag_free(tag); + return (error); } -#endif + m_tag_prepend(m, tag); return (0); }