PERFORCE change 35308 for review

Robert Watson rwatson at FreeBSD.org
Fri Aug 1 02:23:51 GMT 2003


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

Change 35308 by rwatson at 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);
 }
 
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list