Patchwork [v3,053/197] kill off SCSIDeviceInfo

login
register
mail settings
Submitter Anthony Liguori
Date Dec. 12, 2011, 8:18 p.m.
Message ID <1323721273-32404-54-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/130886/
State New
Headers show

Comments

Anthony Liguori - Dec. 12, 2011, 8:18 p.m.
---
 hw/scsi-bus.c     |   12 +++++-----
 hw/scsi-disk.c    |   64 ++++++++++++++++++++++++++--------------------------
 hw/scsi-generic.c |   16 ++++++------
 hw/scsi.h         |    7 +-----
 4 files changed, 47 insertions(+), 52 deletions(-)

Patch

diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index cabdb3c..d017ece 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -183,13 +183,13 @@  static int scsi_qdev_exit(DeviceState *qdev)
     return 0;
 }
 
-void scsi_qdev_register(SCSIDeviceInfo *info)
+void scsi_qdev_register(DeviceInfo *info)
 {
-    info->qdev.bus_info = &scsi_bus_info;
-    info->qdev.init     = scsi_qdev_init;
-    info->qdev.unplug   = qdev_simple_unplug_cb;
-    info->qdev.exit     = scsi_qdev_exit;
-    qdev_register_subclass(&info->qdev, TYPE_SCSI_DEVICE);
+    info->bus_info = &scsi_bus_info;
+    info->init     = scsi_qdev_init;
+    info->unplug   = qdev_simple_unplug_cb;
+    info->exit     = scsi_qdev_exit;
+    qdev_register_subclass(info, TYPE_SCSI_DEVICE);
 }
 
 /* handle legacy '-drive if=scsi,...' cmd line args */
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 9944d69..4c4cc75 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1739,14 +1739,14 @@  static void scsi_hd_class_initfn(ObjectClass *klass, void *data)
     sc->unit_attention_reported = scsi_disk_unit_attention_reported;
 }
 
-static SCSIDeviceInfo scsi_hd_info = {
-    .qdev.name    = "scsi-hd",
-    .qdev.fw_name = "disk",
-    .qdev.desc    = "virtual SCSI disk",
-    .qdev.size    = sizeof(SCSIDiskState),
-    .qdev.reset   = scsi_disk_reset,
-    .qdev.class_init = scsi_hd_class_initfn,
-    .qdev.props   = (Property[]) {
+static DeviceInfo scsi_hd_info = {
+    .name    = "scsi-hd",
+    .fw_name = "disk",
+    .desc    = "virtual SCSI disk",
+    .size    = sizeof(SCSIDiskState),
+    .reset   = scsi_disk_reset,
+    .class_init = scsi_hd_class_initfn,
+    .props   = (Property[]) {
         DEFINE_SCSI_DISK_PROPERTIES(),
         DEFINE_PROP_BIT("removable", SCSIDiskState, removable, 0, false),
         DEFINE_PROP_END_OF_LIST(),
@@ -1763,14 +1763,14 @@  static void scsi_cd_class_initfn(ObjectClass *klass, void *data)
     sc->unit_attention_reported = scsi_disk_unit_attention_reported;
 }
 
-static SCSIDeviceInfo scsi_cd_info = {
-    .qdev.name    = "scsi-cd",
-    .qdev.fw_name = "disk",
-    .qdev.desc    = "virtual SCSI CD-ROM",
-    .qdev.size    = sizeof(SCSIDiskState),
-    .qdev.reset   = scsi_disk_reset,
-    .qdev.class_init = scsi_cd_class_initfn,
-    .qdev.props   = (Property[]) {
+static DeviceInfo scsi_cd_info = {
+    .name    = "scsi-cd",
+    .fw_name = "disk",
+    .desc    = "virtual SCSI CD-ROM",
+    .size    = sizeof(SCSIDiskState),
+    .reset   = scsi_disk_reset,
+    .class_init = scsi_cd_class_initfn,
+    .props   = (Property[]) {
         DEFINE_SCSI_DISK_PROPERTIES(),
         DEFINE_PROP_END_OF_LIST(),
     },
@@ -1786,14 +1786,14 @@  static void scsi_block_class_initfn(ObjectClass *klass, void *data)
     sc->alloc_req    = scsi_block_new_request;
 }
 
-static SCSIDeviceInfo scsi_block_info = {
-    .qdev.name    = "scsi-block",
-    .qdev.fw_name = "disk",
-    .qdev.desc    = "SCSI block device passthrough",
-    .qdev.size    = sizeof(SCSIDiskState),
-    .qdev.reset   = scsi_disk_reset,
-    .qdev.class_init = scsi_block_class_initfn,
-    .qdev.props   = (Property[]) {
+static DeviceInfo scsi_block_info = {
+    .name    = "scsi-block",
+    .fw_name = "disk",
+    .desc    = "SCSI block device passthrough",
+    .size    = sizeof(SCSIDiskState),
+    .reset   = scsi_disk_reset,
+    .class_init = scsi_block_class_initfn,
+    .props   = (Property[]) {
         DEFINE_SCSI_DISK_PROPERTIES(),
         DEFINE_PROP_END_OF_LIST(),
     },
@@ -1810,14 +1810,14 @@  static void scsi_disk_class_initfn(ObjectClass *klass, void *data)
     sc->unit_attention_reported = scsi_disk_unit_attention_reported;
 }
 
-static SCSIDeviceInfo scsi_disk_info = {
-    .qdev.name    = "scsi-disk", /* legacy -device scsi-disk */
-    .qdev.fw_name = "disk",
-    .qdev.desc    = "virtual SCSI disk or CD-ROM (legacy)",
-    .qdev.size    = sizeof(SCSIDiskState),
-    .qdev.reset   = scsi_disk_reset,
-    .qdev.class_init = scsi_disk_class_initfn,
-    .qdev.props   = (Property[]) {
+static DeviceInfo scsi_disk_info = {
+    .name    = "scsi-disk", /* legacy -device scsi-disk */
+    .fw_name = "disk",
+    .desc    = "virtual SCSI disk or CD-ROM (legacy)",
+    .size    = sizeof(SCSIDiskState),
+    .reset   = scsi_disk_reset,
+    .class_init = scsi_disk_class_initfn,
+    .props   = (Property[]) {
         DEFINE_SCSI_DISK_PROPERTIES(),
         DEFINE_PROP_BIT("removable", SCSIDiskState, removable, 0, false),
         DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 9fb2a09..8d7a8f3 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -470,14 +470,14 @@  static void scsi_generic_class_initfn(ObjectClass *klass, void *data)
     sc->alloc_req    = scsi_new_request;
 }
 
-static SCSIDeviceInfo scsi_generic_info = {
-    .qdev.name    = "scsi-generic",
-    .qdev.fw_name = "disk",
-    .qdev.desc    = "pass through generic scsi device (/dev/sg*)",
-    .qdev.size    = sizeof(SCSIDevice),
-    .qdev.reset   = scsi_generic_reset,
-    .qdev.class_init = scsi_generic_class_initfn,
-    .qdev.props   = (Property[]) {
+static DeviceInfo scsi_generic_info = {
+    .name    = "scsi-generic",
+    .fw_name = "disk",
+    .desc    = "pass through generic scsi device (/dev/sg*)",
+    .size    = sizeof(SCSIDevice),
+    .reset   = scsi_generic_reset,
+    .class_init = scsi_generic_class_initfn,
+    .props   = (Property[]) {
         DEFINE_BLOCK_PROPERTIES(SCSIDevice, conf),
         DEFINE_PROP_END_OF_LIST(),
     },
diff --git a/hw/scsi.h b/hw/scsi.h
index 41501f2..4290b20 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -13,7 +13,6 @@  typedef struct SCSIBus SCSIBus;
 typedef struct SCSIBusInfo SCSIBusInfo;
 typedef struct SCSICommand SCSICommand;
 typedef struct SCSIDevice SCSIDevice;
-typedef struct SCSIDeviceInfo SCSIDeviceInfo;
 typedef struct SCSIRequest SCSIRequest;
 typedef struct SCSIReqOps SCSIReqOps;
 
@@ -109,10 +108,6 @@  struct SCSIReqOps {
     uint8_t *(*get_buf)(SCSIRequest *req);
 };
 
-struct SCSIDeviceInfo {
-    DeviceInfo qdev;
-};
-
 struct SCSIBusInfo {
     int tcq;
     int max_channel, max_target, max_lun;
@@ -130,7 +125,7 @@  struct SCSIBus {
 };
 
 void scsi_bus_new(SCSIBus *bus, DeviceState *host, const SCSIBusInfo *info);
-void scsi_qdev_register(SCSIDeviceInfo *info);
+void scsi_qdev_register(DeviceInfo *info);
 
 static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d)
 {