All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Konrad Rzeszutek Wilk <konrad@darnok.org>
Cc: Xen Devel <xen-devel@lists.xensource.com>,
	QEMU-devel <qemu-devel@nongnu.org>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [Xen-devel] [PATCH V11 3/8] Introduce XenHostPCIDevice to access a pci device on the host.
Date: Tue, 22 May 2012 13:52:09 +0100	[thread overview]
Message-ID: <4FBB8BF9.2040306@citrix.com> (raw)
In-Reply-To: <20120516112445.GB21609@andromeda.dapyr.net>

On 16/05/12 12:24, Konrad Rzeszutek Wilk wrote:
> On Tue, Apr 03, 2012 at 04:32:38PM +0100, Anthony PERARD wrote:
>> Signed-off-by: Anthony PERARD<anthony.perard@citrix.com>
>
> Looks good, thought I've just couple of tiny comments:
>
>> +#define XEN_HOST_PCI_RESSOURCE_BUFFER_SIZE 512
>
> You might want a comment explaining why 512, and not
> a more precise number like 741.

Actually, I only need the first 7 line of the resources file. So this 
is 399 bytes. I just add a little bit more.

>> +{
> .. snip..
>> +    do {
>> +        rc = read(fd,&buf, sizeof (buf) - 1);
>> +        if (rc<  0&&  errno != EINTR) {
>> +            rc = -errno;
>> +            goto out;
>> +        }
>> +    } while (rc<  0);
>
> Ok, you read it in. Maybe my 'wc' magic is gone, but this
> is what I get:
> [root@localhost 0000:00:02.0]# cat resource | wc -c
> 741
> .. snip..
>> +#define XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE 42
>
> The answer to the life? Can you provide a comment explaining
> the reason why it is 42, please?

I just define more than needed, and 42 is a good number :-).
But the maximum I need is probably 7 (for example '0x8086\n', for a 
vendor id). Or 20, number of digit in LONG_MAX, base 10.

>> +static int xen_host_pci_get_value(XenHostPCIDevice *d, const char *name,
>> +                                  unsigned int *pvalue, int base)
>> +{


-- 
Anthony PERARD

WARNING: multiple messages have this Message-ID (diff)
From: Anthony PERARD <anthony.perard@citrix.com>
To: Konrad Rzeszutek Wilk <konrad@darnok.org>
Cc: Xen Devel <xen-devel@lists.xensource.com>,
	QEMU-devel <qemu-devel@nongnu.org>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [Xen-devel] [PATCH V11 3/8] Introduce XenHostPCIDevice to access a pci device on the host.
Date: Tue, 22 May 2012 13:52:09 +0100	[thread overview]
Message-ID: <4FBB8BF9.2040306@citrix.com> (raw)
In-Reply-To: <20120516112445.GB21609@andromeda.dapyr.net>

On 16/05/12 12:24, Konrad Rzeszutek Wilk wrote:
> On Tue, Apr 03, 2012 at 04:32:38PM +0100, Anthony PERARD wrote:
>> Signed-off-by: Anthony PERARD<anthony.perard@citrix.com>
>
> Looks good, thought I've just couple of tiny comments:
>
>> +#define XEN_HOST_PCI_RESSOURCE_BUFFER_SIZE 512
>
> You might want a comment explaining why 512, and not
> a more precise number like 741.

Actually, I only need the first 7 line of the resources file. So this 
is 399 bytes. I just add a little bit more.

>> +{
> .. snip..
>> +    do {
>> +        rc = read(fd,&buf, sizeof (buf) - 1);
>> +        if (rc<  0&&  errno != EINTR) {
>> +            rc = -errno;
>> +            goto out;
>> +        }
>> +    } while (rc<  0);
>
> Ok, you read it in. Maybe my 'wc' magic is gone, but this
> is what I get:
> [root@localhost 0000:00:02.0]# cat resource | wc -c
> 741
> .. snip..
>> +#define XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE 42
>
> The answer to the life? Can you provide a comment explaining
> the reason why it is 42, please?

I just define more than needed, and 42 is a good number :-).
But the maximum I need is probably 7 (for example '0x8086\n', for a 
vendor id). Or 20, number of digit in LONG_MAX, base 10.

>> +static int xen_host_pci_get_value(XenHostPCIDevice *d, const char *name,
>> +                                  unsigned int *pvalue, int base)
>> +{


-- 
Anthony PERARD

  reply	other threads:[~2012-05-22 12:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-03 15:32 [Qemu-devel] [PATCH V11 0/8] Xen PCI Passthrough Anthony PERARD
2012-04-03 15:32 ` Anthony PERARD
2012-04-03 15:32 ` [Qemu-devel] [PATCH V11 1/8] pci_ids: Add INTEL_82599_SFP_VF id Anthony PERARD
2012-04-03 15:32   ` Anthony PERARD
2012-04-03 15:32 ` [Qemu-devel] [PATCH V11 2/8] configure: Introduce --enable-xen-pci-passthrough Anthony PERARD
2012-04-03 15:32   ` Anthony PERARD
2012-04-03 15:32 ` [Qemu-devel] [PATCH V11 3/8] Introduce XenHostPCIDevice to access a pci device on the host Anthony PERARD
2012-04-03 15:32   ` Anthony PERARD
2012-05-16 11:24   ` [Qemu-devel] [Xen-devel] " Konrad Rzeszutek Wilk
2012-05-16 11:24     ` Konrad Rzeszutek Wilk
2012-05-22 12:52     ` Anthony PERARD [this message]
2012-05-22 12:52       ` Anthony PERARD
2012-04-03 15:32 ` [Qemu-devel] [PATCH V11 4/8] pci.c: Add opaque argument to pci_for_each_device Anthony PERARD
2012-04-03 15:32   ` Anthony PERARD
2012-04-03 15:32 ` [Qemu-devel] [PATCH V11 5/8] Introduce Xen PCI Passthrough, qdevice (1/3) Anthony PERARD
2012-04-03 15:32   ` Anthony PERARD
2012-05-16 11:31   ` [Qemu-devel] [Xen-devel] " Konrad Rzeszutek Wilk
2012-05-16 11:31     ` Konrad Rzeszutek Wilk
2012-04-03 15:32 ` [Qemu-devel] [PATCH V11 6/8] Introduce Xen PCI Passthrough, PCI config space helpers (2/3) Anthony PERARD
2012-04-03 15:32   ` Anthony PERARD
2012-04-03 15:32 ` [Qemu-devel] [PATCH V11 7/8] Introduce apic-msidef.h Anthony PERARD
2012-04-03 15:32   ` Anthony PERARD
2012-04-03 15:32 ` [Qemu-devel] [PATCH V11 8/8] Introduce Xen PCI Passthrough, MSI (3/3) Anthony PERARD
2012-04-03 15:32   ` 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=4FBB8BF9.2040306@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=konrad@darnok.org \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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.