Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Style, no functional change.



details:   https://anonhg.NetBSD.org/src/rev/c2a5bca33775
branches:  trunk
changeset: 829208:c2a5bca33775
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Jan 22 09:06:40 2018 +0000

description:
Style, no functional change.

diffstat:

 sys/kern/uipc_mbuf.c |  67 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 39 insertions(+), 28 deletions(-)

diffs (194 lines):

diff -r 124a0a1abe72 -r c2a5bca33775 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Mon Jan 22 08:14:09 2018 +0000
+++ b/sys/kern/uipc_mbuf.c      Mon Jan 22 09:06:40 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_mbuf.c,v 1.178 2018/01/22 07:22:52 maxv Exp $     */
+/*     $NetBSD: uipc_mbuf.c,v 1.179 2018/01/22 09:06:40 maxv Exp $     */
 
 /*
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.178 2018/01/22 07:22:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.179 2018/01/22 09:06:40 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -102,7 +102,7 @@
 
 static struct sysctllog *mbuf_sysctllog;
 
-static struct mbuf *m_copym0(struct mbuf *, int, int, int, int);
+static struct mbuf *m_copym0(struct mbuf *, int, int, int, bool);
 static struct mbuf *m_split0(struct mbuf *, int, int, int);
 static int m_copyback0(struct mbuf **, int, int, const void *, int, int);
 
@@ -459,7 +459,8 @@
  * Add mbuf to the end of a chain
  */
 struct mbuf *
-m_add(struct mbuf *c, struct mbuf *m) {
+m_add(struct mbuf *c, struct mbuf *m)
+{
        struct mbuf *n;
 
        if (c == NULL)
@@ -620,10 +621,10 @@
        struct mbuf *m;
 
        m = m_get(nowait, type);
-       if (m == 0)
-               return (NULL);
+       if (m == NULL)
+               return NULL;
        memset(mtod(m, void *), 0, MLEN);
-       return (m);
+       return m;
 }
 
 void
@@ -664,7 +665,7 @@
        mn = m_get(how, m->m_type);
        if (mn == NULL) {
                m_freem(m);
-               return (NULL);
+               return NULL;
        }
 
        if (m->m_flags & M_PKTHDR) {
@@ -684,7 +685,7 @@
        }
 
        m->m_len = len;
-       return (m);
+       return m;
 }
 
 /*
@@ -698,23 +699,24 @@
 m_copym(struct mbuf *m, int off0, int len, int wait)
 {
 
-       return m_copym0(m, off0, len, wait, 0); /* shallow copy on M_EXT */
+       return m_copym0(m, off0, len, wait, false); /* shallow copy on M_EXT */
 }
 
 struct mbuf *
 m_dup(struct mbuf *m, int off0, int len, int wait)
 {
 
-       return m_copym0(m, off0, len, wait, 1); /* deep copy */
+       return m_copym0(m, off0, len, wait, true); /* deep copy */
 }
 
 static inline int
-m_copylen(int len, int copylen) {
-    return len == M_COPYALL ? copylen : min(len, copylen);
+m_copylen(int len, int copylen)
+{
+       return (len == M_COPYALL) ? copylen : min(len, copylen);
 }
 
 static struct mbuf *
-m_copym0(struct mbuf *m, int off0, int len, int wait, int deep)
+m_copym0(struct mbuf *m, int off0, int len, int wait, bool deep)
 {
        struct mbuf *n, **np;
        int off = off0;
@@ -726,27 +728,30 @@
        if (off == 0 && m->m_flags & M_PKTHDR)
                copyhdr = 1;
        while (off > 0) {
-               if (m == 0)
+               if (m == NULL)
                        panic("m_copym: m == 0, off %d", off);
                if (off < m->m_len)
                        break;
                off -= m->m_len;
                m = m->m_next;
        }
+
        np = &top;
-       top = 0;
+       top = NULL;
        while (len == M_COPYALL || len > 0) {
-               if (m == 0) {
+               if (m == NULL) {
                        if (len != M_COPYALL)
                                panic("m_copym: m == 0, len %d [!COPYALL]",
                                    len);
                        break;
                }
+
                n = m_get(wait, m->m_type);
                *np = n;
-               if (n == 0)
+               if (n == NULL)
                        goto nospace;
                MCLAIM(n, m->m_owner);
+
                if (copyhdr) {
                        M_COPY_PKTHDR(n, m);
                        if (len == M_COPYALL)
@@ -756,6 +761,7 @@
                        copyhdr = 0;
                }
                n->m_len = m_copylen(len, m->m_len - off);
+
                if (m->m_flags & M_EXT) {
                        if (!deep) {
                                n->m_data = m->m_data + off;
@@ -777,9 +783,11 @@
                                memcpy(mtod(n, void *), mtod(m, char *) + off,
                                    (unsigned)n->m_len);
                        }
-               } else
+               } else {
                        memcpy(mtod(n, void *), mtod(m, char *) + off,
                            (unsigned)n->m_len);
+               }
+
                if (len != M_COPYALL)
                        len -= n->m_len;
                off += n->m_len;
@@ -793,13 +801,16 @@
                }
                np = &n->m_next;
        }
-       if (top == 0)
+
+       if (top == NULL)
                MCFail++;
-       return (top);
+
+       return top;
+
 nospace:
        m_freem(top);
        MCFail++;
-       return (NULL);
+       return NULL;
 }
 
 /*
@@ -860,12 +871,12 @@
 void
 m_copydata(struct mbuf *m, int off, int len, void *vp)
 {
-       unsigned        count;
-       void *          cp = vp;
-       struct mbuf     *m0 = m;
-       int             len0 = len;
-       int             off0 = off;
-       void            *vp0 = vp;
+       unsigned count;
+       void *cp = vp;
+       struct mbuf *m0 = m;
+       int len0 = len;
+       int off0 = off;
+       void *vp0 = vp;
 
        KASSERT(len != M_COPYALL);
        if (off < 0 || len < 0)



Home | Main Index | Thread Index | Old Index