qdev: don't access name through info

We already have a QOM interface for this so let's use it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2011-12-04 11:17:51 -06:00
parent 30fbb9fc7c
commit f79f2bfc6a
28 changed files with 44 additions and 44 deletions

View File

@ -1182,7 +1182,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_typename(OBJECT(d)), d->dev.qdev.id, d);
qemu_format_nic_info_str(&d->nic->nc, macaddr);

View File

@ -1878,7 +1878,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_typename(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));

View File

@ -605,7 +605,7 @@ static int fs_eth_init(SysBusDevice *dev)
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_etraxfs_info, &s->conf,
dev->qdev.info->name, dev->qdev.id, s);
object_get_typename(OBJECT(s)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
tdk_init(&s->phy);

View File

@ -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_typename(OBJECT(a));
dprint(a, 1, "%s: cad %d\n", __FUNCTION__, a->hda.cad);
AUD_register_card("hda", &a->card);

View File

@ -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_typename(OBJECT(d));
pci_config_set_interrupt_pin(conf, 1);

View File

@ -1221,7 +1221,7 @@ static int lan9118_init1(SysBusDevice *dev)
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_lan9118_info, &s->conf,
qdev_get_info(&dev->qdev)->name, dev->qdev.id, s);
object_get_typename(OBJECT(dev)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
s->eeprom[0] = 0xa5;
for (i = 0; i < 6; i++) {

View File

@ -479,7 +479,7 @@ static int milkymist_minimac2_init(SysBusDevice *dev)
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_milkymist_minimac2_info, &s->conf,
dev->qdev.info->name, dev->qdev.id, s);
object_get_typename(OBJECT(dev)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
return 0;

View File

@ -240,7 +240,7 @@ static int mipsnet_sysbus_init(SysBusDevice *dev)
sysbus_init_irq(dev, &s->irq);
s->nic = qemu_new_nic(&net_mipsnet_info, &s->conf,
qdev_get_info(&dev->qdev)->name, dev->qdev.id, s);
object_get_typename(OBJECT(dev)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
return 0;

View File

@ -387,7 +387,7 @@ static int mv88w8618_eth_init(SysBusDevice *dev)
sysbus_init_irq(dev, &s->irq);
s->nic = qemu_new_nic(&net_mv88w8618_info, &s->conf,
dev->qdev.info->name, dev->qdev.id, s);
object_get_typename(OBJECT(dev)), dev->qdev.id, s);
memory_region_init_io(&s->iomem, &mv88w8618_eth_ops, s, "mv88w8618-eth",
MP_ETH_SIZE);
sysbus_init_mmio(dev, &s->iomem);

View File

@ -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_typename(OBJECT(dev)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->c.macaddr.a);
return 0;

View File

@ -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_typename(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) {

View File

@ -717,7 +717,7 @@ static int sysbus_open_eth_init(SysBusDevice *dev)
sysbus_init_irq(dev, &s->irq);
s->nic = qemu_new_nic(&net_open_eth_info, &s->conf,
qdev_get_info(&s->dev.qdev)->name, s->dev.qdev.id, s);
object_get_typename(OBJECT(s)), s->dev.qdev.id, s);
return 0;
}

View File

@ -1493,7 +1493,7 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
if (pci_dev == NULL)
return -1;
if (qdev->hotplugged && info->no_hotplug) {
qerror_report(QERR_DEVICE_NO_HOTPLUG, info->qdev.name);
qerror_report(QERR_DEVICE_NO_HOTPLUG, object_get_typename(OBJECT(pci_dev)));
do_pci_unregister_device(pci_dev);
return -1;
}
@ -1534,7 +1534,7 @@ static int pci_unplug_device(DeviceState *qdev)
PCIDeviceInfo *info = container_of(qdev_get_info(qdev), PCIDeviceInfo, qdev);
if (info->no_hotplug) {
qerror_report(QERR_DEVICE_NO_HOTPLUG, info->qdev.name);
qerror_report(QERR_DEVICE_NO_HOTPLUG, object_get_typename(OBJECT(dev)));
return -1;
}
return dev->bus->hotplug(dev->bus->hotplug_qdev, dev,
@ -1742,7 +1742,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_typename(OBJECT(pdev)));
pdev->has_rom = true;
memory_region_init_ram(&pdev->rom, name, size);
vmstate_register_ram(&pdev->rom, &pdev->qdev);

View File

@ -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_typename(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");

View File

@ -989,16 +989,16 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
switch (ret) {
case -EEXIST:
error_set(errp, QERR_PROPERTY_VALUE_IN_USE,
qdev_get_info(dev)->name, prop->name, value);
object_get_typename(OBJECT(dev)), prop->name, value);
break;
default:
case -EINVAL:
error_set(errp, QERR_PROPERTY_VALUE_BAD,
qdev_get_info(dev)->name, prop->name, value);
object_get_typename(OBJECT(dev)), prop->name, value);
break;
case -ENOENT:
error_set(errp, QERR_PROPERTY_VALUE_NOT_FOUND,
qdev_get_info(dev)->name, prop->name, value);
object_get_typename(OBJECT(dev)), prop->name, value);
break;
case 0:
break;
@ -1018,7 +1018,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_typename(OBJECT(dev)), name);
return -1;
}
ret = prop->info->parse(dev, prop, value);
@ -1039,12 +1039,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_typename(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_typename(OBJECT(dev)), name);
abort();
}
qdev_prop_cpy(dev, prop, src);
@ -1093,7 +1093,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_typename(OBJECT(dev)),
name, strerror(-res));
return -1;
}
@ -1165,7 +1165,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_typename(OBJECT(dev)), prop->driver) != 0 &&
strcmp(qdev_get_info(dev)->bus_info->name, prop->driver) != 0) {
continue;
}

View File

@ -720,7 +720,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_typename(OBJECT(dev)));
QLIST_FOREACH(child, &dev->child_bus, sibling) {
error_printf("%s\"%s\"", sep, child->name);
sep = ", ";
@ -735,7 +735,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_typename(OBJECT(dev)));
if (dev->id)
error_printf("/\"%s\"", dev->id);
sep = ", ";
@ -771,7 +771,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_typename(OBJECT(dev)), elem) == 0) {
return dev;
}
}
@ -978,7 +978,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_typename(OBJECT(dev)),
dev->id ? dev->id : "");
indent += 2;
if (dev->num_gpio_in) {
@ -1068,7 +1068,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_typename(OBJECT(dev)));
}
}
l += snprintf(p + l , size - l, "/");
@ -1090,7 +1090,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_typename(OBJECT(dev)));
}
void qdev_ref(DeviceState *dev)
@ -1300,7 +1300,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_typename(OBJECT(child)));
qdev_property_add(dev, name, type, qdev_get_child_property,
NULL, qdev_release_child_property,
@ -1352,7 +1352,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_typename(OBJECT(target)));
if (strcmp(target_type, type) == 0) {
*child = target;
qdev_ref(target);

View File

@ -403,7 +403,7 @@ static inline const char *qdev_fw_name(DeviceState *dev)
return info->alias;
}
return info->name;
return object_get_typename(OBJECT(dev));
}
char *qdev_get_fw_dev_path(DeviceState *dev);

View File

@ -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_typename(OBJECT(dev)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
s->cplus_txbuffer = NULL;

View File

@ -752,7 +752,7 @@ static int smc91c111_init1(SysBusDevice *dev)
sysbus_init_irq(dev, &s->irq);
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_smc91c111_info, &s->conf,
qdev_get_info(&dev->qdev)->name, dev->qdev.id, s);
object_get_typename(OBJECT(dev)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
/* ??? Save/restore. */
return 0;

View File

@ -189,7 +189,7 @@ static int spapr_vlan_init(VIOsPAPRDevice *sdev)
qemu_macaddr_default_if_unset(&dev->nicconf.macaddr);
dev->nic = qemu_new_nic(&net_spapr_vlan_info, &dev->nicconf,
sdev->qdev.info->name, sdev->qdev.id, dev);
object_get_typename(OBJECT(sdev)), sdev->qdev.id, dev);
qemu_format_nic_info_str(&dev->nic->nc, dev->nicconf.macaddr.a);
return 0;

View File

@ -411,7 +411,7 @@ static int stellaris_enet_init(SysBusDevice *dev)
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_stellaris_enet_info, &s->conf,
dev->qdev.info->name, dev->qdev.id, s);
object_get_typename(OBJECT(dev)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
stellaris_enet_reset(s);

View File

@ -250,7 +250,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_typename(OBJECT(dev)), "usb-hub") != 0) {
/* Create a new hub and chain it on */
usb_create_simple(bus, "usb-hub");
}

View File

@ -1337,7 +1337,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_typename(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",

View File

@ -1777,7 +1777,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_typename(OBJECT(dev));
usb_packet_init(&ohci->usb_packet);
ohci->async_td = 0;

View File

@ -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_typename(OBJECT(dev)), dev->id, n);
qemu_format_nic_info_str(&n->nic->nc, conf->macaddr.a);

View File

@ -390,7 +390,7 @@ static int xgmac_enet_init(SysBusDevice *dev)
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_xgmac_enet_info, &s->conf,
qdev_get_info(&dev->qdev)->name, dev->qdev.id, s);
object_get_typename(OBJECT(dev)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
s->regs[XGMAC_ADDR_HIGH(0)] = (s->conf.macaddr.a[5] << 8) |

View File

@ -856,7 +856,7 @@ static int xilinx_enet_init(SysBusDevice *dev)
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_xilinx_enet_info, &s->conf,
dev->qdev.info->name, dev->qdev.id, s);
object_get_typename(OBJECT(dev)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
tdk_init(&s->TEMAC.phy);

View File

@ -221,7 +221,7 @@ static int xilinx_ethlite_init(SysBusDevice *dev)
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_xilinx_ethlite_info, &s->conf,
dev->qdev.info->name, dev->qdev.id, s);
object_get_typename(OBJECT(dev)), dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
return 0;
}