Source-Changes-HG archive

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

[src/trunk]: src Rename the 'flags' and 'nowait' arguments to 'how'. The othe...



details:   https://anonhg.NetBSD.org/src/rev/dad2e52f4f82
branches:  trunk
changeset: 322287:dad2e52f4f82
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Apr 28 08:34:45 2018 +0000

description:
Rename the 'flags' and 'nowait' arguments to 'how'. The other BSDs did the
same. Also, in m_defrag, rename 'mold' to 'm'.

diffstat:

 share/man/man9/mbuf.9 |  16 ++++++++--------
 sys/kern/uipc_mbuf.c  |  40 ++++++++++++++++++++--------------------
 2 files changed, 28 insertions(+), 28 deletions(-)

diffs (185 lines):

diff -r 4b7a0fe0ba4a -r dad2e52f4f82 share/man/man9/mbuf.9
--- a/share/man/man9/mbuf.9     Sat Apr 28 08:16:15 2018 +0000
+++ b/share/man/man9/mbuf.9     Sat Apr 28 08:34:45 2018 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: mbuf.9,v 1.62 2018/04/27 09:33:09 wiz Exp $
+.\"    $NetBSD: mbuf.9,v 1.63 2018/04/28 08:34:45 maxv Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 27, 2018
+.Dd April 28, 2018
 .Dt MBUF 9
 .Os
 .Sh NAME
@@ -69,9 +69,9 @@
 .Sh SYNOPSIS
 .In sys/mbuf.h
 .Ft struct mbuf *
-.Fn m_get "int nowait" "int type"
+.Fn m_get "int how" "int type"
 .Ft struct mbuf *
-.Fn m_gethdr "int nowait" "int type"
+.Fn m_gethdr "int how" "int type"
 .Ft struct mbuf *
 .Fn m_devget "char *buf" "int totlen" "int off0" "struct ifnet *ifp" "void (*copy)(const void *, void *, size_t)"
 .Ft struct mbuf *
@@ -231,10 +231,10 @@
 the external storage area could be shared among multiple mbufs.
 Be careful when you attempt to overwrite the data content of the mbuf.
 .Bl -tag -width compact
-.It Fn m_get "int nowait" "int type"
+.It Fn m_get "int how" "int type"
 Allocates an mbuf and initializes it to contain internal data.
 The
-.Fa nowait
+.Fa how
 parameter is a choice of
 .Dv M_WAIT / M_DONTWAIT
 from caller.
@@ -243,11 +243,11 @@
 The
 .Fa type
 parameter is an mbuf type.
-.It Fn m_gethdr "int nowait" "int type"
+.It Fn m_gethdr "int how" "int type"
 Allocates an mbuf and initializes it to contain a packet header and internal
 data.
 The
-.Fa nowait
+.Fa how
 parameter is a choice of
 .Dv M_WAIT / M_DONTWAIT
 from caller.
diff -r 4b7a0fe0ba4a -r dad2e52f4f82 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Sat Apr 28 08:16:15 2018 +0000
+++ b/sys/kern/uipc_mbuf.c      Sat Apr 28 08:34:45 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_mbuf.c,v 1.211 2018/04/28 08:16:15 maxv Exp $     */
+/*     $NetBSD: uipc_mbuf.c,v 1.212 2018/04/28 08:34:45 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.211 2018/04/28 08:16:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.212 2018/04/28 08:34:45 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -523,14 +523,14 @@
 }
 
 struct mbuf *
-m_get(int nowait, int type)
+m_get(int how, int type)
 {
        struct mbuf *m;
 
        KASSERT(type != MT_FREE);
 
        m = pool_cache_get(mb_cache,
-           nowait == M_WAIT ? PR_WAITOK|PR_LIMITFAIL : PR_NOWAIT);
+           how == M_WAIT ? PR_WAITOK|PR_LIMITFAIL : PR_NOWAIT);
        if (m == NULL)
                return NULL;
 
@@ -549,11 +549,11 @@
 }
 
 struct mbuf *
-m_gethdr(int nowait, int type)
+m_gethdr(int how, int type)
 {
        struct mbuf *m;
 
-       m = m_get(nowait, type);
+       m = m_get(how, type);
        if (m == NULL)
                return NULL;
 
@@ -574,10 +574,10 @@
 }
 
 void
-m_clget(struct mbuf *m, int nowait)
+m_clget(struct mbuf *m, int how)
 {
        m->m_ext_storage.ext_buf = (char *)pool_cache_get_paddr(mcl_cache,
-           nowait == M_WAIT ? (PR_WAITOK|PR_LIMITFAIL) : PR_NOWAIT,
+           how == M_WAIT ? (PR_WAITOK|PR_LIMITFAIL) : PR_NOWAIT,
            &m->m_ext_storage.ext_paddr);
 
        if (m->m_ext_storage.ext_buf == NULL)
@@ -1480,27 +1480,27 @@
  * is the same as the one passed.
  */
 struct mbuf *
-m_defrag(struct mbuf *mold, int flags)
+m_defrag(struct mbuf *m, int how)
 {
        struct mbuf *m0, *mn, *n;
        int sz;
 
-       KASSERT((mold->m_flags & M_PKTHDR) != 0);
+       KASSERT((m->m_flags & M_PKTHDR) != 0);
 
-       if (mold->m_next == NULL)
-               return mold;
+       if (m->m_next == NULL)
+               return m;
 
-       m0 = m_get(flags, MT_DATA);
+       m0 = m_get(how, MT_DATA);
        if (m0 == NULL)
                return NULL;
        mn = m0;
 
-       sz = mold->m_pkthdr.len - mold->m_len;
+       sz = m->m_pkthdr.len - m->m_len;
        KASSERT(sz >= 0);
 
        do {
                if (sz > MLEN) {
-                       MCLGET(mn, flags);
+                       MCLGET(mn, how);
                        if ((mn->m_flags & M_EXT) == 0) {
                                m_freem(m0);
                                return NULL;
@@ -1509,14 +1509,14 @@
 
                mn->m_len = MIN(sz, MCLBYTES);
 
-               m_copydata(mold, mold->m_pkthdr.len - sz, mn->m_len,
+               m_copydata(m, m->m_pkthdr.len - sz, mn->m_len,
                     mtod(mn, void *));
 
                sz -= mn->m_len;
 
                if (sz > 0) {
                        /* need more mbufs */
-                       n = m_get(flags, MT_DATA);
+                       n = m_get(how, MT_DATA);
                        if (n == NULL) {
                                m_freem(m0);
                                return NULL;
@@ -1527,10 +1527,10 @@
                }
        } while (sz > 0);
 
-       m_freem(mold->m_next);
-       mold->m_next = m0;
+       m_freem(m->m_next);
+       m->m_next = m0;
 
-       return mold;
+       return m;
 }
 
 void



Home | Main Index | Thread Index | Old Index