All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org, blauwirbel@gmail.com, armbru@redhat.com,
	alex.williamson@redhat.com
Subject: [PATCHv2 1/8] Introduce deriver_name field to DeviceInfo structure.
Date: Sun, 31 Oct 2010 13:40:02 +0200	[thread overview]
Message-ID: <1288525209-3303-2-git-send-email-gleb@redhat.com> (raw)
In-Reply-To: <1288525209-3303-1-git-send-email-gleb@redhat.com>

Add "deriver_name" to DeviceInfo to use in device path building. In
contrast to "name" "driver_name" should refer to functionality device
provides instead of particular device model like "name" does.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 hw/fdc.c        |    1 +
 hw/ide/isa.c    |    1 +
 hw/ide/piix.c   |    1 +
 hw/ide/qdev.c   |    1 +
 hw/isa-bus.c    |    1 +
 hw/piix_pci.c   |    2 ++
 hw/qdev.h       |    6 ++++++
 hw/virtio-pci.c |    2 ++
 8 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index c159dcb..b4217a3 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -2040,6 +2040,7 @@ static const VMStateDescription vmstate_isa_fdc ={
 static ISADeviceInfo isa_fdc_info = {
     .init = isabus_fdc_init1,
     .qdev.name  = "isa-fdc",
+    .qdev.driver_name  = "fdc",
     .qdev.size  = sizeof(FDCtrlISABus),
     .qdev.no_user = 1,
     .qdev.vmsd  = &vmstate_isa_fdc,
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 6b57e0d..489cc99 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -98,6 +98,7 @@ ISADevice *isa_ide_init(int iobase, int iobase2, int isairq,
 
 static ISADeviceInfo isa_ide_info = {
     .qdev.name  = "isa-ide",
+    .qdev.driver_name  = "ata",
     .qdev.size  = sizeof(ISAIDEState),
     .init       = isa_ide_initfn,
     .qdev.reset = isa_ide_reset,
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 07483e8..6206201 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -182,6 +182,7 @@ PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
 static PCIDeviceInfo piix_ide_info[] = {
     {
         .qdev.name    = "piix3-ide",
+        .qdev.driver_name    = "ata",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
         .init         = pci_piix3_ide_initfn,
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 0808760..341548e 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -134,6 +134,7 @@ static int ide_drive_initfn(IDEDevice *dev)
 
 static IDEDeviceInfo ide_drive_info = {
     .qdev.name  = "ide-drive",
+    .qdev.driver_name  = "ata-disk",
     .qdev.size  = sizeof(IDEDrive),
     .init       = ide_drive_initfn,
     .qdev.props = (Property[]) {
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 4e306de..2c42b80 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -153,6 +153,7 @@ static int isabus_bridge_init(SysBusDevice *dev)
 static SysBusDeviceInfo isabus_bridge_info = {
     .init = isabus_bridge_init,
     .qdev.name  = "isabus-bridge",
+    .qdev.driver_name  = "isa",
     .qdev.size  = sizeof(SysBusDevice),
     .qdev.no_user = 1,
 };
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 00060f3..4e5e5df 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -364,6 +364,7 @@ static PCIDeviceInfo i440fx_info[] = {
         .config_write = i440fx_write_config,
     },{
         .qdev.name    = "PIIX3",
+        .qdev.driver_name  = "pci-isa-bridge",
         .qdev.desc    = "ISA bridge",
         .qdev.size    = sizeof(PIIX3State),
         .qdev.vmsd    = &vmstate_piix3,
@@ -377,6 +378,7 @@ static PCIDeviceInfo i440fx_info[] = {
 static SysBusDeviceInfo i440fx_pcihost_info = {
     .init         = i440fx_pcihost_initfn,
     .qdev.name    = "i440FX-pcihost",
+    .qdev.driver_name = "pci",
     .qdev.size    = sizeof(I440FXState),
     .qdev.no_user = 1,
 };
diff --git a/hw/qdev.h b/hw/qdev.h
index 579328a..a9a98f8 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -139,6 +139,7 @@ typedef void (*qdev_resetfn)(DeviceState *dev);
 
 struct DeviceInfo {
     const char *name;
+    const char *driver_name;
     const char *alias;
     const char *desc;
     size_t size;
@@ -288,6 +289,11 @@ void qdev_prop_set_defaults(DeviceState *dev, Property *props);
 void qdev_prop_register_global_list(GlobalProperty *props);
 void qdev_prop_set_globals(DeviceState *dev);
 
+static inline const char *qdev_driver_name(DeviceState *dev)
+{
+    return dev->info->driver_name ? : dev->info->name;
+}
+
 /* This is a nasty hack to allow passing a NULL bus to qdev_create.  */
 extern struct BusInfo system_bus_info;
 
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 2d78ca6..b67ded6 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -769,6 +769,7 @@ static int virtio_9p_init_pci(PCIDevice *pci_dev)
 static PCIDeviceInfo virtio_info[] = {
     {
         .qdev.name = "virtio-blk-pci",
+        .qdev.driver_name = "virtio-blk",
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_blk_init_pci,
         .exit      = virtio_blk_exit_pci,
@@ -782,6 +783,7 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.reset = virtio_pci_reset,
     },{
         .qdev.name  = "virtio-net-pci",
+        .qdev.driver_name  = "ethernet",
         .qdev.size  = sizeof(VirtIOPCIProxy),
         .init       = virtio_net_init_pci,
         .exit       = virtio_net_exit_pci,
-- 
1.7.1


WARNING: multiple messages have this Message-ID (diff)
From: Gleb Natapov <gleb@redhat.com>
To: qemu-devel@nongnu.org
Cc: blauwirbel@gmail.com, alex.williamson@redhat.com,
	armbru@redhat.com, kvm@vger.kernel.org
Subject: [Qemu-devel] [PATCHv2 1/8] Introduce deriver_name field to DeviceInfo structure.
Date: Sun, 31 Oct 2010 13:40:02 +0200	[thread overview]
Message-ID: <1288525209-3303-2-git-send-email-gleb@redhat.com> (raw)
In-Reply-To: <1288525209-3303-1-git-send-email-gleb@redhat.com>

Add "deriver_name" to DeviceInfo to use in device path building. In
contrast to "name" "driver_name" should refer to functionality device
provides instead of particular device model like "name" does.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 hw/fdc.c        |    1 +
 hw/ide/isa.c    |    1 +
 hw/ide/piix.c   |    1 +
 hw/ide/qdev.c   |    1 +
 hw/isa-bus.c    |    1 +
 hw/piix_pci.c   |    2 ++
 hw/qdev.h       |    6 ++++++
 hw/virtio-pci.c |    2 ++
 8 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index c159dcb..b4217a3 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -2040,6 +2040,7 @@ static const VMStateDescription vmstate_isa_fdc ={
 static ISADeviceInfo isa_fdc_info = {
     .init = isabus_fdc_init1,
     .qdev.name  = "isa-fdc",
+    .qdev.driver_name  = "fdc",
     .qdev.size  = sizeof(FDCtrlISABus),
     .qdev.no_user = 1,
     .qdev.vmsd  = &vmstate_isa_fdc,
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 6b57e0d..489cc99 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -98,6 +98,7 @@ ISADevice *isa_ide_init(int iobase, int iobase2, int isairq,
 
 static ISADeviceInfo isa_ide_info = {
     .qdev.name  = "isa-ide",
+    .qdev.driver_name  = "ata",
     .qdev.size  = sizeof(ISAIDEState),
     .init       = isa_ide_initfn,
     .qdev.reset = isa_ide_reset,
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 07483e8..6206201 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -182,6 +182,7 @@ PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
 static PCIDeviceInfo piix_ide_info[] = {
     {
         .qdev.name    = "piix3-ide",
+        .qdev.driver_name    = "ata",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
         .init         = pci_piix3_ide_initfn,
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 0808760..341548e 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -134,6 +134,7 @@ static int ide_drive_initfn(IDEDevice *dev)
 
 static IDEDeviceInfo ide_drive_info = {
     .qdev.name  = "ide-drive",
+    .qdev.driver_name  = "ata-disk",
     .qdev.size  = sizeof(IDEDrive),
     .init       = ide_drive_initfn,
     .qdev.props = (Property[]) {
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 4e306de..2c42b80 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -153,6 +153,7 @@ static int isabus_bridge_init(SysBusDevice *dev)
 static SysBusDeviceInfo isabus_bridge_info = {
     .init = isabus_bridge_init,
     .qdev.name  = "isabus-bridge",
+    .qdev.driver_name  = "isa",
     .qdev.size  = sizeof(SysBusDevice),
     .qdev.no_user = 1,
 };
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 00060f3..4e5e5df 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -364,6 +364,7 @@ static PCIDeviceInfo i440fx_info[] = {
         .config_write = i440fx_write_config,
     },{
         .qdev.name    = "PIIX3",
+        .qdev.driver_name  = "pci-isa-bridge",
         .qdev.desc    = "ISA bridge",
         .qdev.size    = sizeof(PIIX3State),
         .qdev.vmsd    = &vmstate_piix3,
@@ -377,6 +378,7 @@ static PCIDeviceInfo i440fx_info[] = {
 static SysBusDeviceInfo i440fx_pcihost_info = {
     .init         = i440fx_pcihost_initfn,
     .qdev.name    = "i440FX-pcihost",
+    .qdev.driver_name = "pci",
     .qdev.size    = sizeof(I440FXState),
     .qdev.no_user = 1,
 };
diff --git a/hw/qdev.h b/hw/qdev.h
index 579328a..a9a98f8 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -139,6 +139,7 @@ typedef void (*qdev_resetfn)(DeviceState *dev);
 
 struct DeviceInfo {
     const char *name;
+    const char *driver_name;
     const char *alias;
     const char *desc;
     size_t size;
@@ -288,6 +289,11 @@ void qdev_prop_set_defaults(DeviceState *dev, Property *props);
 void qdev_prop_register_global_list(GlobalProperty *props);
 void qdev_prop_set_globals(DeviceState *dev);
 
+static inline const char *qdev_driver_name(DeviceState *dev)
+{
+    return dev->info->driver_name ? : dev->info->name;
+}
+
 /* This is a nasty hack to allow passing a NULL bus to qdev_create.  */
 extern struct BusInfo system_bus_info;
 
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 2d78ca6..b67ded6 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -769,6 +769,7 @@ static int virtio_9p_init_pci(PCIDevice *pci_dev)
 static PCIDeviceInfo virtio_info[] = {
     {
         .qdev.name = "virtio-blk-pci",
+        .qdev.driver_name = "virtio-blk",
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_blk_init_pci,
         .exit      = virtio_blk_exit_pci,
@@ -782,6 +783,7 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.reset = virtio_pci_reset,
     },{
         .qdev.name  = "virtio-net-pci",
+        .qdev.driver_name  = "ethernet",
         .qdev.size  = sizeof(VirtIOPCIProxy),
         .init       = virtio_net_init_pci,
         .exit       = virtio_net_exit_pci,
-- 
1.7.1

  reply	other threads:[~2010-10-31 11:40 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-31 11:40 [PATCHv2 0/8 RFC] boot order specification Gleb Natapov
2010-10-31 11:40 ` [Qemu-devel] " Gleb Natapov
2010-10-31 11:40 ` Gleb Natapov [this message]
2010-10-31 11:40   ` [Qemu-devel] [PATCHv2 1/8] Introduce deriver_name field to DeviceInfo structure Gleb Natapov
2010-11-04  9:20   ` Markus Armbruster
2010-11-04  9:20     ` Markus Armbruster
2010-11-04  9:42     ` Gleb Natapov
2010-11-04  9:42       ` Gleb Natapov
2010-11-04 14:58       ` Markus Armbruster
2010-11-04 15:44         ` Gleb Natapov
2010-11-05 14:14           ` Markus Armbruster
2010-11-05 15:41             ` Gleb Natapov
2010-11-05 16:24               ` Markus Armbruster
2010-11-05 18:31                 ` Gleb Natapov
2010-11-06  9:01                   ` Markus Armbruster
2010-11-06 11:53                     ` Gleb Natapov
2010-11-06 12:55                       ` Markus Armbruster
2010-10-31 11:40 ` [PATCHv2 2/8] Keep track of ISA ports ISA device is using in qdev Gleb Natapov
2010-10-31 11:40   ` [Qemu-devel] " Gleb Natapov
2010-10-31 11:40 ` [PATCHv2 3/8] Add get_dev_path callback to ISA bus " Gleb Natapov
2010-10-31 11:40   ` [Qemu-devel] " Gleb Natapov
2010-10-31 11:40 ` [PATCHv2 4/8] Store IDE bus id in IDEBus structure for easy access Gleb Natapov
2010-10-31 11:40   ` [Qemu-devel] " Gleb Natapov
2010-11-03 13:39   ` Markus Armbruster
2010-11-03 13:39     ` Markus Armbruster
2010-11-03 13:47     ` Gleb Natapov
2010-11-03 13:47       ` Gleb Natapov
2010-11-03 15:18       ` Markus Armbruster
2010-11-03 16:43         ` Gleb Natapov
2010-11-03 17:22           ` Markus Armbruster
2010-11-04  8:07             ` Gleb Natapov
2010-11-04  8:46               ` Markus Armbruster
2010-11-04  9:23                 ` Gleb Natapov
2010-11-04 14:22                   ` Markus Armbruster
2010-11-04 15:26                     ` Gleb Natapov
2010-11-05 14:04                       ` Markus Armbruster
2010-11-05 15:54                         ` Gleb Natapov
2010-11-05 16:31                           ` Markus Armbruster
2010-11-05 18:44                             ` Gleb Natapov
2010-11-06  9:25                               ` Markus Armbruster
2010-11-06 11:37                                 ` Gleb Natapov
2010-11-06 12:46                                   ` Markus Armbruster
2010-10-31 11:40 ` [PATCHv2 5/8] Add get_dev_path callback to IDE bus Gleb Natapov
2010-10-31 11:40   ` [Qemu-devel] " Gleb Natapov
2010-10-31 11:40 ` [PATCHv2 6/8] Add get_dev_path callback for system bus Gleb Natapov
2010-10-31 11:40   ` [Qemu-devel] " Gleb Natapov
2010-10-31 11:40 ` [PATCHv2 7/8] Change pci bus get_dev_path callback to print only slot and func Gleb Natapov
2010-10-31 11:40   ` [Qemu-devel] " Gleb Natapov
2010-11-08 17:17   ` Michael S. Tsirkin
2010-11-08 17:17     ` [Qemu-devel] " Michael S. Tsirkin
2010-11-08 17:29     ` Gleb Natapov
2010-11-08 17:29       ` [Qemu-devel] " Gleb Natapov
2010-11-08 18:12       ` Michael S. Tsirkin
2010-11-08 18:12         ` [Qemu-devel] " Michael S. Tsirkin
2010-11-08 18:22         ` Gleb Natapov
2010-11-08 18:22           ` [Qemu-devel] " Gleb Natapov
2010-11-08 21:00       ` Michael S. Tsirkin
2010-11-08 21:00         ` [Qemu-devel] " Michael S. Tsirkin
2010-11-08 21:12         ` Gleb Natapov
2010-11-08 21:12           ` [Qemu-devel] " Gleb Natapov
2010-11-08 17:26   ` Michael S. Tsirkin
2010-11-08 17:26     ` [Qemu-devel] " Michael S. Tsirkin
2010-10-31 11:40 ` [PATCHv2 8/8] Add bootindex parameter to net/block/fd device Gleb Natapov
2010-10-31 11:40   ` [Qemu-devel] " Gleb Natapov
2010-10-31 22:25 ` [PATCHv2 0/8 RFC] boot order specification Kevin O'Connor
2010-10-31 22:25   ` [Qemu-devel] " Kevin O'Connor
2010-11-01  7:53   ` Gleb Natapov
2010-11-01  7:53     ` [Qemu-devel] " Gleb Natapov
2010-11-04  9:24     ` Markus Armbruster
2010-11-04  9:45       ` Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1288525209-3303-2-git-send-email-gleb@redhat.com \
    --to=gleb@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=armbru@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.