svn commit: r241166 - head/sys/net

Ed Maste emaste at FreeBSD.org
Wed Oct 3 21:41:20 UTC 2012


Author: emaste
Date: Wed Oct  3 21:41:20 2012
New Revision: 241166
URL: http://svn.freebsd.org/changeset/base/241166

Log:
  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

Modified:
  head/sys/net/netmap_user.h

Modified: head/sys/net/netmap_user.h
==============================================================================
--- head/sys/net/netmap_user.h	Wed Oct  3 20:39:11 2012	(r241165)
+++ head/sys/net/netmap_user.h	Wed Oct  3 21:41:20 2012	(r241166)
@@ -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_RXRING(nifp, index)			\
-	((struct netmap_ring *)((char *)(nifp) +	\
-	    (nifp)->ring_ofs[index + (nifp)->ni_tx_rings + 1] ) )
+#define NETMAP_IF(b, o)	_NETMAP_OFFSET(struct netmap_if *, b, o)
+
+#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))


More information about the svn-src-all mailing list