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-devel

[Xen-devel] [PATCH] compile fix for RING_HAS_UNCONSUMED_REQUESTS

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] compile fix for RING_HAS_UNCONSUMED_REQUESTS
From: John Levon <levon@xxxxxxxxxxxxxxxxx>
Date: Tue, 17 Oct 2006 14:29:53 +0100
Delivery-date: Tue, 17 Oct 2006 06:30:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
# 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