Il 16/05/2013 17:54, KONRAD Frédéric ha scritto:
I think this can do the job, any better idea?
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index d5257ed..e033b53 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -43,7 +43,6 @@
#endif
static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
-static char *pcibus_get_dev_path(DeviceState *dev);
static char *pcibus_get_fw_dev_path(DeviceState *dev);
static int pcibus_reset(BusState *qbus);
@@ -2129,7 +2128,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *dev)
return g_strdup(path);
}
-static char *pcibus_get_dev_path(DeviceState *dev)
+char *pcibus_get_dev_path(DeviceState *dev)
{
PCIDevice *d = container_of(dev, PCIDevice, qdev);
PCIDevice *t;
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 70d2c6b..0241223 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1514,11 +1514,19 @@ static void virtio_pci_bus_new(VirtioBusState
*bus, VirtIOPCIProxy *dev)
qbus->allow_hotplug = 1;
}
+static char *virtio_pci_bus_get_dev_path(DeviceState *dev)
+{
+ BusState *bus = qdev_get_parent_bus(dev);
+ DeviceState *proxy = DEVICE(bus->parent);
+ return g_strdup(pcibus_get_dev_path(proxy));
You do not need to export pcibus_get_dev_path. This should just return
qdev_get_dev_path(proxy) and should be in TYPE_VIRTIO_BUS, not in the
PCI-specific subclass.
(The g_strdup is not needed, either).
Paolo