[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [SOLARIS] Provide non-gcc-specific defn. of RING_HAS_UNCONSUMED_REQUESTS.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 317e71a06828aa729be7e9fbd371fff1c50e9d65
# Parent  cd2a7dd4578701313afd6574353b046692dedea3
[SOLARIS] Provide non-gcc-specific defn. of RING_HAS_UNCONSUMED_REQUESTS.
From: Mark Johnson <mark.johnson@xxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/include/public/io/ring.h |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff -r cd2a7dd45787 -r 317e71a06828 xen/include/public/io/ring.h
--- a/xen/include/public/io/ring.h      Tue Oct 17 19:03:47 2006 +0100
+++ b/xen/include/public/io/ring.h      Tue Oct 17 19:04:46 2006 +0100
@@ -152,7 +152,7 @@ typedef struct __name##_back_ring __name
     ((_r)->nr_ents)
 
 /* Number of free requests (for use on front side only). */
-#define RING_FREE_REQUESTS(_r)                                         \
+#define RING_FREE_REQUESTS(_r)                                          \
     (RING_SIZE(_r) - ((_r)->req_prod_pvt - (_r)->rsp_cons))
 
 /* Test if there is an empty slot available on the front ring.
@@ -165,13 +165,21 @@ typedef struct __name##_back_ring __name
 #define RING_HAS_UNCONSUMED_RESPONSES(_r)                               \
     ((_r)->sring->rsp_prod - (_r)->rsp_cons)
 
+#ifdef __GNUC__
+#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;                                              \
+})
+#else
+/* Same as above, but without the nice GCC ({ ... }) syntax. */
 #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)))
+#endif
 
 /* Direct access to individual ring elements, by index. */
 #define RING_GET_REQUEST(_r, _idx)                                      \

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.