Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xen: Provide a variant of __RING_SIZE() that is an integer constant expression

Without this, gcc 4.5 won't compile xen-netfront and xen-blkfront, where
this is being used to specify array sizes.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: David Miller <davem@davemloft.net>
Cc: Stable Kernel <stable@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jeremy Fitzhardinge and committed by
Linus Torvalds
667c78af 6c965ff5

+12 -5
+1 -1
drivers/block/xen-blkfront.c
··· 72 72 static DEFINE_MUTEX(blkfront_mutex); 73 73 static const struct block_device_operations xlvbd_block_fops; 74 74 75 - #define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE) 75 + #define BLK_RING_SIZE __CONST_RING_SIZE(blkif, PAGE_SIZE) 76 76 77 77 /* 78 78 * We have one of these per vbd, whether ide, scsi or 'other'. They
+2 -2
drivers/net/xen-netfront.c
··· 66 66 67 67 #define GRANT_INVALID_REF 0 68 68 69 - #define NET_TX_RING_SIZE __RING_SIZE((struct xen_netif_tx_sring *)0, PAGE_SIZE) 70 - #define NET_RX_RING_SIZE __RING_SIZE((struct xen_netif_rx_sring *)0, PAGE_SIZE) 69 + #define NET_TX_RING_SIZE __CONST_RING_SIZE(xen_netif_tx, PAGE_SIZE) 70 + #define NET_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE) 71 71 #define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256) 72 72 73 73 struct netfront_info {
+9 -2
include/xen/interface/io/ring.h
··· 24 24 * A ring contains as many entries as will fit, rounded down to the nearest 25 25 * power of two (so we can mask with (size-1) to loop around). 26 26 */ 27 - #define __RING_SIZE(_s, _sz) \ 28 - (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0]))) 27 + #define __CONST_RING_SIZE(_s, _sz) \ 28 + (__RD32(((_sz) - offsetof(struct _s##_sring, ring)) / \ 29 + sizeof(((struct _s##_sring *)0)->ring[0]))) 30 + 31 + /* 32 + * The same for passing in an actual pointer instead of a name tag. 33 + */ 34 + #define __RING_SIZE(_s, _sz) \ 35 + (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0]))) 29 36 30 37 /* 31 38 * Macros to make the correct C datatypes for a new kind of ring.