Hi,

+#define DEFINE_IDE_DEV_PROPERTIES()                     \
+    DEFINE_PROP_UINT32("unit", IDEDrive, dev.unit, -1), \
+    DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf),        \
+    DEFINE_PROP_STRING("ver",  IDEDrive, dev.version),  \
+    DEFINE_PROP_STRING("serial",  IDEDrive, dev.serial)

This can also be done this way:

static Property ide_properties[] = {
    DEFINE_PROP_UINT32("unit", IDEDrive, dev.unit, -1),
    [ ... ]
    DEFINE_PROP_END_OF_LIST(),
};

+static IDEDeviceInfo ide_dev_info[] = {
+    {
+        .qdev.name    = "ide-hd",
+        .qdev.fw_name = "drive",
+        .qdev.desc    = "virtual IDE disk",
+        .qdev.size    = sizeof(IDEDrive),
+        .init         = ide_hd_initfn,

           .qdev.props   = ide_properties,

Works only as long as all devices have exactly the same set (i.e. for scsi it wouldn't work as not all devices have the "removable" property).

I tend to like this more than the #define.  YMMV, matter of taste.

cheers,
  Gerd

Reply via email to