Module Name:    src
Committed By:   maxv
Date:           Wed Apr 18 17:34:54 UTC 2018

Modified Files:
        src/sys/netipsec: ipsec_mbuf.c

Log Message:
Remove unused includes, remove misleading comments, and style.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/netipsec/ipsec_mbuf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netipsec/ipsec_mbuf.c
diff -u src/sys/netipsec/ipsec_mbuf.c:1.24 src/sys/netipsec/ipsec_mbuf.c:1.25
--- src/sys/netipsec/ipsec_mbuf.c:1.24	Tue Apr 17 09:06:33 2018
+++ src/sys/netipsec/ipsec_mbuf.c	Wed Apr 18 17:34:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_mbuf.c,v 1.24 2018/04/17 09:06:33 maxv Exp $	*/
+/*	$NetBSD: ipsec_mbuf.c,v 1.25 2018/04/18 17:34:54 maxv Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.24 2018/04/17 09:06:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.25 2018/04/18 17:34:54 maxv Exp $");
 
 /*
  * IPsec-specific mbuf routines.
@@ -38,10 +38,6 @@ __KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
-#include <sys/socket.h>
-
-#include <net/route.h>
-#include <netinet/in.h>
 
 #include <netipsec/ipsec.h>
 #include <netipsec/ipsec_var.h>
@@ -94,11 +90,9 @@ m_clone(struct mbuf *m0)
 			}
 			continue;
 		}
+
 		/*
-		 * Writable mbufs are left alone (for now).  Note
-		 * that for 4.x systems it's not possible to identify
-		 * whether or not mbufs with external buffers are
-		 * writable unless they use clusters.
+		 * Writable mbufs are left alone (for now).
 		 */
 		if (M_EXT_WRITABLE(m)) {
 			mprev = m;
@@ -128,7 +122,6 @@ m_clone(struct mbuf *m0)
 		/*
 		 * Allocate new space to hold the copy...
 		 */
-		/* XXX why can M_PKTHDR be set past the first mbuf? */
 		if (mprev == NULL && (m->m_flags & M_PKTHDR)) {
 			/*
 			 * NB: if a packet header is present we must
@@ -139,22 +132,23 @@ m_clone(struct mbuf *m0)
 			MGETHDR(n, M_DONTWAIT, m->m_type);
 			if (n == NULL) {
 				m_freem(m0);
-				return (NULL);
+				return NULL;
 			}
 			M_MOVE_PKTHDR(n, m);
 			MCLGET(n, M_DONTWAIT);
 			if ((n->m_flags & M_EXT) == 0) {
 				m_free(n);
 				m_freem(m0);
-				return (NULL);
+				return NULL;
 			}
 		} else {
 			n = m_getcl(M_DONTWAIT, m->m_type, m->m_flags);
 			if (n == NULL) {
 				m_freem(m0);
-				return (NULL);
+				return NULL;
 			}
 		}
+
 		/*
 		 * ... and copy the data.  We deal with jumbo mbufs
 		 * (i.e. m_len > MCLBYTES) by splitting them into
@@ -185,7 +179,7 @@ m_clone(struct mbuf *m0)
 			if (n == NULL) {
 				m_freem(mfirst);
 				m_freem(m0);
-				return (NULL);
+				return NULL;
 			}
 		}
 		n->m_next = m->m_next;
@@ -196,7 +190,8 @@ m_clone(struct mbuf *m0)
 		m_free(m);			/* release old mbuf */
 		mprev = mfirst;
 	}
-	return (m0);
+
+	return m0;
 }
 
 /*
@@ -220,7 +215,8 @@ m_makespace(struct mbuf *m0, int skip, i
 	for (m = m0; m && skip > m->m_len; m = m->m_next)
 		skip -= m->m_len;
 	if (m == NULL)
-		return (NULL);
+		return NULL;
+
 	/*
 	 * At this point skip is the offset into the mbuf m
 	 * where the new header should be placed.  Figure out
@@ -302,6 +298,7 @@ m_makespace(struct mbuf *m0, int skip, i
 		m->m_len += hlen;
 		*off = skip;
 	}
+
 	m0->m_pkthdr.len += hlen;		/* adjust packet length */
 	return m;
 }
@@ -393,7 +390,7 @@ m_striphdr(struct mbuf *m, int skip, int
 	/* Find beginning of header */
 	m1 = m_getptr(m, skip, &roff);
 	if (m1 == NULL)
-		return (EINVAL);
+		return EINVAL;
 
 	/* Remove the header and associated data from the mbuf. */
 	if (roff == 0) {
@@ -446,5 +443,6 @@ m_striphdr(struct mbuf *m, int skip, int
 		m1->m_len -= hlen;
 		m->m_pkthdr.len -= hlen;
 	}
-	return (0);
+
+	return 0;
 }

Reply via email to