[rtems-libbsd commit] C++ compatibility for some kernel headers
Sebastian Huber
sebh at rtems.org
Wed Sep 17 09:51:53 UTC 2014
Module: rtems-libbsd
Branch: master
Commit: 62bdb6ae503cb9f921317ac056585af316054d49
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=62bdb6ae503cb9f921317ac056585af316054d49
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Aug 29 11:05:19 2014 +0200
C++ compatibility for some kernel headers
---
freebsd/sys/net/if_var.h | 16 ++++++++--------
freebsd/sys/sys/buf_ring.h | 15 ++++++++++-----
freebsd/sys/sys/mbuf.h | 11 ++++++-----
freebsd/sys/sys/systm.h | 2 +-
4 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/freebsd/sys/net/if_var.h b/freebsd/sys/net/if_var.h
index 5992fa0..fb590fa 100644
--- a/freebsd/sys/net/if_var.h
+++ b/freebsd/sys/net/if_var.h
@@ -612,7 +612,7 @@ drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m)
}
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 *new_mbuf)
{
/*
* The top of the list needs to be swapped
@@ -624,11 +624,11 @@ drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *new)
* Peek in altq case dequeued it
* so put it back.
*/
- IFQ_DRV_PREPEND(&ifp->if_snd, new);
+ IFQ_DRV_PREPEND(&ifp->if_snd, new_mbuf);
return;
}
#endif
- buf_ring_putback_sc(br, new);
+ buf_ring_putback_sc(br, new_mbuf);
}
static __inline struct mbuf *
@@ -647,7 +647,7 @@ drbr_peek(struct ifnet *ifp, struct buf_ring *br)
return (m);
}
#endif
- return(buf_ring_peek(br));
+ return ((struct mbuf *)buf_ring_peek(br));
}
static __inline void
@@ -659,7 +659,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);
}
@@ -682,7 +682,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
@@ -715,11 +715,11 @@ drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br,
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
diff --git a/freebsd/sys/sys/buf_ring.h b/freebsd/sys/sys/buf_ring.h
index 59e74cf..ee7a48c 100644
--- a/freebsd/sys/sys/buf_ring.h
+++ b/freebsd/sys/sys/buf_ring.h
@@ -99,7 +99,7 @@ buf_ring_enqueue(struct buf_ring *br, void *buf)
return (ENOBUFS);
}
- success = atomic_cmpset_int(&br->br_prod_head, prod_head,
+ success = atomic_cmpset_int((volatile int *)&br->br_prod_head, prod_head,
prod_next);
} while (success == 0);
#ifdef DEBUG_BUFRING
@@ -146,7 +146,7 @@ buf_ring_dequeue_mc(struct buf_ring *br)
return (NULL);
}
- success = atomic_cmpset_int(&br->br_cons_head, cons_head,
+ success = atomic_cmpset_int((volatile int *)&br->br_cons_head, cons_head,
cons_next);
} while (success == 0);
@@ -178,7 +178,10 @@ buf_ring_dequeue_mc(struct buf_ring *br)
static __inline void *
buf_ring_dequeue_sc(struct buf_ring *br)
{
- uint32_t cons_head, cons_next, cons_next_next;
+ uint32_t cons_head, cons_next;
+#ifdef PREFETCH_DEFINED
+ uint32_t cons_next_next;
+#endif
uint32_t prod_tail;
void *buf;
@@ -186,7 +189,9 @@ buf_ring_dequeue_sc(struct buf_ring *br)
prod_tail = br->br_prod_tail;
cons_next = (cons_head + 1) & br->br_cons_mask;
+#ifdef PREFETCH_DEFINED
cons_next_next = (cons_head + 2) & br->br_cons_mask;
+#endif
if (cons_head == prod_tail)
return (NULL);
@@ -254,11 +259,11 @@ buf_ring_advance_sc(struct buf_ring *br)
* the compare and an atomic.
*/
static __inline void
-buf_ring_putback_sc(struct buf_ring *br, void *new)
+buf_ring_putback_sc(struct buf_ring *br, void *new_item)
{
KASSERT(br->br_cons_head != br->br_prod_tail,
("Buf-Ring has none in putback")) ;
- br->br_ring[br->br_cons_head] = new;
+ br->br_ring[br->br_cons_head] = new_item;
}
/*
diff --git a/freebsd/sys/sys/mbuf.h b/freebsd/sys/sys/mbuf.h
index 391582c..1232875 100644
--- a/freebsd/sys/sys/mbuf.h
+++ b/freebsd/sys/sys/mbuf.h
@@ -529,7 +529,7 @@ m_getclr(int how, short type)
args.flags = 0;
args.type = type;
- m = uma_zalloc_arg(zone_mbuf, &args, how);
+ m = (struct mbuf *)uma_zalloc_arg(zone_mbuf, &args, how);
if (m != NULL)
bzero(m->m_data, MLEN);
return (m);
@@ -574,12 +574,12 @@ m_getjcl(int how, short type, int flags, int size)
args.flags = flags;
args.type = type;
- m = uma_zalloc_arg(zone_mbuf, &args, how);
+ m = (struct mbuf *)uma_zalloc_arg(zone_mbuf, &args, how);
if (m == NULL)
return (NULL);
zone = m_getzone(size);
- n = uma_zalloc_arg(zone, m, how);
+ n = (struct mbuf *)uma_zalloc_arg(zone, m, how);
if (n == NULL) {
uma_zfree(zone_mbuf, m);
return (NULL);
@@ -679,8 +679,9 @@ m_cljset(struct mbuf *m, void *cl, int type)
break;
}
- m->m_data = m->m_ext.ext_buf = cl;
- m->m_ext.ext_free = m->m_ext.ext_arg1 = m->m_ext.ext_arg2 = NULL;
+ m->m_data = m->m_ext.ext_buf = (caddr_t)cl;
+ m->m_ext.ext_free = NULL;
+ m->m_ext.ext_arg1 = m->m_ext.ext_arg2 = NULL;
m->m_ext.ext_size = size;
m->m_ext.ext_type = type;
m->m_ext.ref_cnt = (volatile u_int *) uma_find_refcnt(zone, cl);
diff --git a/freebsd/sys/sys/systm.h b/freebsd/sys/sys/systm.h
index 676bd9c..f16c30a 100644
--- a/freebsd/sys/sys/systm.h
+++ b/freebsd/sys/sys/systm.h
@@ -306,7 +306,7 @@ int fubyte(const void *base);
static inline int
fubyte(const void *base)
{
- const unsigned char *byte_base = base;
+ const unsigned char *byte_base = (const unsigned char *)base;
return byte_base[0];
}
More information about the vc
mailing list