Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Oct 2012 21:41:20 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241166 - head/sys/net
Message-ID:  <201210032141.q93LfK51097319@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210032141.q93LfK51097319>