summaryrefslogtreecommitdiff
path: root/xen/public/io/ring.h
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-03-31 03:13:57 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-03-31 03:13:57 +0200
commit2926f6f92dab25ba19c3e758931e6b3e34db1891 (patch)
treeae8bd9136ad1e40c56bd96c5dbe17c48c6bd73fc /xen/public/io/ring.h
parent2e1342cdcd9907076015398fd47943c191633518 (diff)
xen: fix const warning
* xen/public/io/ring.h (__CONST_RING_SIZE): Add macro from upstream * xen/net.c (WINDOW): Use __CONST_RING_SIZE instead of __RING_SIZE.
Diffstat (limited to 'xen/public/io/ring.h')
-rw-r--r--xen/public/io/ring.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/xen/public/io/ring.h b/xen/public/io/ring.h
index 6ce1d0d4..8669564b 100644
--- a/xen/public/io/ring.h
+++ b/xen/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])))