qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Xen Devel <xen-devel@lists.xen.org>,
	QEMU-devel <qemu-devel@nongnu.org>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: Re: [Qemu-devel] [PATCH V12 5/9] Revert "pci: don't export an internal function"
Date: Thu, 14 Jun 2012 16:59:01 +0100	[thread overview]
Message-ID: <4FDA0A45.8030503@citrix.com> (raw)
In-Reply-To: <20120614153014.GB18618@redhat.com>

On 14/06/12 16:30, Michael S. Tsirkin wrote:
>> >  Is this patch would be a good common property?
>> >
>> >  It's probably close to the patch you send earlier Jan.
>> >
>> >  If it's good, I'll resend my passthrough patch series with this patch.
>> >
>> >
>> >  diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
>> >  index b7b5597..9c7a271 100644
>> >  --- a/hw/qdev-properties.c
>> >  +++ b/hw/qdev-properties.c
>> >  @@ -928,6 +928,104 @@ PropertyInfo qdev_prop_blocksize = {
>> >        .max   = 65024,
>> >    };
>> >
>> >  +/* --- pci host address --- */
>> >  +
>> >  +static void get_pci_host_devaddr(Object *obj, Visitor *v, void *opaque,
>> >  +                                 const char *name, Error **errp)
>> >  +{
>> >  +    DeviceState *dev = DEVICE(obj);
>> >  +    Property *prop = opaque;
>> >  +    PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop);
>> >  +    char buffer[4 + 2 + 2 + 2 + 1];
> One trick is this:
>      char buffer[] = "XXXX:XX:XX.X";

I love this trick, even if it use a bit of space in the binary, I think. 
I will use it.

> And comparing with the above, your buffer looks too short, doesn't it?

Yes, I think I forgot to count the ':'s and '.'.

>> >  +    char *p = buffer;
>> >  +
>> >  +    snprintf(buffer, sizeof(buffer), "%04x:%02x:%02x.%d",
>> >  +             addr->domain, addr->bus, addr->slot, addr->function);
> A good idea might be to check the return code. assert(ret<= sizeof buf).

I will.

Thanks,

-- 
Anthony PERARD

  reply	other threads:[~2012-06-14 15:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12 15:05 [Qemu-devel] [PATCH V12 0/9] Xen PCI Passthrough Anthony PERARD
2012-06-12 15:05 ` [Qemu-devel] [PATCH V12 1/9] pci_ids: Add INTEL_82599_SFP_VF id Anthony PERARD
2012-06-12 15:05 ` [Qemu-devel] [PATCH V12 2/9] configure: Introduce --enable-xen-pci-passthrough Anthony PERARD
2012-06-12 15:05 ` [Qemu-devel] [PATCH V12 3/9] Introduce XenHostPCIDevice to access a pci device on the host Anthony PERARD
2012-06-12 15:05 ` [Qemu-devel] [PATCH V12 4/9] pci.c: Add opaque argument to pci_for_each_device Anthony PERARD
2012-06-12 15:05 ` [Qemu-devel] [PATCH V12 5/9] Revert "pci: don't export an internal function" Anthony PERARD
2012-06-12 15:15   ` Michael S. Tsirkin
2012-06-13 10:56     ` Stefano Stabellini
2012-06-13 11:06       ` Michael S. Tsirkin
2012-06-13 11:15     ` Jan Kiszka
2012-06-13 11:22       ` Stefano Stabellini
2012-06-13 12:00         ` Jan Kiszka
2012-06-13 12:22           ` Andreas Färber
2012-06-13 12:48             ` Jan Kiszka
2012-06-13 12:40           ` Anthony PERARD
2012-06-13 12:48             ` Jan Kiszka
2012-06-14 14:39               ` Anthony PERARD
2012-06-14 15:21                 ` Jan Kiszka
2012-06-14 16:01                   ` Anthony PERARD
2012-06-14 15:30                 ` Michael S. Tsirkin
2012-06-14 15:59                   ` Anthony PERARD [this message]
2012-06-13 11:22       ` Michael S. Tsirkin
2012-06-13 11:48         ` Jan Kiszka
2012-06-13 14:04           ` Michael S. Tsirkin
2012-06-12 15:05 ` [Qemu-devel] [PATCH V12 6/9] Introduce Xen PCI Passthrough, qdevice (1/3) Anthony PERARD
2012-06-12 15:05 ` [Qemu-devel] [PATCH V12 7/9] Introduce Xen PCI Passthrough, PCI config space helpers (2/3) Anthony PERARD
2012-06-12 15:05 ` [Qemu-devel] [PATCH V12 8/9] Introduce apic-msidef.h Anthony PERARD
2012-06-12 15:05 ` [Qemu-devel] [PATCH V12 9/9] Introduce Xen PCI Passthrough, MSI (3/3) Anthony PERARD

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=4FDA0A45.8030503@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xen-devel@lists.xen.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).