summaryrefslogtreecommitdiff
path: root/sysutils/xentools33/patches/patch-io_ring_h
blob: b76e9f80a64edb8babf41ae73f4890e5bbea2d13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$NetBSD: patch-io_ring_h,v 1.1 2012/01/09 14:06:34 cegger Exp $

--- ../xen/include/public/io/ring.h.orig	2009-08-06 12:56:43.000000000 +0000
+++ ../xen/include/public/io/ring.h
@@ -50,6 +50,12 @@ typedef unsigned int RING_IDX;
  * 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])))