From: "Daniel P. Berrange" <berrange@redhat.com>
To: Juergen Gross <jgross@suse.com>
Cc: qemu-devel@nongnu.org, xen-devel@lists.xensource.com,
anthony.perard@citrix.com, sstabellini@kernel.org,
kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] xen: add qemu device for each pvusb backend
Date: Tue, 27 Sep 2016 10:00:42 +0100 [thread overview]
Message-ID: <20160927090042.GF3967@redhat.com> (raw)
In-Reply-To: <1474893837-13010-3-git-send-email-jgross@suse.com>
On Mon, Sep 26, 2016 at 02:43:57PM +0200, Juergen Gross wrote:
> In order to be able to specify to which pvusb controller a new pvusb
> device should be added we need a qemu device for each pvusb controller
> with an associated id.
>
> Add such a device when a new controller is requested and attach the
> usb bus of that controller to the new device. Any device connected to
> that controller can now specify the bus and port directly via its
> properties.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> hw/usb/xen-usb.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 68 insertions(+), 13 deletions(-)
>
> @@ -733,10 +740,10 @@ static void usbback_portid_add(struct usbback_info *usbif, unsigned port,
> {
> unsigned speed;
> char *portname;
> - USBPort *p;
> Error *local_err = NULL;
> QDict *qdict;
> QemuOpts *opts;
> + char tmp[32];
>
> if (usbif->ports[port - 1].dev) {
> return;
> @@ -749,11 +756,14 @@ static void usbback_portid_add(struct usbback_info *usbif, unsigned port,
> return;
> }
> portname++;
> - p = &(usbif->ports[port - 1].port);
> - snprintf(p->path, sizeof(p->path), "%s", portname);
>
> qdict = qdict_new();
> qdict_put(qdict, "driver", qstring_from_str("usb-host"));
> + snprintf(tmp, sizeof(tmp), "%s.0", usbif->id);
Don't snprintf into fixed length buffers. g_strdup_printf() does the
right thing
> + qdict_put(qdict, "bus", qstring_from_str(tmp));
> + snprintf(tmp, sizeof(tmp), "%s-%u", usbif->id, port);
> + qdict_put(qdict, "id", qstring_from_str(tmp));
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
WARNING: multiple messages have this Message-ID (diff)
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Juergen Gross <jgross@suse.com>
Cc: anthony.perard@citrix.com, xen-devel@lists.xensource.com,
sstabellini@kernel.org, qemu-devel@nongnu.org, kraxel@redhat.com
Subject: Re: [PATCH 2/2] xen: add qemu device for each pvusb backend
Date: Tue, 27 Sep 2016 10:00:42 +0100 [thread overview]
Message-ID: <20160927090042.GF3967@redhat.com> (raw)
In-Reply-To: <1474893837-13010-3-git-send-email-jgross@suse.com>
On Mon, Sep 26, 2016 at 02:43:57PM +0200, Juergen Gross wrote:
> In order to be able to specify to which pvusb controller a new pvusb
> device should be added we need a qemu device for each pvusb controller
> with an associated id.
>
> Add such a device when a new controller is requested and attach the
> usb bus of that controller to the new device. Any device connected to
> that controller can now specify the bus and port directly via its
> properties.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> hw/usb/xen-usb.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 68 insertions(+), 13 deletions(-)
>
> @@ -733,10 +740,10 @@ static void usbback_portid_add(struct usbback_info *usbif, unsigned port,
> {
> unsigned speed;
> char *portname;
> - USBPort *p;
> Error *local_err = NULL;
> QDict *qdict;
> QemuOpts *opts;
> + char tmp[32];
>
> if (usbif->ports[port - 1].dev) {
> return;
> @@ -749,11 +756,14 @@ static void usbback_portid_add(struct usbback_info *usbif, unsigned port,
> return;
> }
> portname++;
> - p = &(usbif->ports[port - 1].port);
> - snprintf(p->path, sizeof(p->path), "%s", portname);
>
> qdict = qdict_new();
> qdict_put(qdict, "driver", qstring_from_str("usb-host"));
> + snprintf(tmp, sizeof(tmp), "%s.0", usbif->id);
Don't snprintf into fixed length buffers. g_strdup_printf() does the
right thing
> + qdict_put(qdict, "bus", qstring_from_str(tmp));
> + snprintf(tmp, sizeof(tmp), "%s-%u", usbif->id, port);
> + qdict_put(qdict, "id", qstring_from_str(tmp));
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
next prev parent reply other threads:[~2016-09-27 9:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-26 12:43 [Qemu-devel] [PATCH 0/2] Xen pvUSB correction Juergen Gross
2016-09-26 12:43 ` Juergen Gross
2016-09-26 12:43 ` [Qemu-devel] [PATCH 1/2] xen: add an own bus for xen backend devices Juergen Gross
2016-09-26 12:43 ` Juergen Gross
2016-09-27 8:53 ` [Qemu-devel] " Gerd Hoffmann
2016-09-27 8:53 ` Gerd Hoffmann
2016-09-29 14:39 ` [Qemu-devel] " Juergen Gross
2016-09-29 14:39 ` Juergen Gross
2016-09-26 12:43 ` [Qemu-devel] [PATCH 2/2] xen: add qemu device for each pvusb backend Juergen Gross
2016-09-26 12:43 ` Juergen Gross
2016-09-27 9:00 ` Daniel P. Berrange [this message]
2016-09-27 9:00 ` Daniel P. Berrange
2016-09-29 14:39 ` [Qemu-devel] " Juergen Gross
2016-09-29 14:39 ` Juergen Gross
2016-09-27 9:08 ` Gerd Hoffmann
2016-09-27 9:08 ` Gerd Hoffmann
2016-09-29 14:49 ` [Qemu-devel] " Juergen Gross
2016-09-29 14:49 ` Juergen Gross
2016-09-29 15:16 ` [Qemu-devel] " Gerd Hoffmann
2016-09-29 15:16 ` Gerd Hoffmann
2016-09-29 19:39 ` [Qemu-devel] " Markus Armbruster
2016-09-29 19:39 ` Markus Armbruster
2016-09-27 8:51 ` [Qemu-devel] [PATCH 0/2] Xen pvUSB correction Gerd Hoffmann
2016-09-27 8:51 ` Gerd Hoffmann
2016-09-29 14:38 ` [Qemu-devel] " Juergen Gross
2016-09-29 14:38 ` Juergen Gross
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=20160927090042.GF3967@redhat.com \
--to=berrange@redhat.com \
--cc=anthony.perard@citrix.com \
--cc=jgross@suse.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.