[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL for-2.1 02/24] virtio-blk: avoid qdev property defini
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL for-2.1 02/24] virtio-blk: avoid qdev property definition duplication |
Date: |
Tue, 1 Jul 2014 10:48:35 +0200 |
It becomes unwiedly to duplicate all virtio-blk qdev property
definitions due to an #ifdef. The C preprocessor syntax makes it a
little hard to resolve this cleanly but we can extract the #ifdef and
call a macro it defines later.
Avoiding duplication is important since it will only get worse when we
move the x-data-plane qdev property here too. We'd have a combinatorial
explosion since x-data-plane has its own #ifdef.
Suggested-by: Peter Crosthwaite <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Peter Crosthwaite <address@hidden>
---
include/hw/virtio/virtio-blk.h | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h
index d0fb26f..ee43f7a 100644
--- a/include/hw/virtio/virtio-blk.h
+++ b/include/hw/virtio/virtio-blk.h
@@ -156,21 +156,19 @@ typedef struct VirtIOBlockReq {
DEFINE_VIRTIO_COMMON_FEATURES(_state, _field)
#ifdef __linux__
-#define DEFINE_VIRTIO_BLK_PROPERTIES(_state, _field) \
- DEFINE_BLOCK_PROPERTIES(_state, _field.conf), \
- DEFINE_BLOCK_CHS_PROPERTIES(_state, _field.conf), \
- DEFINE_PROP_STRING("serial", _state, _field.serial), \
- DEFINE_PROP_BIT("config-wce", _state, _field.config_wce, 0, true), \
- DEFINE_PROP_BIT("scsi", _state, _field.scsi, 0, true), \
- DEFINE_PROP_IOTHREAD("x-iothread", _state, _field.iothread)
+#define DEFINE_VIRTIO_BLK_PROPERTIES_LINUX(_state, _field) \
+ DEFINE_PROP_BIT("scsi", _state, _field.scsi, 0, true),
#else
+#define DEFINE_VIRTIO_BLK_PROPERTIES_LINUX(_state, _field)
+#endif
+
#define DEFINE_VIRTIO_BLK_PROPERTIES(_state, _field) \
+ DEFINE_VIRTIO_BLK_PROPERTIES_LINUX(_state, _field) \
DEFINE_BLOCK_PROPERTIES(_state, _field.conf), \
DEFINE_BLOCK_CHS_PROPERTIES(_state, _field.conf), \
DEFINE_PROP_STRING("serial", _state, _field.serial), \
DEFINE_PROP_BIT("config-wce", _state, _field.config_wce, 0, true), \
DEFINE_PROP_IOTHREAD("x-iothread", _state, _field.iothread)
-#endif /* __linux__ */
void virtio_blk_set_conf(DeviceState *dev, VirtIOBlkConf *blk);
--
1.9.3
- [Qemu-devel] [PULL for-2.1 00/24] Block patches, Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 01/24] qom: add object_property_add_alias(), Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 02/24] virtio-blk: avoid qdev property definition duplication,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL for-2.1 04/24] virtio-blk: move x-data-plane qdev property to virtio-blk.h, Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 05/24] qdev: add qdev_alias_all_properties(), Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 03/24] dataplane: bail out on unsupported transport, Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 06/24] virtio-blk: use aliases instead of duplicate qdev properties, Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 07/24] virtio-blk: drop virtio_blk_set_conf(), Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 08/24] virtio: fix virtio-blk child refcount in transports, Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 09/24] virtio-blk: move qdev properties into virtio-blk.c, Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 10/24] virtio-blk: replace x-iothread with iothread link property, Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 11/24] qdev: drop iothread property type, Stefan Hajnoczi, 2014/07/01
- [Qemu-devel] [PULL for-2.1 12/24] virtio-blk: remove need for explicit x-data-plane=on option, Stefan Hajnoczi, 2014/07/01