From: Anthony Liguori <aliguori@us.ibm.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Wanpeng Li <liwp@linux.vnet.ibm.com>,
qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Andreas Faerber <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 05/14] qdev: use wrapper for qdev_get_path
Date: Tue, 01 May 2012 13:36:10 -0500 [thread overview]
Message-ID: <4FA02D1A.1090807@us.ibm.com> (raw)
In-Reply-To: <1335896294-9530-6-git-send-email-aliguori@us.ibm.com>
Hi Gerd,
Could you carefully review the USB changes here? I'm not really sure what our
contract is with the guest in terms of ABI compatibility. I think it's good but
it could use a second set of eyes.
Regards,
Anthony Liguori
On 05/01/2012 01:18 PM, Anthony Liguori wrote:
> This makes it easier to remove it from BusInfo.
>
> Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
> ---
> exec.c | 4 ++--
> hw/qdev.c | 16 ++++++++++++++++
> hw/qdev.h | 2 ++
> hw/usb/desc.c | 7 +++++--
> savevm.c | 12 ++++++------
> 5 files changed, 31 insertions(+), 10 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index 0607c9b..e3523d2 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2583,8 +2583,8 @@ void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
> assert(new_block);
> assert(!new_block->idstr[0]);
>
> - if (dev&& dev->parent_bus&& dev->parent_bus->info->get_dev_path) {
> - char *id = dev->parent_bus->info->get_dev_path(dev);
> + if (dev) {
> + char *id = qdev_get_dev_path(dev);
> if (id) {
> snprintf(new_block->idstr, sizeof(new_block->idstr), "%s/", id);
> g_free(id);
> diff --git a/hw/qdev.c b/hw/qdev.c
> index e17a9ab..e835650 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -519,6 +519,22 @@ char* qdev_get_fw_dev_path(DeviceState *dev)
> return strdup(path);
> }
>
> +char *qdev_get_dev_path(DeviceState *dev)
> +{
> + BusClass *bc;
> +
> + if (!dev->parent_bus) {
> + return NULL;
> + }
> +
> + bc = BUS_GET_CLASS(dev->parent_bus);
> + if (bc->get_dev_path) {
> + return bc->get_dev_path(dev);
> + }
> +
> + return NULL;
> +}
> +
> static char *qdev_get_type(Object *obj, Error **errp)
> {
> return g_strdup(object_get_typename(obj));
> diff --git a/hw/qdev.h b/hw/qdev.h
> index ca8386a..fc3b50f 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -362,4 +362,6 @@ extern int qdev_hotplug;
>
> void qdev_add_properties(DeviceState *dev, Property *props);
>
> +char *qdev_get_dev_path(DeviceState *dev);
> +
> #endif
> diff --git a/hw/usb/desc.c b/hw/usb/desc.c
> index e8a3c6a..64352c9 100644
> --- a/hw/usb/desc.c
> +++ b/hw/usb/desc.c
> @@ -433,11 +433,14 @@ void usb_desc_create_serial(USBDevice *dev)
> int index = desc->id.iSerialNumber;
> char serial[64];
> int dst;
> + char *path = NULL;
>
> assert(index != 0&& desc->str[index] != NULL);
> dst = snprintf(serial, sizeof(serial), "%s", desc->str[index]);
> - if (hcd&& hcd->parent_bus&& hcd->parent_bus->info->get_dev_path) {
> - char *path = hcd->parent_bus->info->get_dev_path(hcd);
> + if (hcd->parent_bus&& hcd->parent_bus->parent) {
> + path = qdev_get_dev_path(hcd->parent_bus->parent);
> + }
> + if (path) {
> dst += snprintf(serial+dst, sizeof(serial)-dst, "-%s", path);
> }
> dst += snprintf(serial+dst, sizeof(serial)-dst, "-%s", dev->port->path);
> diff --git a/savevm.c b/savevm.c
> index 2d18bab..818ddfc 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -1248,8 +1248,8 @@ int register_savevm_live(DeviceState *dev,
> se->is_ram = 1;
> }
>
> - if (dev&& dev->parent_bus&& dev->parent_bus->info->get_dev_path) {
> - char *id = dev->parent_bus->info->get_dev_path(dev);
> + if (dev) {
> + char *id = qdev_get_dev_path(dev);
> if (id) {
> pstrcpy(se->idstr, sizeof(se->idstr), id);
> pstrcat(se->idstr, sizeof(se->idstr), "/");
> @@ -1292,8 +1292,8 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque)
> SaveStateEntry *se, *new_se;
> char id[256] = "";
>
> - if (dev&& dev->parent_bus&& dev->parent_bus->info->get_dev_path) {
> - char *path = dev->parent_bus->info->get_dev_path(dev);
> + if (dev) {
> + char *path = qdev_get_dev_path(dev);
> if (path) {
> pstrcpy(id, sizeof(id), path);
> pstrcat(id, sizeof(id), "/");
> @@ -1334,8 +1334,8 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
> se->alias_id = alias_id;
> se->no_migrate = vmsd->unmigratable;
>
> - if (dev&& dev->parent_bus&& dev->parent_bus->info->get_dev_path) {
> - char *id = dev->parent_bus->info->get_dev_path(dev);
> + if (dev) {
> + char *id = qdev_get_dev_path(dev);
> if (id) {
> pstrcpy(se->idstr, sizeof(se->idstr), id);
> pstrcat(se->idstr, sizeof(se->idstr), "/");
next prev parent reply other threads:[~2012-05-01 18:37 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-01 18:18 [Qemu-devel] [PATCH 0/14] qom: convert busses to QOM (v2) Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 01/14] qdev: fix adding of ptr properties Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 02/14] object: add object_property_foreach Anthony Liguori
2012-05-01 19:02 ` Andreas Färber
2012-05-01 18:18 ` [Qemu-devel] [PATCH 03/14] qdev: add qdev_add_properties Anthony Liguori
2012-05-01 19:05 ` Andreas Färber
2012-05-01 20:37 ` Anthony Liguori
2012-05-01 20:43 ` Andreas Färber
2012-05-01 20:48 ` Anthony Liguori
2012-05-01 20:57 ` Peter Maydell
2012-05-01 22:01 ` Anthony Liguori
2012-05-01 22:12 ` Paolo Bonzini
2012-05-01 22:23 ` Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 04/14] qdev: don't allow globals to be set by bus name Anthony Liguori
2012-05-01 20:37 ` Paolo Bonzini
2012-05-01 20:46 ` Anthony Liguori
2012-05-01 21:47 ` Paolo Bonzini
2012-05-01 22:18 ` Andreas Färber
2012-05-01 22:23 ` Anthony Liguori
2012-05-01 22:18 ` Anthony Liguori
2012-05-02 6:32 ` Paolo Bonzini
2012-05-01 18:18 ` [Qemu-devel] [PATCH 05/14] qdev: use wrapper for qdev_get_path Anthony Liguori
2012-05-01 18:36 ` Anthony Liguori [this message]
2012-05-02 12:35 ` Gerd Hoffmann
2012-05-01 18:18 ` [Qemu-devel] [PATCH 06/14] qdev: move properties from businfo to base class instance init Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 07/14] qdev: fix info qtree/qdm Anthony Liguori
2012-05-02 7:14 ` Paolo Bonzini
2012-05-01 18:18 ` [Qemu-devel] [PATCH 08/14] qdev: convert busses to QEMU Object Model Anthony Liguori
2012-05-01 19:31 ` Andreas Färber
2012-05-01 20:40 ` Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object (v2) Anthony Liguori
2012-05-01 19:47 ` Andreas Färber
2012-05-01 18:18 ` [Qemu-devel] [PATCH 10/14] qbus: move get_dev_path to DeviceState Anthony Liguori
2012-05-02 7:15 ` Paolo Bonzini
2012-05-01 18:18 ` [Qemu-devel] [PATCH 11/14] qbus: move get_fw_dev_path to DeviceClass Anthony Liguori
2012-05-01 19:34 ` Andreas Färber
2012-05-01 22:24 ` Anthony Liguori
2012-05-01 22:36 ` Andreas Färber
2012-05-02 7:22 ` Paolo Bonzini
2012-05-01 18:18 ` [Qemu-devel] [PATCH 12/14] qbus: move print_dev " Anthony Liguori
2012-05-01 19:37 ` Andreas Färber
2012-05-01 18:18 ` [Qemu-devel] [PATCH 13/14] qbus: make child devices links Anthony Liguori
2012-05-01 18:18 ` [Qemu-devel] [PATCH 14/14] qbus: initialize in standard way Anthony Liguori
2012-05-02 8:34 ` Paolo Bonzini
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=4FA02D1A.1090807@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=afaerber@suse.de \
--cc=kraxel@redhat.com \
--cc=liwp@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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).