debuggers.hg
changeset 21021:9c0793e75f54
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@novell.com>
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@novell.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Wed Feb 24 11:03:56 2010 +0000 (2010-02-24) |
parents | 3b475d9ed6b5 |
children | f8692cc67d67 |
files | xen/include/public/io/ring.h xen/include/public/io/usbif.h |
line diff
1.1 --- a/xen/include/public/io/ring.h Wed Feb 24 10:59:37 2010 +0000 1.2 +++ b/xen/include/public/io/ring.h Wed Feb 24 11:03:56 2010 +0000 1.3 @@ -50,6 +50,12 @@ typedef unsigned int RING_IDX; 1.4 * A ring contains as many entries as will fit, rounded down to the nearest 1.5 * power of two (so we can mask with (size-1) to loop around). 1.6 */ 1.7 +#define __CONST_RING_SIZE(_s, _sz) \ 1.8 + (__RD32(((_sz) - offsetof(struct _s##_sring, ring)) / \ 1.9 + sizeof(((struct _s##_sring *)0)->ring[0]))) 1.10 +/* 1.11 + * The same for passing in an actual pointer instead of a name tag. 1.12 + */ 1.13 #define __RING_SIZE(_s, _sz) \ 1.14 (__RD32(((_sz) - (long)(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0]))) 1.15
2.1 --- a/xen/include/public/io/usbif.h Wed Feb 24 10:59:37 2010 +0000 2.2 +++ b/xen/include/public/io/usbif.h Wed Feb 24 11:03:56 2010 +0000 2.3 @@ -128,7 +128,7 @@ struct usbif_urb_response { 2.4 typedef struct usbif_urb_response usbif_urb_response_t; 2.5 2.6 DEFINE_RING_TYPES(usbif_urb, struct usbif_urb_request, struct usbif_urb_response); 2.7 -#define USB_URB_RING_SIZE __RING_SIZE((struct usbif_urb_sring *)0, PAGE_SIZE) 2.8 +#define USB_URB_RING_SIZE __CONST_RING_SIZE(usbif_urb, PAGE_SIZE) 2.9 2.10 /* 2.11 * RING for notifying connect/disconnect events to frontend 2.12 @@ -146,6 +146,6 @@ struct usbif_conn_response { 2.13 typedef struct usbif_conn_response usbif_conn_response_t; 2.14 2.15 DEFINE_RING_TYPES(usbif_conn, struct usbif_conn_request, struct usbif_conn_response); 2.16 -#define USB_CONN_RING_SIZE __RING_SIZE((struct usbif_conn_sring *)0, PAGE_SIZE) 2.17 +#define USB_CONN_RING_SIZE __CONST_RING_SIZE(usbif_conn, PAGE_SIZE) 2.18 2.19 #endif /* __XEN_PUBLIC_IO_USBIF_H__ */