Skip to contentSkip to conversation

Add redundant '&' to the __RING_SIZE macro for Windows.

PATCH New Kirk Allan 1 participant 1 message Oct 26, 2006

lore
Share & tools
lore

Kirk Allan

author
#0 lore raw

PATCH 1/1 Add redundant '&' to the __RING_SIZE macro for Windows.

When building PV drivers for Windows guests using the Window's DDK, without the '&' you get the compiler error, “error C2057: expected constant expression”, when using the macro for array sizes.

Applies to xen-3.0.3 and xen-unstable.

signed-off-by Kirk Allan <[email protected]>

xen/include/public/io/ring.h +5 -0
@@ -24,8 +24,13 @@
  * A ring contains as many entries as will fit, rounded down to the nearest 
  * power of two (so we can mask with (size-1) to loop around).
  */
+#ifdef _MSC_VER
+#define __RING_SIZE(_s, _sz) \
+    (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))
+#else
 #define __RING_SIZE(_s, _sz) \
     (__RD32(((_sz) - (long)(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))
+#endif
 
 /*
  * Macros to make the correct C datatypes for a new kind of ring.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel