Source-Changes-HG archive

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

[src/trunk]: src/sys Remove _MCLGET, merge its content into m_clget(). The co...



details:   https://anonhg.NetBSD.org/src/rev/fdb5a1e58f4f
branches:  trunk
changeset: 832039:fdb5a1e58f4f
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Apr 27 09:22:28 2018 +0000

description:
Remove _MCLGET, merge its content into m_clget(). The code is slightly
modified to reduce the indentation level.

diffstat:

 sys/kern/uipc_mbuf.c |  22 +++++++++++++++++++---
 sys/sys/mbuf.h       |  25 +------------------------
 2 files changed, 20 insertions(+), 27 deletions(-)

diffs (83 lines):

diff -r b15dfab3e65b -r fdb5a1e58f4f sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Fri Apr 27 09:05:26 2018 +0000
+++ b/sys/kern/uipc_mbuf.c      Fri Apr 27 09:22:28 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_mbuf.c,v 1.205 2018/04/27 08:23:18 maxv Exp $     */
+/*     $NetBSD: uipc_mbuf.c,v 1.206 2018/04/27 09:22:28 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.205 2018/04/27 08:23:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.206 2018/04/27 09:22:28 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -577,8 +577,24 @@
 void
 m_clget(struct mbuf *m, int nowait)
 {
+       m->m_ext_storage.ext_buf = (char *)pool_cache_get_paddr(mcl_cache,
+           nowait == M_WAIT ? (PR_WAITOK|PR_LIMITFAIL) : PR_NOWAIT,
+           &m->m_ext_storage.ext_paddr);
 
-       _MCLGET(m, mcl_cache, MCLBYTES, nowait);
+       if (m->m_ext_storage.ext_buf == NULL)
+               return;
+
+       MCLINITREFERENCE(m);
+       m->m_data = m->m_ext.ext_buf;
+       m->m_flags = (m->m_flags & ~M_EXTCOPYFLAGS) |
+           M_EXT|M_EXT_CLUSTER|M_EXT_RW;
+       m->m_ext.ext_flags = 0;
+       m->m_ext.ext_size = MCLBYTES;
+       m->m_ext.ext_free = NULL;
+       m->m_ext.ext_arg = mcl_cache;
+       /* ext_paddr initialized above */
+
+       mowner_ref(m, M_EXT|M_EXT_CLUSTER);
 }
 
 /*
diff -r b15dfab3e65b -r fdb5a1e58f4f sys/sys/mbuf.h
--- a/sys/sys/mbuf.h    Fri Apr 27 09:05:26 2018 +0000
+++ b/sys/sys/mbuf.h    Fri Apr 27 09:22:28 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbuf.h,v 1.195 2018/04/27 08:51:26 maxv Exp $  */
+/*     $NetBSD: mbuf.h,v 1.196 2018/04/27 09:22:28 maxv Exp $  */
 
 /*
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -507,29 +507,6 @@
  * a normal mbuf; the flag M_EXT is set upon success.
  */
 
-#define        _MCLGET(m, pool_cache, size, how)                               \
-do {                                                                   \
-       (m)->m_ext_storage.ext_buf = (char *)                           \
-           pool_cache_get_paddr((pool_cache),                          \
-               (how) == M_WAIT ? (PR_WAITOK|PR_LIMITFAIL) : PR_NOWAIT, \
-               &(m)->m_ext_storage.ext_paddr);                         \
-       if ((m)->m_ext_storage.ext_buf != NULL) {                       \
-               MCLINITREFERENCE(m);                                    \
-               (m)->m_data = (m)->m_ext.ext_buf;                       \
-               (m)->m_flags = ((m)->m_flags & ~M_EXTCOPYFLAGS) |       \
-                               M_EXT|M_EXT_CLUSTER|M_EXT_RW;           \
-               (m)->m_ext.ext_flags = 0;                               \
-               (m)->m_ext.ext_size = (size);                           \
-               (m)->m_ext.ext_free = NULL;                             \
-               (m)->m_ext.ext_arg = (pool_cache);                      \
-               /* ext_paddr initialized above */                       \
-               mowner_ref((m), M_EXT|M_EXT_CLUSTER);                   \
-       }                                                               \
-} while (/* CONSTCOND */ 0)
-
-/*
- * The standard mbuf cluster pool.
- */
 #define        MCLGET(m, how)  m_clget((m), (how))
 
 #define        MEXTMALLOC(m, size, how)                                        \



Home | Main Index | Thread Index | Old Index