Source-Changes-HG archive

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

[src/trunk]: src/sys/net dedup



details:   https://anonhg.NetBSD.org/src/rev/c262c85493b0
branches:  trunk
changeset: 454514:c262c85493b0
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Sep 20 08:45:29 2019 +0000

description:
dedup

diffstat:

 sys/net/if_ppp.c  |  19 +++----------------
 sys/net/ppp_tty.c |  23 +++++------------------
 2 files changed, 8 insertions(+), 34 deletions(-)

diffs (112 lines):

diff -r 5f15fce73348 -r c262c85493b0 sys/net/if_ppp.c
--- a/sys/net/if_ppp.c  Fri Sep 20 05:35:27 2019 +0000
+++ b/sys/net/if_ppp.c  Fri Sep 20 08:45:29 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ppp.c,v 1.165 2019/06/25 12:30:50 msaitoh Exp $     */
+/*     $NetBSD: if_ppp.c,v 1.166 2019/09/20 08:45:29 maxv Exp $        */
 /*     Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp       */
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.165 2019/06/25 12:30:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.166 2019/09/20 08:45:29 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -181,19 +181,6 @@
 extern struct linesw ppp_disc;
 
 /*
- * Some useful mbuf macros not in mbuf.h.
- */
-#define M_IS_CLUSTER(m)        ((m)->m_flags & M_EXT)
-
-#define M_DATASTART(m)                                                 \
-       (M_IS_CLUSTER(m) ? (m)->m_ext.ext_buf :                         \
-           (m)->m_flags & M_PKTHDR ? (m)->m_pktdat : (m)->m_dat)
-
-#define M_DATASIZE(m)                                                  \
-       (M_IS_CLUSTER(m) ? (m)->m_ext.ext_size :                        \
-           (m)->m_flags & M_PKTHDR ? MHLEN: MLEN)
-
-/*
  * We define two link layer specific mbuf flags, to mark high-priority
  * packets for output, and received packets following lost/corrupted
  * packets.
@@ -1624,7 +1611,7 @@
         * If the packet will fit in a header mbuf, don't waste a
         * whole cluster on it.
         */
-       if (ilen <= MHLEN && M_IS_CLUSTER(m)) {
+       if (ilen <= MHLEN && (m->m_flags & M_EXT)) {
                MGETHDR(mp, M_DONTWAIT, MT_DATA);
                if (mp != NULL) {
                        m_copydata(m, 0, ilen, mtod(mp, void *));
diff -r 5f15fce73348 -r c262c85493b0 sys/net/ppp_tty.c
--- a/sys/net/ppp_tty.c Fri Sep 20 05:35:27 2019 +0000
+++ b/sys/net/ppp_tty.c Fri Sep 20 08:45:29 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $   */
+/*     $NetBSD: ppp_tty.c,v 1.66 2019/09/20 08:45:29 maxv Exp $        */
 /*     Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp      */
 
 /*
@@ -93,7 +93,7 @@
 /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.66 2019/09/20 08:45:29 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -166,19 +166,6 @@
 static void    pppdumpframe(struct ppp_softc *sc, struct mbuf* m, int xmit);
 
 /*
- * Some useful mbuf macros not in mbuf.h.
- */
-#define M_IS_CLUSTER(m)        ((m)->m_flags & M_EXT)
-
-#define M_DATASTART(m) \
-       (M_IS_CLUSTER(m) ? (m)->m_ext.ext_buf : \
-           (m)->m_flags & M_PKTHDR ? (m)->m_pktdat : (m)->m_dat)
-
-#define M_DATASIZE(m)  \
-       (M_IS_CLUSTER(m) ? (m)->m_ext.ext_size : \
-           (m)->m_flags & M_PKTHDR ? MHLEN: MLEN)
-
-/*
  * Does c need to be escaped?
  */
 #define ESCAPE_P(c)    (sc->sc_asyncmap[(c) >> 5] & (1 << ((c) & 0x1F)))
@@ -969,7 +956,7 @@
            *mp = m;
            MCLGET(m, M_DONTWAIT);
        }
-       len -= M_DATASIZE(m);
+       len -= M_BUFSIZE(m);
        mp = &m->m_next;
     }
 }
@@ -1137,7 +1124,7 @@
        }
        m = sc->sc_m;
        m->m_len = 0;
-       m->m_data = M_DATASTART(sc->sc_m);
+       MRESETDATA(m);
        sc->sc_mc = m;
        sc->sc_mp = mtod(m, char *);
        sc->sc_fcs = PPP_INITFCS;
@@ -1193,7 +1180,7 @@
        }
        sc->sc_mc = m = m->m_next;
        m->m_len = 0;
-       m->m_data = M_DATASTART(m);
+       MRESETDATA(m);
        sc->sc_mp = mtod(m, char *);
     }
 



Home | Main Index | Thread Index | Old Index