Author: mhorne
Date: Fri Nov 20 14:45:45 2020
New Revision: 367894
URL: https://svnweb.freebsd.org/changeset/base/367894

Log:
  Make net/ifq.h C++ friendly
  
  Don't use "new" as an identifier, and add explicit casts from void *.
  
  As a general policy, FreeBSD doesn't make any C++ compatibility
  guarantees for kernel headers like it does for userland, but it is a
  small effort to do so in this case, to the benefit of a downstream
  consumer (NetApp).
  
  Reviewed by:  rscheff
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:        https://reviews.freebsd.org/D27286

Modified:
  head/sys/net/ifq.h

Modified: head/sys/net/ifq.h
==============================================================================
--- head/sys/net/ifq.h  Fri Nov 20 14:37:07 2020        (r367893)
+++ head/sys/net/ifq.h  Fri Nov 20 14:45:45 2020        (r367894)
@@ -336,7 +336,7 @@ drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, s
 }
 
 static __inline void
-drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *new)
+drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m_new)
 {
        /*
         * The top of the list needs to be swapped 
@@ -348,11 +348,11 @@ drbr_putback(struct ifnet *ifp, struct buf_ring *br, s
                 * Peek in altq case dequeued it
                 * so put it back.
                 */
-               IFQ_DRV_PREPEND(&ifp->if_snd, new);
+               IFQ_DRV_PREPEND(&ifp->if_snd, m_new);
                return;
        }
 #endif
-       buf_ring_putback_sc(br, new);
+       buf_ring_putback_sc(br, m_new);
 }
 
 static __inline struct mbuf *
@@ -371,7 +371,7 @@ drbr_peek(struct ifnet *ifp, struct buf_ring *br)
                return (m);
        }
 #endif
-       return(buf_ring_peek_clear_sc(br));
+       return ((struct mbuf *)buf_ring_peek_clear_sc(br));
 }
 
 static __inline void
@@ -383,7 +383,7 @@ drbr_flush(struct ifnet *ifp, struct buf_ring *br)
        if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd))
                IFQ_PURGE(&ifp->if_snd);
 #endif 
-       while ((m = buf_ring_dequeue_sc(br)) != NULL)
+       while ((m = (struct mbuf *)buf_ring_dequeue_sc(br)) != NULL)
                m_freem(m);
 }
 
@@ -406,7 +406,7 @@ drbr_dequeue(struct ifnet *ifp, struct buf_ring *br)
                return (m);
        }
 #endif
-       return (buf_ring_dequeue_sc(br));
+       return ((struct mbuf *)buf_ring_dequeue_sc(br));
 }
 
 static __inline void
@@ -438,11 +438,11 @@ drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *
                return (m);
        }
 #endif
-       m = buf_ring_peek(br);
+       m = (struct mbuf *)buf_ring_peek(br);
        if (m == NULL || func(m, arg) == 0)
                return (NULL);
 
-       return (buf_ring_dequeue_sc(br));
+       return ((struct mbuf *)buf_ring_dequeue_sc(br));
 }
 
 static __inline int
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to