John Levon
2006-Oct-17 13:29 UTC
[Xen-devel] [PATCH] compile fix for RING_HAS_UNCONSUMED_REQUESTS
# HG changeset patch
# User john.levon@sun.com
# Date 1161091691 25200
# Node ID ae762c159e7311a5a19e6b29227a665994a1325b
# Parent a58e7e6dde6b1f6094ea07917b3db794082c409b
fixes to compile ring.h on solaris with Sun''s cc
Signed-off-by: Mark Johnson <mark.johnson@sun.com>
diff --git a/xen/include/public/io/ring.h b/xen/include/public/io/ring.h
--- a/xen/include/public/io/ring.h
+++ b/xen/include/public/io/ring.h
@@ -27,6 +27,12 @@ typedef unsigned int RING_IDX;
#define __RING_SIZE(_s, _sz) \
(__RD32(((_sz) - (long)(_s)->ring + (long)(_s)) /
sizeof((_s)->ring[0])))
+/* Solaris equivalents */
+#ifdef _SOLARIS
+#define wmb membar_producer
+#define mb membar_enter
+#endif
+
/*
* Macros to make the correct C datatypes for a new kind of ring.
*
@@ -166,12 +172,10 @@ typedef struct __name##_back_ring __name
((_r)->sring->rsp_prod - (_r)->rsp_cons)
#define RING_HAS_UNCONSUMED_REQUESTS(_r) \
- ({ \
- unsigned int req = (_r)->sring->req_prod - (_r)->req_cons; \
- unsigned int rsp = RING_SIZE(_r) - \
- ((_r)->req_cons - (_r)->rsp_prod_pvt); \
- req < rsp ? req : rsp; \
- })
+ (((_r)->sring->req_prod - (_r)->req_cons) < \
+ (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))) ? \
+ ((_r)->sring->req_prod - (_r)->req_cons) : \
+ (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))
/* Direct access to individual ring elements, by index. */
#define RING_GET_REQUEST(_r, _idx) \
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Keir Fraser
2006-Oct-17 13:42 UTC
Re: [Xen-devel] [PATCH] compile fix for RING_HAS_UNCONSUMED_REQUESTS
On 17/10/06 14:29, "John Levon" <levon@movementarian.org> wrote:> fixes to compile ring.h on solaris with Sun''s cc > > Signed-off-by: Mark Johnson <mark.johnson@sun.com>Not nice. I assume you snapshot the headers anyway, so you''ll just have to patch as you do so. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
John Levon
2006-Oct-17 13:45 UTC
Re: [Xen-devel] [PATCH] compile fix for RING_HAS_UNCONSUMED_REQUESTS
On Tue, Oct 17, 2006 at 02:42:05PM +0100, Keir Fraser wrote:> > fixes to compile ring.h on solaris with Sun''s cc > > > > Signed-off-by: Mark Johnson <mark.johnson@sun.com> > > Not nice. I assume you snapshot the headers anyway, so you''ll just have to > patch as you do so.Yes, we do. Having to patch from upstream is a constant pain, even with mq. If GCC-specific gunk is OK we''ll eventually end up diverging totally as people use GCC stuff more and more. It''s a pretty vile define anyway... regards, john _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Oct-17 18:02 UTC
Re: [Xen-devel] [PATCH] compile fix for RING_HAS_UNCONSUMED_REQUESTS
On 17/10/06 14:29, "John Levon" <levon@movementarian.org> wrote:> # HG changeset patch > # User john.levon@sun.com > # Date 1161091691 25200 > # Node ID ae762c159e7311a5a19e6b29227a665994a1325b > # Parent a58e7e6dde6b1f6094ea07917b3db794082c409b > fixes to compile ring.h on solaris with Sun''s cc > > Signed-off-by: Mark Johnson <mark.johnson@sun.com>I like the gcc syntax so I''ll take the patch version of that macro as a non-GNUC alternative, so both live in the upstream header file. I''m not taking the chunk with the mb/wmb definitions for Solaris. It''s up to the user of this public header file to provide suitable definitions external to this header file. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
John Levon
2006-Oct-17 18:08 UTC
Re: [Xen-devel] [PATCH] compile fix for RING_HAS_UNCONSUMED_REQUESTS
On Tue, Oct 17, 2006 at 07:02:35PM +0100, Keir Fraser wrote:> > # Parent a58e7e6dde6b1f6094ea07917b3db794082c409b > > fixes to compile ring.h on solaris with Sun''s cc > > I like the gcc syntax so I''ll take the patch version of that macro as a > non-GNUC alternative, so both live in the upstream header file. I''m not > taking the chunk with the mb/wmb definitions for Solaris. It''s up to the > user of this public header file to provide suitable definitions external to > this header file.OK, sure. thanks, john _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel