# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1267010125 0
# Node ID 9737c095f85023c26af96c27e9db2e8f38041e17
# Parent 8101ab9db4de83fdc6fd1520c079701bea13df49
Provide a variant of __RING_SIZE() that is an integer constant
expression
Without that, gcc 4.5 won't compile (at least) netfront, where this is
being used to specify array sizes.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
xen-unstable changeset: 20975:9c0793e75f54
xen-unstable date: Wed Feb 24 11:03:56 2010 +0000
---
xen/include/public/io/ring.h | 6 ++++++
xen/include/public/io/usbif.h | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff -r 8101ab9db4de -r 9737c095f850 xen/include/public/io/ring.h
--- a/xen/include/public/io/ring.h Wed Feb 24 11:12:56 2010 +0000
+++ b/xen/include/public/io/ring.h Wed Feb 24 11:15:25 2010 +0000
@@ -49,6 +49,12 @@ typedef unsigned int RING_IDX;
* ring and indexes (_sz), and the name tag of the request/response structure.
* 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).
+ */
+#define __CONST_RING_SIZE(_s, _sz) \
+ (__RD32(((_sz) - offsetof(struct _s##_sring, ring)) / \
+ sizeof(((struct _s##_sring *)0)->ring[0])))
+/*
+ * The same for passing in an actual pointer instead of a name tag.
*/
#define __RING_SIZE(_s, _sz) \
(__RD32(((_sz) - (long)(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))
diff -r 8101ab9db4de -r 9737c095f850 xen/include/public/io/usbif.h
--- a/xen/include/public/io/usbif.h Wed Feb 24 11:12:56 2010 +0000
+++ b/xen/include/public/io/usbif.h Wed Feb 24 11:15:25 2010 +0000
@@ -116,6 +116,6 @@ typedef struct usbif_response usbif_resp
typedef struct usbif_response usbif_response_t;
DEFINE_RING_TYPES(usbif, struct usbif_request, struct usbif_response);
-#define USB_RING_SIZE __RING_SIZE((struct usbif_sring *)0, PAGE_SIZE)
+#define USB_RING_SIZE __CONST_RING_SIZE(usbif, PAGE_SIZE)
#endif /* __XEN_PUBLIC_IO_USBIF_H__ */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|