qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "KONRAD Frédéric" <fred.konrad@greensocs.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	mdroth <mdroth@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available
Date: Thu, 16 May 2013 18:07:12 +0200	[thread overview]
Message-ID: <51950430.9030107@redhat.com> (raw)
In-Reply-To: <51950139.5000209@greensocs.com>

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

> +}
> +
>  static void virtio_pci_bus_class_init(ObjectClass *klass, void *data)
>  {
>      BusClass *bus_class = BUS_CLASS(klass);
>      VirtioBusClass *k = VIRTIO_BUS_CLASS(klass);
>      bus_class->max_dev = 1;
> +    bus_class->get_dev_path = virtio_pci_bus_get_dev_path;
>      k->notify = virtio_pci_notify;
>      k->save_config = virtio_pci_save_config;
>      k->load_config = 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,
> 
>  extern const VMStateDescription vmstate_pci_device;
> 
> +char *pcibus_get_dev_path(DeviceState *dev);
> +
>  #define VMSTATE_PCI_DEVICE(_field, _state) {                         \
>      .name       = (stringify(_field)),                               \
>      .size       = sizeof(PCIDevice),                                 \

  reply	other threads:[~2013-05-16 16:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15 23:53 [Qemu-devel] [ANNOUNCE] QEMU 1.5.0-rc2 is now available Anthony Liguori
2013-05-16  3:56 ` Dongsheng Song
2013-05-16 14:21 ` mdroth
2013-05-16 14:51   ` Paolo Bonzini
2013-05-16 15:54     ` KONRAD Frédéric
2013-05-16 16:07       ` Paolo Bonzini [this message]
2013-05-16 16:34         ` KONRAD Frédéric
2013-05-16 16:49           ` mdroth
2013-05-16 16:53             ` KONRAD Frédéric
2013-05-16 16:52           ` Paolo Bonzini
2013-05-16 16:35         ` mdroth
2013-05-16 16:33       ` Anthony Liguori
2013-05-16 16:34         ` KONRAD Frédéric
2013-05-16 15:17   ` KONRAD Frédéric

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51950430.9030107@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=fred.konrad@greensocs.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).