WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Provide a variant of __RING_SIZE() that i

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Provide a variant of __RING_SIZE() that is an integer constant
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 24 Feb 2010 03:20:31 -0800
Delivery-date: Wed, 24 Feb 2010 03:21:50 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1267009436 0
# Node ID 9c0793e75f541c58bf99b2c480e89497a537114f
# Parent  3b475d9ed6b525ae221403714adaa58421b33f9f
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/include/public/io/ring.h  |    6 ++++++
 xen/include/public/io/usbif.h |    4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff -r 3b475d9ed6b5 -r 9c0793e75f54 xen/include/public/io/ring.h
--- a/xen/include/public/io/ring.h      Wed Feb 24 10:59:37 2010 +0000
+++ b/xen/include/public/io/ring.h      Wed Feb 24 11:03:56 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 3b475d9ed6b5 -r 9c0793e75f54 xen/include/public/io/usbif.h
--- a/xen/include/public/io/usbif.h     Wed Feb 24 10:59:37 2010 +0000
+++ b/xen/include/public/io/usbif.h     Wed Feb 24 11:03:56 2010 +0000
@@ -128,7 +128,7 @@ typedef struct usbif_urb_response usbif_
 typedef struct usbif_urb_response usbif_urb_response_t;
 
 DEFINE_RING_TYPES(usbif_urb, struct usbif_urb_request, struct 
usbif_urb_response);
-#define USB_URB_RING_SIZE __RING_SIZE((struct usbif_urb_sring *)0, PAGE_SIZE)
+#define USB_URB_RING_SIZE __CONST_RING_SIZE(usbif_urb, PAGE_SIZE)
 
 /*
  * RING for notifying connect/disconnect events to frontend
@@ -146,6 +146,6 @@ typedef struct usbif_conn_response usbif
 typedef struct usbif_conn_response usbif_conn_response_t;
 
 DEFINE_RING_TYPES(usbif_conn, struct usbif_conn_request, struct 
usbif_conn_response);
-#define USB_CONN_RING_SIZE __RING_SIZE((struct usbif_conn_sring *)0, PAGE_SIZE)
+#define USB_CONN_RING_SIZE __CONST_RING_SIZE(usbif_conn, PAGE_SIZE)
 
 #endif /* __XEN_PUBLIC_IO_USBIF_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Provide a variant of __RING_SIZE() that is an integer constant, Xen patchbot-unstable <=