From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud0iy-0002ik-Ki for qemu-devel@nongnu.org; Thu, 16 May 2013 12:08:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ud0it-0007Rq-VN for qemu-devel@nongnu.org; Thu, 16 May 2013 12:08:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud0it-0007Qm-Nm for qemu-devel@nongnu.org; Thu, 16 May 2013 12:08:07 -0400 Message-ID: <51950430.9030107@redhat.com> Date: Thu, 16 May 2013 18:07:12 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1368662027-14213-1-git-send-email-aliguori@us.ibm.com> <20130516142151.GC23880@vm> <5194F279.30200@redhat.com> <51950139.5000209@greensocs.com> In-Reply-To: <51950139.5000209@greensocs.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?KONRAD_Fr=E9d=E9ric?= Cc: Anthony Liguori , mdroth , qemu-devel@nongnu.org Il 16/05/2013 17:54, KONRAD Fr=E9d=E9ric ha scritto: > I think this can do the job, any better idea? >=20 > 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 >=20 > static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int inden= t); > -static char *pcibus_get_dev_path(DeviceState *dev); > static char *pcibus_get_fw_dev_path(DeviceState *dev); > static int pcibus_reset(BusState *qbus); >=20 > @@ -2129,7 +2128,7 @@ static char *pcibus_get_fw_dev_path(DeviceState *= dev) > return g_strdup(path); > } >=20 > -static char *pcibus_get_dev_path(DeviceState *dev) > +char *pcibus_get_dev_path(DeviceState *dev) > { > PCIDevice *d =3D 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 =3D 1; > } >=20 > +static char *virtio_pci_bus_get_dev_path(DeviceState *dev) > +{ > + BusState *bus =3D qdev_get_parent_bus(dev); > + DeviceState *proxy =3D 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 > +} > + > static void virtio_pci_bus_class_init(ObjectClass *klass, void *data) > { > BusClass *bus_class =3D BUS_CLASS(klass); > VirtioBusClass *k =3D VIRTIO_BUS_CLASS(klass); > bus_class->max_dev =3D 1; > + bus_class->get_dev_path =3D virtio_pci_bus_get_dev_path; > k->notify =3D virtio_pci_notify; > k->save_config =3D virtio_pci_save_config; > k->load_config =3D virtio_pci_load_config; > diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h > index 8d075ab..fb5723c 100644 > --- a/include/hw/pci/pci.h > +++ b/include/hw/pci/pci.h > @@ -708,6 +708,8 @@ static inline void pci_dma_sglist_init(QEMUSGList > *qsg, PCIDevice *dev, >=20 > extern const VMStateDescription vmstate_pci_device; >=20 > +char *pcibus_get_dev_path(DeviceState *dev); > + > #define VMSTATE_PCI_DEVICE(_field, _state) { \ > .name =3D (stringify(_field)), = \ > .size =3D sizeof(PCIDevice), = \