From patchwork Mon Nov 15 14:30:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 71225 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5B671B70F9 for ; Tue, 16 Nov 2010 01:46:10 +1100 (EST) Received: from localhost ([127.0.0.1]:33372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PI0Bb-0002xy-7V for incoming@patchwork.ozlabs.org; Mon, 15 Nov 2010 09:37:35 -0500 Received: from [140.186.70.92] (port=43384 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PI05Y-0007yr-NR for qemu-devel@nongnu.org; Mon, 15 Nov 2010 09:31:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PI05S-0007Rz-EB for qemu-devel@nongnu.org; Mon, 15 Nov 2010 09:31:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PI05S-0007Ri-6z for qemu-devel@nongnu.org; Mon, 15 Nov 2010 09:31:14 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAFEVBWr007818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 15 Nov 2010 09:31:11 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oAFEVAb1026325; Mon, 15 Nov 2010 09:31:10 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id CF7BC18D46E; Mon, 15 Nov 2010 16:31:09 +0200 (IST) From: Gleb Natapov To: qemu-devel@nongnu.org Date: Mon, 15 Nov 2010 16:30:55 +0200 Message-Id: <1289831469-25540-2-git-send-email-gleb@redhat.com> In-Reply-To: <1289831469-25540-1-git-send-email-gleb@redhat.com> References: <1289831469-25540-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kvm@vger.kernel.org, mst@redhat.com, armbru@redhat.com, blauwirbel@gmail.com, alex.williamson@redhat.com, kevin@koconnor.net Subject: [Qemu-devel] [PATCHv5 01/15] Introduce fw_name field to DeviceInfo structure. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add "fw_name" to DeviceInfo to use in device path building. In contrast to "name" "fw_name" should refer to functionality device provides instead of particular device model like "name" does. Signed-off-by: Gleb Natapov --- hw/fdc.c | 1 + hw/ide/isa.c | 1 + hw/ide/qdev.c | 1 + hw/isa-bus.c | 1 + hw/lance.c | 1 + hw/piix_pci.c | 1 + hw/qdev.h | 6 ++++++ hw/usb-hub.c | 1 + hw/usb-net.c | 1 + hw/virtio-pci.c | 1 + 10 files changed, 15 insertions(+), 0 deletions(-) diff --git a/hw/fdc.c b/hw/fdc.c index c159dcb..a467c4b 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.fw_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..9856435 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.fw_name = "ide", .qdev.size = sizeof(ISAIDEState), .init = isa_ide_initfn, .qdev.reset = isa_ide_reset, diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 0808760..6d27b60 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.fw_name = "drive", .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..26036e0 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.fw_name = "isa", .qdev.size = sizeof(SysBusDevice), .qdev.no_user = 1, }; diff --git a/hw/lance.c b/hw/lance.c index dc12144..1a3bb1a 100644 --- a/hw/lance.c +++ b/hw/lance.c @@ -141,6 +141,7 @@ static void lance_reset(DeviceState *dev) static SysBusDeviceInfo lance_info = { .init = lance_init, .qdev.name = "lance", + .qdev.fw_name = "ethernet", .qdev.size = sizeof(SysBusPCNetState), .qdev.reset = lance_reset, .qdev.vmsd = &vmstate_lance, diff --git a/hw/piix_pci.c b/hw/piix_pci.c index b5589b9..38f9d9e 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -365,6 +365,7 @@ static PCIDeviceInfo i440fx_info[] = { static SysBusDeviceInfo i440fx_pcihost_info = { .init = i440fx_pcihost_initfn, .qdev.name = "i440FX-pcihost", + .qdev.fw_name = "pci", .qdev.size = sizeof(I440FXState), .qdev.no_user = 1, }; diff --git a/hw/qdev.h b/hw/qdev.h index 579328a..9f90efe 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 *fw_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_fw_name(DeviceState *dev) +{ + return dev->info->fw_name ? : dev->info->alias ? : 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/usb-hub.c b/hw/usb-hub.c index 2a1edfc..8e3a96b 100644 --- a/hw/usb-hub.c +++ b/hw/usb-hub.c @@ -545,6 +545,7 @@ static int usb_hub_initfn(USBDevice *dev) static struct USBDeviceInfo hub_info = { .product_desc = "QEMU USB Hub", .qdev.name = "usb-hub", + .qdev.fw_name = "hub", .qdev.size = sizeof(USBHubState), .init = usb_hub_initfn, .handle_packet = usb_hub_handle_packet, diff --git a/hw/usb-net.c b/hw/usb-net.c index 70f9263..2287ee1 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -1496,6 +1496,7 @@ static USBDevice *usb_net_init(const char *cmdline) static struct USBDeviceInfo net_info = { .product_desc = "QEMU USB Network Interface", .qdev.name = "usb-net", + .qdev.fw_name = "network", .qdev.size = sizeof(USBNetState), .init = usb_net_initfn, .handle_packet = usb_generic_handle_packet, diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 729917d..be2c92f 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -697,6 +697,7 @@ static int virtio_9p_init_pci(PCIDevice *pci_dev) static PCIDeviceInfo virtio_info[] = { { .qdev.name = "virtio-blk-pci", + .qdev.alias = "virtio-blk", .qdev.size = sizeof(VirtIOPCIProxy), .init = virtio_blk_init_pci, .exit = virtio_blk_exit_pci,