|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH] compile fix for RING_HAS_UNCONSUMED_REQUESTS
# HG changeset patch
# User john.levon@xxxxxxx
# 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@xxxxxxx>
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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [PATCH] compile fix for RING_HAS_UNCONSUMED_REQUESTS,
John Levon <=
|
|
|
|
|