All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 3 of 4 v2] libxl: Introduce pci_assignable_add and pci_assignable_remove
Date: Mon, 21 May 2012 10:13:25 -0400	[thread overview]
Message-ID: <20120521141324.GJ8119@phenom.dumpdata.com> (raw)
In-Reply-To: <1336987293.31817.41.camel@zakaz.uk.xensource.com>

On Mon, May 14, 2012 at 10:21:33AM +0100, Ian Campbell wrote:
> > +
> > +/* Scan through /sys/.../pciback/slots looking for pcidev's BDF */
> > +static int pciback_dev_has_slot(libxl__gc *gc, libxl_device_pci *pcidev)
> > +{
> > +    libxl_ctx *ctx = libxl__gc_owner(gc);
> > +    FILE *f;
> > +    int rc = 0;
> > +    unsigned dom, bus, dev, func;
> > +
> > +    f = fopen(SYSFS_PCIBACK_DRIVER"/slots", "r");
> > +
> > +    if (f == NULL) {
> > +        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s",
> > +                         SYSFS_PCIBACK_DRIVER"/slots");
> > +        return ERROR_FAIL;
> > +    }
> > +
> > +    while(fscanf(f, "%x:%x:%x.%x\n", &dom, &bus, &dev, &func)==3) {

And the last one should be %d.

> 
> Shouldn't this 3 be 4 now that you include dom?
> 
> Also ISTR some change to the precise formatting using by the kernel for
> BDFs recently (A . became a : or vice versa?). CCing Konrad for input in
> case it impacts this too.
> 
> The rest all looked fine.
> 
> > +        if(dom == pcidev->domain
> > +           && bus == pcidev->bus
> > +           && dev == pcidev->dev
> > +           && func == pcidev->func) {
> > +            rc = 1;
> > +            goto out;
> > +        }
> > +    }
> > +out:
> > +    fclose(f);
> > +    return rc;
> > +}
> > +

  parent reply	other threads:[~2012-05-21 14:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-11 13:31 [PATCH 0 of 4 v2] Add commands to automatically prep devices for pass-through George Dunlap
2012-05-11 13:31 ` [PATCH 1 of 4 v2] libxl: Make a helper function write a BDF to a sysfs path George Dunlap
2012-05-11 13:31 ` [PATCH 2 of 4 v2] libxl: Rename pci_list_assignable to pci_assignable_list George Dunlap
2012-05-11 13:31 ` [PATCH 3 of 4 v2] libxl: Introduce pci_assignable_add and pci_assignable_remove George Dunlap
2012-05-14  9:21   ` Ian Campbell
2012-05-14 10:06     ` George Dunlap
2012-05-21 14:13     ` Konrad Rzeszutek Wilk [this message]
2012-05-22  8:15       ` Ian Campbell
2012-05-11 13:31 ` [PATCH 4 of 4 v2] xl: Add pci_assignable_add and remove commands George Dunlap
2012-05-14  9:24   ` Ian Campbell

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=20120521141324.GJ8119@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --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.