From patchwork Mon Dec 12 20:18:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 130892 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DEF6B1007D3 for ; Tue, 13 Dec 2011 09:10:30 +1100 (EST) Received: from localhost ([::1]:33649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaE4p-00049j-To for incoming@patchwork.ozlabs.org; Mon, 12 Dec 2011 17:10:27 -0500 Received: from eggs.gnu.org ([140.186.70.92]:42316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaCPc-0005bg-CW for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:23:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RaCPa-0000pa-Ci for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:23:47 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:44640 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaCPZ-0000pS-Qr for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:23:46 -0500 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id pBCKNc9C032649; Mon, 12 Dec 2011 14:23:38 -0600 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id pBCKNaCZ032648; Mon, 12 Dec 2011 14:23:36 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Mon, 12 Dec 2011 14:18:27 -0600 Message-Id: <1323721273-32404-32-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1323721273-32404-1-git-send-email-aliguori@us.ibm.com> References: <1323721273-32404-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.132.139 Cc: Kevin Wolf , Peter Maydell , Anthony Liguori , Stefan Hajnoczi , Jan Kiszka , Markus Armbruster , Luiz Capitulino Subject: [Qemu-devel] [PATCH v3 031/197] qdev: don't access name through info X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Anthony Liguori --- hw/e1000.c | 2 +- hw/eepro100.c | 2 +- hw/hda-audio.c | 2 +- hw/intel-hda.c | 2 +- hw/ne2000-isa.c | 2 +- hw/ne2000.c | 2 +- hw/pci.c | 2 +- hw/pcnet.c | 2 +- hw/qdev-properties.c | 16 ++++++++-------- hw/qdev.c | 16 ++++++++-------- hw/rtl8139.c | 2 +- hw/usb-bus.c | 2 +- hw/usb-net.c | 2 +- hw/usb-ohci.c | 2 +- hw/virtio-net.c | 2 +- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index ce30ad8..2f495cd 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -1175,7 +1175,7 @@ static int pci_e1000_init(PCIDevice *pci_dev) d->eeprom_data[EEPROM_CHECKSUM_REG] = checksum; d->nic = qemu_new_nic(&net_e1000_info, &d->conf, - qdev_get_info(&d->dev.qdev)->name, d->dev.qdev.id, d); + object_get_type(OBJECT(d)), d->dev.qdev.id, d); qemu_format_nic_info_str(&d->nic->nc, macaddr); diff --git a/hw/eepro100.c b/hw/eepro100.c index 287d1f1..1f9f610 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -1879,7 +1879,7 @@ static int e100_nic_init(PCIDevice *pci_dev) nic_reset(s); s->nic = qemu_new_nic(&net_eepro100_info, &s->conf, - qdev_get_info(&pci_dev->qdev)->name, pci_dev->qdev.id, s); + object_get_type(OBJECT(pci_dev)), pci_dev->qdev.id, s); qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a); TRACE(OTHER, logout("%s\n", s->nic->nc.info_str)); diff --git a/hw/hda-audio.c b/hw/hda-audio.c index 0bc0a25..ffdd799 100644 --- a/hw/hda-audio.c +++ b/hw/hda-audio.c @@ -777,7 +777,7 @@ static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc) uint32_t i, type; a->desc = desc; - a->name = qdev_get_info(&a->hda.qdev)->name; + a->name = object_get_type(OBJECT(a)); dprint(a, 1, "%s: cad %d\n", __FUNCTION__, a->hda.cad); AUD_register_card("hda", &a->card); diff --git a/hw/intel-hda.c b/hw/intel-hda.c index 12dcc84..1b42e10 100644 --- a/hw/intel-hda.c +++ b/hw/intel-hda.c @@ -1129,7 +1129,7 @@ static int intel_hda_init(PCIDevice *pci) IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci); uint8_t *conf = d->pci.config; - d->name = qdev_get_info(&d->pci.qdev)->name; + d->name = object_get_type(OBJECT(d)); pci_config_set_interrupt_pin(conf, 1); diff --git a/hw/ne2000-isa.c b/hw/ne2000-isa.c index 60dc333..9e89256 100644 --- a/hw/ne2000-isa.c +++ b/hw/ne2000-isa.c @@ -76,7 +76,7 @@ static int isa_ne2000_initfn(ISADevice *dev) ne2000_reset(s); s->nic = qemu_new_nic(&net_ne2000_isa_info, &s->c, - qdev_get_info(&dev->qdev)->name, dev->qdev.id, s); + object_get_type(OBJECT(dev)), dev->qdev.id, s); qemu_format_nic_info_str(&s->nic->nc, s->c.macaddr.a); return 0; diff --git a/hw/ne2000.c b/hw/ne2000.c index d016b8e..16dcee2 100644 --- a/hw/ne2000.c +++ b/hw/ne2000.c @@ -760,7 +760,7 @@ static int pci_ne2000_init(PCIDevice *pci_dev) ne2000_reset(s); s->nic = qemu_new_nic(&net_ne2000_info, &s->c, - qdev_get_info(&pci_dev->qdev)->name, pci_dev->qdev.id, s); + object_get_type(OBJECT(pci_dev)), pci_dev->qdev.id, s); qemu_format_nic_info_str(&s->nic->nc, s->c.macaddr.a); if (!pci_dev->qdev.hotplugged) { diff --git a/hw/pci.c b/hw/pci.c index 46b7dac..dd8aa48 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1763,7 +1763,7 @@ static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom) if (qdev_get_info(&pdev->qdev)->vmsd) snprintf(name, sizeof(name), "%s.rom", qdev_get_info(&pdev->qdev)->vmsd->name); else - snprintf(name, sizeof(name), "%s.rom", qdev_get_info(&pdev->qdev)->name); + snprintf(name, sizeof(name), "%s.rom", object_get_type(OBJECT(pdev))); pdev->has_rom = true; memory_region_init_ram(&pdev->rom, &pdev->qdev, name, size); ptr = memory_region_get_ram_ptr(&pdev->rom); diff --git a/hw/pcnet.c b/hw/pcnet.c index e58b195..c3bf405 100644 --- a/hw/pcnet.c +++ b/hw/pcnet.c @@ -1718,7 +1718,7 @@ int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info) s->poll_timer = qemu_new_timer_ns(vm_clock, pcnet_poll_timer, s); qemu_macaddr_default_if_unset(&s->conf.macaddr); - s->nic = qemu_new_nic(info, &s->conf, qdev_get_info(dev)->name, dev->id, s); + s->nic = qemu_new_nic(info, &s->conf, object_get_type(OBJECT(dev)), dev->id, s); qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a); add_boot_device_path(s->conf.bootindex, dev, "/ethernet-phy@0"); diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index f235a26..ce8cb7c 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -627,7 +627,7 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value) * removed along with it. */ if (!prop || !prop->info->parse) { - qerror_report(QERR_PROPERTY_NOT_FOUND, qdev_get_info(dev)->name, name); + qerror_report(QERR_PROPERTY_NOT_FOUND, object_get_type(OBJECT(dev)), name); return -1; } ret = prop->info->parse(dev, prop, value); @@ -635,16 +635,16 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value) switch (ret) { case -EEXIST: qerror_report(QERR_PROPERTY_VALUE_IN_USE, - qdev_get_info(dev)->name, name, value); + object_get_type(OBJECT(dev)), name, value); break; default: case -EINVAL: qerror_report(QERR_PROPERTY_VALUE_BAD, - qdev_get_info(dev)->name, name, value); + object_get_type(OBJECT(dev)), name, value); break; case -ENOENT: qerror_report(QERR_PROPERTY_VALUE_NOT_FOUND, - qdev_get_info(dev)->name, name, value); + object_get_type(OBJECT(dev)), name, value); break; } return -1; @@ -659,12 +659,12 @@ void qdev_prop_set(DeviceState *dev, const char *name, void *src, enum PropertyT prop = qdev_prop_find(dev, name); if (!prop) { fprintf(stderr, "%s: property \"%s.%s\" not found\n", - __FUNCTION__, qdev_get_info(dev)->name, name); + __FUNCTION__, object_get_type(OBJECT(dev)), name); abort(); } if (prop->info->type != type) { fprintf(stderr, "%s: property \"%s.%s\" type mismatch\n", - __FUNCTION__, qdev_get_info(dev)->name, name); + __FUNCTION__, object_get_type(OBJECT(dev)), name); abort(); } qdev_prop_cpy(dev, prop, src); @@ -713,7 +713,7 @@ int qdev_prop_set_drive(DeviceState *dev, const char *name, BlockDriverState *va if (res < 0) { error_report("Can't attach drive %s to %s.%s: %s", bdrv_get_device_name(value), - dev->id ? dev->id : qdev_get_info(dev)->name, + dev->id ? dev->id : object_get_type(OBJECT(dev)), name, strerror(-res)); return -1; } @@ -785,7 +785,7 @@ void qdev_prop_set_globals(DeviceState *dev) GlobalProperty *prop; QTAILQ_FOREACH(prop, &global_props, next) { - if (strcmp(qdev_get_info(dev)->name, prop->driver) != 0 && + if (strcmp(object_get_type(OBJECT(dev)), prop->driver) != 0 && strcmp(qdev_get_info(dev)->bus_info->name, prop->driver) != 0) { continue; } diff --git a/hw/qdev.c b/hw/qdev.c index 2edbc61..18ff84e 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -690,7 +690,7 @@ static void qbus_list_bus(DeviceState *dev) const char *sep = " "; error_printf("child busses at \"%s\":", - dev->id ? dev->id : qdev_get_info(dev)->name); + dev->id ? dev->id : object_get_type(OBJECT(dev))); QLIST_FOREACH(child, &dev->child_bus, sibling) { error_printf("%s\"%s\"", sep, child->name); sep = ", "; @@ -705,7 +705,7 @@ static void qbus_list_dev(BusState *bus) error_printf("devices at \"%s\":", bus->name); QTAILQ_FOREACH(dev, &bus->children, sibling) { - error_printf("%s\"%s\"", sep, qdev_get_info(dev)->name); + error_printf("%s\"%s\"", sep, object_get_type(OBJECT(dev))); if (dev->id) error_printf("/\"%s\"", dev->id); sep = ", "; @@ -741,7 +741,7 @@ static DeviceState *qbus_find_dev(BusState *bus, char *elem) } } QTAILQ_FOREACH(dev, &bus->children, sibling) { - if (strcmp(qdev_get_info(dev)->name, elem) == 0) { + if (strcmp(object_get_type(OBJECT(dev)), elem) == 0) { return dev; } } @@ -948,7 +948,7 @@ static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props, static void qdev_print(Monitor *mon, DeviceState *dev, int indent) { BusState *child; - qdev_printf("dev: %s, id \"%s\"\n", qdev_get_info(dev)->name, + qdev_printf("dev: %s, id \"%s\"\n", object_get_type(OBJECT(dev)), dev->id ? dev->id : ""); indent += 2; if (dev->num_gpio_in) { @@ -1038,7 +1038,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) l += snprintf(p + l, size - l, "%s", d); g_free(d); } else { - l += snprintf(p + l, size - l, "%s", qdev_get_info(dev)->name); + l += snprintf(p + l, size - l, "%s", object_get_type(OBJECT(dev))); } } l += snprintf(p + l , size - l, "/"); @@ -1060,7 +1060,7 @@ char* qdev_get_fw_dev_path(DeviceState *dev) char *qdev_get_type(DeviceState *dev, Error **errp) { - return g_strdup(qdev_get_info(dev)->name); + return g_strdup(object_get_type(OBJECT(dev))); } void qdev_ref(DeviceState *dev) @@ -1255,7 +1255,7 @@ void qdev_property_add_child(DeviceState *dev, const char *name, { gchar *type; - type = g_strdup_printf("child<%s>", qdev_get_info(child)->name); + type = g_strdup_printf("child<%s>", object_get_type(OBJECT(child))); qdev_property_add(dev, name, type, qdev_get_child_property, NULL, NULL, child, errp); @@ -1306,7 +1306,7 @@ static void qdev_set_link_property(DeviceState *dev, Visitor *v, void *opaque, if (target) { gchar *target_type; - target_type = g_strdup_printf("link<%s>", qdev_get_info(target)->name); + target_type = g_strdup_printf("link<%s>", object_get_type(OBJECT(target))); if (strcmp(target_type, type) == 0) { *child = target; qdev_ref(target); diff --git a/hw/rtl8139.c b/hw/rtl8139.c index c087506..0143fa2 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -3478,7 +3478,7 @@ static int pci_rtl8139_init(PCIDevice *dev) s->eeprom.contents[9] = s->conf.macaddr.a[4] | s->conf.macaddr.a[5] << 8; s->nic = qemu_new_nic(&net_rtl8139_info, &s->conf, - qdev_get_info(&dev->qdev)->name, dev->qdev.id, s); + object_get_type(OBJECT(dev)), dev->qdev.id, s); qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a); s->cplus_txbuffer = NULL; diff --git a/hw/usb-bus.c b/hw/usb-bus.c index e1bcab1..fb532ab 100644 --- a/hw/usb-bus.c +++ b/hw/usb-bus.c @@ -251,7 +251,7 @@ int usb_claim_port(USBDevice *dev) return -1; } } else { - if (bus->nfree == 1 && strcmp(qdev_get_info(&dev->qdev)->name, "usb-hub") != 0) { + if (bus->nfree == 1 && strcmp(object_get_type(OBJECT(dev)), "usb-hub") != 0) { /* Create a new hub and chain it on */ usb_create_simple(bus, "usb-hub"); } diff --git a/hw/usb-net.c b/hw/usb-net.c index 5d7bfcf..c4b29a9 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -1350,7 +1350,7 @@ static int usb_net_initfn(USBDevice *dev) qemu_macaddr_default_if_unset(&s->conf.macaddr); s->nic = qemu_new_nic(&net_usbnet_info, &s->conf, - qdev_get_info(&s->dev.qdev)->name, s->dev.qdev.id, s); + object_get_type(OBJECT(s)), s->dev.qdev.id, s); qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a); snprintf(s->usbstring_mac, sizeof(s->usbstring_mac), "%02x%02x%02x%02x%02x%02x", diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c index 51c96b7..194c994 100644 --- a/hw/usb-ohci.c +++ b/hw/usb-ohci.c @@ -1775,7 +1775,7 @@ static int usb_ohci_init(OHCIState *ohci, DeviceState *dev, memory_region_init_io(&ohci->mem, &ohci_mem_ops, ohci, "ohci", 256); ohci->localmem_base = localmem_base; - ohci->name = qdev_get_info(dev)->name; + ohci->name = object_get_type(OBJECT(dev)); usb_packet_init(&ohci->usb_packet); ohci->async_td = 0; diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 6c785d0..dd5da0b 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -1030,7 +1030,7 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf, memcpy(&n->mac[0], &conf->macaddr, sizeof(n->mac)); n->status = VIRTIO_NET_S_LINK_UP; - n->nic = qemu_new_nic(&net_virtio_info, conf, qdev_get_info(dev)->name, dev->id, n); + n->nic = qemu_new_nic(&net_virtio_info, conf, object_get_type(OBJECT(dev)), dev->id, n); qemu_format_nic_info_str(&n->nic->nc, conf->macaddr.a);