summaryrefslogtreecommitdiffstats
path: root/sys/net/netmap_user.h
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2012-10-03 21:41:20 +0000
committeremaste <emaste@FreeBSD.org>2012-10-03 21:41:20 +0000
commiteff3cfa56f68ba919d9022148cbf8f3c6e90757e (patch)
tree839ee148464ce76a273ba161828b410e385a1938 /sys/net/netmap_user.h
parentfc02898d2b53483e0c3e7ac6b4d1520e27365095 (diff)
downloadFreeBSD-src-eff3cfa56f68ba919d9022148cbf8f3c6e90757e.zip
FreeBSD-src-eff3cfa56f68ba919d9022148cbf8f3c6e90757e.tar.gz
Cast through void * to silence compiler warning
The base netmap pointer and offsets involved are provided by the kernel side of the netmap interface and will have appropriate alignment. Sponsored by: ADARA Networks MFC After: 2 weeks
Diffstat (limited to 'sys/net/netmap_user.h')
-rw-r--r--sys/net/netmap_user.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/net/netmap_user.h b/sys/net/netmap_user.h
index 743ec32..cefbec7 100644
--- a/sys/net/netmap_user.h
+++ b/sys/net/netmap_user.h
@@ -62,15 +62,16 @@
#ifndef _NET_NETMAP_USER_H_
#define _NET_NETMAP_USER_H_
-#define NETMAP_IF(b, o) (struct netmap_if *)((char *)(b) + (o))
+#define _NETMAP_OFFSET(type, ptr, offset) \
+ ((type)(void *)((char *)(ptr) + (offset)))
-#define NETMAP_TXRING(nifp, index) \
- ((struct netmap_ring *)((char *)(nifp) + \
- (nifp)->ring_ofs[index] ) )
+#define NETMAP_IF(b, o) _NETMAP_OFFSET(struct netmap_if *, b, o)
-#define NETMAP_RXRING(nifp, index) \
- ((struct netmap_ring *)((char *)(nifp) + \
- (nifp)->ring_ofs[index + (nifp)->ni_tx_rings + 1] ) )
+#define NETMAP_TXRING(nifp, index) _NETMAP_OFFSET(struct netmap_ring *, \
+ nifp, (nifp)->ring_ofs[index] )
+
+#define NETMAP_RXRING(nifp, index) _NETMAP_OFFSET(struct netmap_ring *, \
+ nifp, (nifp)->ring_ofs[index + (nifp)->ni_tx_rings + 1] )
#define NETMAP_BUF(ring, index) \
((char *)(ring) + (ring)->buf_ofs + ((index)*(ring)->nr_buf_size))
OpenPOWER on IntegriCloud