Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: Remove unused includes, remove misleading comments,...



details:   https://anonhg.NetBSD.org/src/rev/d871158c874b
branches:  trunk
changeset: 318359:d871158c874b
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Apr 18 17:34:54 2018 +0000
description:
Remove unused includes, remove misleading comments, and style.

diffstat:

 sys/netipsec/ipsec_mbuf.c |  36 +++++++++++++++++-------------------
 1 files changed, 17 insertions(+), 19 deletions(-)

diffs (132 lines):

diff -r bd8b85b04a63 -r d871158c874b sys/netipsec/ipsec_mbuf.c
--- a/sys/netipsec/ipsec_mbuf.c Wed Apr 18 14:56:35 2018 +0000
+++ b/sys/netipsec/ipsec_mbuf.c Wed Apr 18 17:34:54 2018 +0000
@@ -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 @@
 #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 @@
                        }
                        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 @@
                /*
                 * 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 @@
                        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 @@
                        if (n == NULL) {
                                m_freem(mfirst);
                                m_freem(m0);
-                               return (NULL);
+                               return NULL;
                        }
                }
                n->m_next = m->m_next;
@@ -196,7 +190,8 @@
                m_free(m);                      /* release old mbuf */
                mprev = mfirst;
        }
-       return (m0);
+
+       return m0;
 }
 
 /*
@@ -220,7 +215,8 @@
        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->m_len += hlen;
                *off = skip;
        }
+
        m0->m_pkthdr.len += hlen;               /* adjust packet length */
        return m;
 }
@@ -393,7 +390,7 @@
        /* 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 @@
                m1->m_len -= hlen;
                m->m_pkthdr.len -= hlen;
        }
-       return (0);
+
+       return 0;
 }



Home | Main Index | Thread Index | Old Index