Author: kevlo
Date: Thu Sep 15 07:41:48 2016
New Revision: 305824
URL: https://svnweb.freebsd.org/changeset/base/305824

Log:
  Remove the 4.3BSD compatible macro m_copy(), use m_copym() instead.
  
  Reviewed by:  gnn
  Differential Revision:        https://reviews.freebsd.org/D7878

Modified:
  head/sys/contrib/ipfilter/netinet/fil.c
  head/sys/contrib/ipfilter/netinet/ip_compat.h
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
  head/sys/kern/uipc_socket.c
  head/sys/net/if_arcsubr.c
  head/sys/net/if_fddisubr.c
  head/sys/net/if_iso88025subr.c
  head/sys/net/raw_usrreq.c
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_mroute.c
  head/sys/netinet/raw_ip.c
  head/sys/netinet/tcp_output.c
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/ip6_forward.c
  head/sys/netinet6/ip6_mroute.c
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/raw_ip6.c
  head/sys/netinet6/udp6_usrreq.c
  head/sys/netipsec/keysock.c
  head/sys/sys/mbuf.h

Modified: head/sys/contrib/ipfilter/netinet/fil.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/fil.c     Thu Sep 15 02:48:56 2016        
(r305823)
+++ head/sys/contrib/ipfilter/netinet/fil.c     Thu Sep 15 07:41:48 2016        
(r305824)
@@ -3226,7 +3226,7 @@ filterdone:
                fdp = fin->fin_dif;
                if ((fdp != NULL) && (fdp->fd_ptr != NULL) &&
                    (fdp->fd_ptr != (void *)-1)) {
-                       mc = M_COPY(fin->fin_m);
+                       mc = M_COPYM(fin->fin_m);
                        if (mc != NULL)
                                ipf_fastroute(mc, &mc, fin, fdp);
                }

Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_compat.h       Thu Sep 15 02:48:56 
2016        (r305823)
+++ head/sys/contrib/ipfilter/netinet/ip_compat.h       Thu Sep 15 07:41:48 
2016        (r305824)
@@ -211,7 +211,7 @@ struct  ether_addr {
 #  define      MSGDSIZE(m)     mbufchainlen(m)
 #  define      M_LEN(m)        (m)->m_len
 #  define      M_ADJ(m,x)      m_adj(m, x)
-#  define      M_COPY(x)       m_copy((x), 0, M_COPYALL)
+#  define      M_COPYM(x)      m_copym((x), 0, M_COPYALL, M_NOWAIT)
 #  define      M_DUP(m)        m_dup(m, M_NOWAIT)
 #  define      IPF_PANIC(x,y)  if (x) { printf y; panic("ipf_panic"); }
 typedef struct mbuf mb_t;
@@ -366,7 +366,7 @@ typedef     struct  mb_s    {
 # define       MSGDSIZE(m)     msgdsize(m)
 # define       M_LEN(m)        (m)->mb_len
 # define       M_ADJ(m,x)      (m)->mb_len += x
-# define       M_COPY(m)       dupmbt(m)
+# define       M_COPYM(m)      dupmbt(m)
 # define       M_DUP(m)        dupmbt(m)
 # define       GETKTIME(x)     gettimeofday((struct timeval *)(x), NULL)
 # define       MTOD(m, t)      ((t)(m)->mb_data)

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Thu Sep 15 02:48:56 
2016        (r305823)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Thu Sep 15 07:41:48 
2016        (r305824)
@@ -920,7 +920,7 @@ ipf_fastroute(m0, mpp, fin, fdp)
                        mhip->ip_off |= IP_MF;
                mhip->ip_len = htons((u_short)(len + mhlen));
                *mnext = m;
-               m->m_next = m_copy(m0, off, len);
+               m->m_next = m_copym(m0, off, len, M_NOWAIT);
                if (m->m_next == 0) {
                        error = ENOBUFS;        /* ??? */
                        goto sendorfree;

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c Thu Sep 15 02:48:56 2016        (r305823)
+++ head/sys/kern/uipc_socket.c Thu Sep 15 07:41:48 2016        (r305824)
@@ -1640,7 +1640,8 @@ dontblock:
                do {
                        if (flags & MSG_PEEK) {
                                if (controlp != NULL) {
-                                       *controlp = m_copy(m, 0, m->m_len);
+                                       *controlp = m_copym(m, 0, m->m_len,
+                                           M_NOWAIT);
                                        controlp = &(*controlp)->m_next;
                                }
                                m = m->m_next;

Modified: head/sys/net/if_arcsubr.c
==============================================================================
--- head/sys/net/if_arcsubr.c   Thu Sep 15 02:48:56 2016        (r305823)
+++ head/sys/net/if_arcsubr.c   Thu Sep 15 07:41:48 2016        (r305824)
@@ -225,7 +225,7 @@ arc_output(struct ifnet *ifp, struct mbu
 
        if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
                if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
-                       struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
+                       struct mbuf *n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
 
                        (void) if_simloop(ifp, n, dst->sa_family, ARC_HDRLEN);
                } else if (ah->arc_dhost == ah->arc_shost) {

Modified: head/sys/net/if_fddisubr.c
==============================================================================
--- head/sys/net/if_fddisubr.c  Thu Sep 15 02:48:56 2016        (r305823)
+++ head/sys/net/if_fddisubr.c  Thu Sep 15 07:41:48 2016        (r305824)
@@ -275,7 +275,7 @@ fddi_output(struct ifnet *ifp, struct mb
        if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
                if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
                        struct mbuf *n;
-                       n = m_copy(m, 0, (int)M_COPYALL);
+                       n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
                        (void) if_simloop(ifp, n, dst->sa_family,
                                          FDDI_HDR_LEN);
                } else if (bcmp(fh->fddi_dhost, fh->fddi_shost,

Modified: head/sys/net/if_iso88025subr.c
==============================================================================
--- head/sys/net/if_iso88025subr.c      Thu Sep 15 02:48:56 2016        
(r305823)
+++ head/sys/net/if_iso88025subr.c      Thu Sep 15 07:41:48 2016        
(r305824)
@@ -364,7 +364,7 @@ iso88025_output(struct ifnet *ifp, struc
         if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
                 if ((m->m_flags & M_BCAST) || (loop_copy > 0)) { 
                         struct mbuf *n;
-                       n = m_copy(m, 0, (int)M_COPYALL);
+                       n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
                         (void) if_simloop(ifp, n, dst->sa_family,
                                          ISO88025_HDR_LEN);
                 } else if (bcmp(th->iso88025_dhost, th->iso88025_shost,

Modified: head/sys/net/raw_usrreq.c
==============================================================================
--- head/sys/net/raw_usrreq.c   Thu Sep 15 02:48:56 2016        (r305823)
+++ head/sys/net/raw_usrreq.c   Thu Sep 15 07:41:48 2016        (r305824)
@@ -95,7 +95,7 @@ raw_input_ext(struct mbuf *m0, struct so
                        continue;
                if (last) {
                        struct mbuf *n;
-                       n = m_copy(m, 0, (int)M_COPYALL);
+                       n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
                        if (n) {
                                if (sbappendaddr(&last->so_rcv, src,
                                    n, (struct mbuf *)0) == 0)

Modified: head/sys/netinet/ip_input.c
==============================================================================
--- head/sys/netinet/ip_input.c Thu Sep 15 02:48:56 2016        (r305823)
+++ head/sys/netinet/ip_input.c Thu Sep 15 07:41:48 2016        (r305824)
@@ -1000,7 +1000,7 @@ ip_forward(struct mbuf *m, int srcrt)
         * because unnecessary, or because rate limited), so we are
         * really we are wasting a lot of work here.
         *
-        * We don't use m_copy() because it might return a reference
+        * We don't use m_copym() because it might return a reference
         * to a shared cluster. Both this function and ip_output()
         * assume exclusive access to the IP header in `m', so any
         * data in a cluster may change before we reach icmp_error().

Modified: head/sys/netinet/ip_mroute.c
==============================================================================
--- head/sys/netinet/ip_mroute.c        Thu Sep 15 02:48:56 2016        
(r305823)
+++ head/sys/netinet/ip_mroute.c        Thu Sep 15 07:41:48 2016        
(r305824)
@@ -1344,7 +1344,7 @@ X_ip_mforward(struct ip *ip, struct ifne
                goto fail;
 
            /* Make a copy of the header to send to the user level process */
-           mm = m_copy(mb0, 0, hlen);
+           mm = m_copym(mb0, 0, hlen, M_NOWAIT);
            if (mm == NULL)
                goto fail1;
 
@@ -1542,7 +1542,7 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp
                struct sockaddr_in k_igmpsrc = { sizeof k_igmpsrc, AF_INET };
                struct igmpmsg *im;
                int hlen = ip->ip_hl << 2;
-               struct mbuf *mm = m_copy(m, 0, hlen);
+               struct mbuf *mm = m_copym(m, 0, hlen, M_NOWAIT);
 
                if (mm && (!M_WRITABLE(mm) || mm->m_len < hlen))
                    mm = m_pullup(mm, hlen);
@@ -2734,9 +2734,9 @@ pim_input(struct mbuf **mp, int *offp, i
         * actions (e.g., send back PIM_REGISTER_STOP).
         * XXX: here m->m_data points to the outer IP header.
         */
-       mcp = m_copy(m, 0, iphlen + PIM_REG_MINLEN);
+       mcp = m_copym(m, 0, iphlen + PIM_REG_MINLEN, M_NOWAIT);
        if (mcp == NULL) {
-           CTR1(KTR_IPMF, "%s: m_copy() failed", __func__);
+           CTR1(KTR_IPMF, "%s: m_copym() failed", __func__);
            m_freem(m);
            return (IPPROTO_DONE);
        }

Modified: head/sys/netinet/raw_ip.c
==============================================================================
--- head/sys/netinet/raw_ip.c   Thu Sep 15 02:48:56 2016        (r305823)
+++ head/sys/netinet/raw_ip.c   Thu Sep 15 07:41:48 2016        (r305824)
@@ -322,7 +322,7 @@ rip_input(struct mbuf **mp, int *offp, i
                if (last != NULL) {
                        struct mbuf *n;
 
-                       n = m_copy(m, 0, (int)M_COPYALL);
+                       n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
                        if (n != NULL)
                            (void) rip_append(last, ip, n, &ripsrc);
                        /* XXX count dropped packet */
@@ -400,7 +400,7 @@ rip_input(struct mbuf **mp, int *offp, i
                if (last != NULL) {
                        struct mbuf *n;
 
-                       n = m_copy(m, 0, (int)M_COPYALL);
+                       n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
                        if (n != NULL)
                                (void) rip_append(last, ip, n, &ripsrc);
                        /* XXX count dropped packet */

Modified: head/sys/netinet/tcp_output.c
==============================================================================
--- head/sys/netinet/tcp_output.c       Thu Sep 15 02:48:56 2016        
(r305823)
+++ head/sys/netinet/tcp_output.c       Thu Sep 15 07:41:48 2016        
(r305824)
@@ -1049,7 +1049,7 @@ send:
                            mtod(m, caddr_t) + hdrlen);
                        m->m_len += len;
                } else {
-                       m->m_next = m_copy(mb, moff, (int)len);
+                       m->m_next = m_copym(mb, moff, len, M_NOWAIT);
                        if (m->m_next == NULL) {
                                SOCKBUF_UNLOCK(&so->so_snd);
                                (void) m_free(m);

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c       Thu Sep 15 02:48:56 2016        
(r305823)
+++ head/sys/netinet/udp_usrreq.c       Thu Sep 15 07:41:48 2016        
(r305824)
@@ -597,7 +597,8 @@ udp_input(struct mbuf **mp, int *offp, i
                        if (last != NULL) {
                                struct mbuf *n;
 
-                               if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
+                               if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) !=
+                                   NULL) {
                                        UDP_PROBE(receive, NULL, last, ip,
                                            last, uh);
                                        if (udp_append(last, ip, n, iphlen,

Modified: head/sys/netinet6/icmp6.c
==============================================================================
--- head/sys/netinet6/icmp6.c   Thu Sep 15 02:48:56 2016        (r305823)
+++ head/sys/netinet6/icmp6.c   Thu Sep 15 07:41:48 2016        (r305824)
@@ -554,7 +554,7 @@ icmp6_input(struct mbuf **mp, int *offp,
                icmp6_ifstat_inc(ifp, ifs6_in_echo);
                if (code != 0)
                        goto badcode;
-               if ((n = m_copy(m, 0, M_COPYALL)) == NULL) {
+               if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) {
                        /* Give up remote */
                        break;
                }
@@ -651,7 +651,7 @@ icmp6_input(struct mbuf **mp, int *offp,
                        IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_nodeinfo),
                            IPPROTO_DONE);
 #endif
-                       n = m_copy(m, 0, M_COPYALL);
+                       n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
                        if (n)
                                n = ni6_input(n, off);
                        /* XXX meaningless if n == NULL */
@@ -2039,7 +2039,7 @@ icmp6_rip6_input(struct mbuf **mp, int o
                                }
                        }
                        if (n != NULL ||
-                           (n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
+                           (n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) != NULL) {
                                if (last->inp_flags & INP_CONTROLOPTS)
                                        ip6_savecontrol(last, n, &opts);
                                /* strip intermediate headers */

Modified: head/sys/netinet6/ip6_forward.c
==============================================================================
--- head/sys/netinet6/ip6_forward.c     Thu Sep 15 02:48:56 2016        
(r305823)
+++ head/sys/netinet6/ip6_forward.c     Thu Sep 15 07:41:48 2016        
(r305824)
@@ -166,7 +166,8 @@ ip6_forward(struct mbuf *m, int srcrt)
         * It is important to save it before IPsec processing as IPsec
         * processing may modify the mbuf.
         */
-       mcopy = m_copy(m, 0, imin(m->m_pkthdr.len, ICMPV6_PLD_MAXLEN));
+       mcopy = m_copym(m, 0, imin(m->m_pkthdr.len, ICMPV6_PLD_MAXLEN),
+           M_NOWAIT);
 
 #ifdef IPSEC
        /* get a security policy for this packet */

Modified: head/sys/netinet6/ip6_mroute.c
==============================================================================
--- head/sys/netinet6/ip6_mroute.c      Thu Sep 15 02:48:56 2016        
(r305823)
+++ head/sys/netinet6/ip6_mroute.c      Thu Sep 15 07:41:48 2016        
(r305824)
@@ -1145,7 +1145,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru
                MFC6_UNLOCK();
                return (ENOBUFS);
        }
-       mb0 = m_copy(m, 0, M_COPYALL);
+       mb0 = m_copym(m, 0, M_COPYALL, M_NOWAIT);
        /*
         * Pullup packet header if needed before storing it,
         * as other references may modify it in the meantime.
@@ -1185,7 +1185,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru
                 * Make a copy of the header to send to the user
                 * level process
                 */
-               mm = m_copy(mb0, 0, sizeof(struct ip6_hdr));
+               mm = m_copym(mb0, 0, sizeof(struct ip6_hdr), M_NOWAIT);
                if (mm == NULL) {
                        free(rte, M_MRTABLE6);
                        m_freem(mb0);
@@ -1417,7 +1417,8 @@ ip6_mdq(struct mbuf *m, struct ifnet *if
                                struct omrt6msg *oim;
 #endif
 
-                               mm = m_copy(m, 0, sizeof(struct ip6_hdr));
+                               mm = m_copym(m, 0, sizeof(struct ip6_hdr),
+                                   M_NOWAIT);
                                if (mm &&
                                    (!M_WRITABLE(mm) ||
                                     mm->m_len < sizeof(struct ip6_hdr)))
@@ -1547,7 +1548,7 @@ phyint_send(struct ip6_hdr *ip6, struct 
         * the IPv6 header is actually copied, not just referenced,
         * so that ip6_output() only scribbles on the copy.
         */
-       mb_copy = m_copy(m, 0, M_COPYALL);
+       mb_copy = m_copym(m, 0, M_COPYALL, M_NOWAIT);
        if (mb_copy &&
            (!M_WRITABLE(mb_copy) || mb_copy->m_len < sizeof(struct ip6_hdr)))
                mb_copy = m_pullup(mb_copy, sizeof(struct ip6_hdr));
@@ -1651,7 +1652,7 @@ register_send(struct ip6_hdr *ip6, struc
        mm->m_data += max_linkhdr;
        mm->m_len = sizeof(struct ip6_hdr);
 
-       if ((mm->m_next = m_copy(m, 0, M_COPYALL)) == NULL) {
+       if ((mm->m_next = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) {
                m_freem(mm);
                return (ENOBUFS);
        }
@@ -1870,7 +1871,7 @@ pim6_input(struct mbuf **mp, int *offp, 
                /*
                 * make a copy of the whole header to pass to the daemon later.
                 */
-               mcp = m_copy(m, 0, off + PIM6_REG_MINLEN);
+               mcp = m_copym(m, 0, off + PIM6_REG_MINLEN, M_NOWAIT);
                if (mcp == NULL) {
                        MRT6_DLOG(DEBUG_ANY | DEBUG_ERR, "pim register: "
                            "could not copy register head");

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c      Thu Sep 15 02:48:56 2016        
(r305823)
+++ head/sys/netinet6/ip6_output.c      Thu Sep 15 07:41:48 2016        
(r305824)
@@ -259,7 +259,7 @@ ip6_fragment(struct ifnet *ifp, struct m
                        ip6f->ip6f_offlg |= IP6F_MORE_FRAG;
                mhip6->ip6_plen = htons((u_short)(mtu + hlen +
                    sizeof(*ip6f) - sizeof(struct ip6_hdr)));
-               if ((m_frgpart = m_copy(m0, off, mtu)) == NULL) {
+               if ((m_frgpart = m_copym(m0, off, mtu, M_NOWAIT)) == NULL) {
                        IP6STAT_INC(ip6s_odropped);
                        return (ENOBUFS);
                }
@@ -3003,7 +3003,7 @@ ip6_mloopback(struct ifnet *ifp, struct 
        struct mbuf *copym;
        struct ip6_hdr *ip6;
 
-       copym = m_copy(m, 0, M_COPYALL);
+       copym = m_copym(m, 0, M_COPYALL, M_NOWAIT);
        if (copym == NULL)
                return;
 

Modified: head/sys/netinet6/raw_ip6.c
==============================================================================
--- head/sys/netinet6/raw_ip6.c Thu Sep 15 02:48:56 2016        (r305823)
+++ head/sys/netinet6/raw_ip6.c Thu Sep 15 07:41:48 2016        (r305824)
@@ -256,7 +256,7 @@ rip6_input(struct mbuf **mp, int *offp, 
                        }
                }
                if (last != NULL) {
-                       struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
+                       struct mbuf *n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
 
 #ifdef IPSEC
                        /*

Modified: head/sys/netinet6/udp6_usrreq.c
==============================================================================
--- head/sys/netinet6/udp6_usrreq.c     Thu Sep 15 02:48:56 2016        
(r305823)
+++ head/sys/netinet6/udp6_usrreq.c     Thu Sep 15 07:41:48 2016        
(r305824)
@@ -366,7 +366,8 @@ udp6_input(struct mbuf **mp, int *offp, 
                        if (last != NULL) {
                                struct mbuf *n;
 
-                               if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
+                               if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) !=
+                                   NULL) {
                                        INP_RLOCK(last);
                                        UDP_PROBE(receive, NULL, last, ip6,
                                            last, uh);

Modified: head/sys/netipsec/keysock.c
==============================================================================
--- head/sys/netipsec/keysock.c Thu Sep 15 02:48:56 2016        (r305823)
+++ head/sys/netipsec/keysock.c Thu Sep 15 07:41:48 2016        (r305824)
@@ -301,7 +301,7 @@ key_sendup_mbuf(struct socket *so, struc
                 * (based on pf_...@inner.net message on 14 Oct 1998)
                 */
                if (((struct keycb *)rp)->kp_promisc) {
-                       if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
+                       if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) != NULL) {
                                (void)key_sendup0(rp, n, 1);
                                n = NULL;
                        }
@@ -331,7 +331,7 @@ key_sendup_mbuf(struct socket *so, struc
                if (!sendup)
                        continue;
 
-               if ((n = m_copy(m, 0, (int)M_COPYALL)) == NULL) {
+               if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) {
                        m_freem(m);
                        PFKEYSTAT_INC(in_nomem);
                        mtx_unlock(&rawcb_mtx);

Modified: head/sys/sys/mbuf.h
==============================================================================
--- head/sys/sys/mbuf.h Thu Sep 15 02:48:56 2016        (r305823)
+++ head/sys/sys/mbuf.h Thu Sep 15 07:41:48 2016        (r305824)
@@ -979,9 +979,6 @@ m_align(struct mbuf *m, int len)
 /* Length to m_copy to copy all. */
 #define        M_COPYALL       1000000000
 
-/* Compatibility with 4.3. */
-#define        m_copy(m, o, l) m_copym((m), (o), (l), M_NOWAIT)
-
 extern int             max_datalen;    /* MHLEN - max_hdr */
 extern int             max_hdr;        /* Largest link + protocol header */
 extern int             max_linkhdr;    /* Largest link-level header */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to