qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 1/5] ide: Split qdev "ide-drive" into "ide-hd


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH v2 1/5] ide: Split qdev "ide-drive" into "ide-hd" and "ide-cd"
Date: Mon, 09 May 2011 13:59:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110318 Red Hat/3.1.9-3.el6_0 Thunderbird/3.1.9

  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

[Prev in Thread] Current Thread [Next in Thread]