On Mon, Aug 18, 2014 at 01:26:27PM +0200, Jérémie Courrèges-Anglas wrote:
> David Coppa <[email protected]> writes:
> 
> > Hi!
> >
> > Update to pciutils-3.2.1 and add a patch to make it work with
> > machdep.allowaperture=0 (for reading at least, code borrowed from
> > libpciaccess).
> >
> > OK?
> 
> Works fine on amd64, builds fine on sparc64 (but not pci bus to test).
> 
> OK with me, but I'd find the following addition useful:

I'm ok with either version.
> 
> 
> [...]
> 
> > Index: patches/patch-lib_obsd-device_c
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/pciutils/patches/patch-lib_obsd-device_c,v
> > retrieving revision 1.4
> > diff -u -p -u -p -r1.4 patch-lib_obsd-device_c
> > --- patches/patch-lib_obsd-device_c 11 Jul 2012 18:17:52 -0000      1.4
> > +++ patches/patch-lib_obsd-device_c 18 Aug 2014 06:01:22 -0000
> > @@ -1,7 +1,23 @@
> >  $OpenBSD: patch-lib_obsd-device_c,v 1.4 2012/07/11 18:17:52 gonzalo Exp $
> > ---- lib/obsd-device.c.orig Fri Jan  7 18:04:28 2011
> > -+++ lib/obsd-device.c      Fri Jun 29 10:19:48 2012
> > -@@ -56,11 +56,6 @@ static int
> > +--- lib/obsd-device.c.orig Fri Jan  7 22:04:28 2011
> > ++++ lib/obsd-device.c      Thu Aug 14 07:58:21 2014
> > +@@ -41,9 +41,12 @@ obsd_init(struct pci_access *a)
> > + {
> > +   char *name = pci_get_param(a, "obsd.path");
> > + 
> > +-  a->fd = open(name, O_RDWR, 0);
> > +-  if (a->fd < 0)
> > +-    a->error("obsd_init: %s open failed", name);
> > ++  a->fd = open(name, O_RDWR | O_CLOEXEC);
> > ++  if (a->fd == -1) {
> > ++    a->fd = open(name, O_RDONLY | O_CLOEXEC);
> > ++    if (a->fd == -1)
> > ++      a->error("obsd_init: %s open failed", name);
> 
> What about
> 
> ++      a->error("obsd_init: %s open failed (%s)", name, strerror(errno));
> 
> This file already includes errno.h and string.h
> The result would be something like:
> 
> lspci: obsd_init: /dev/pci open failed (Device not configured)
> 
> > ++  }
> > + }
> > + 
> > + static void
> > +@@ -56,11 +59,6 @@ static int
> >   obsd_read(struct pci_dev *d, int pos, byte *buf, int len)
> >   {
> >     struct pci_io pi;
> > @@ -13,7 +29,7 @@ $OpenBSD: patch-lib_obsd-device_c,v 1.4 
> >   
> >     if (!(len == 1 || len == 2 || len == 4))
> >       return pci_generic_block_read(d, pos, buf, len);
> > -@@ -81,18 +76,16 @@ obsd_read(struct pci_dev *d, int pos, byte *buf, int l
> > +@@ -81,18 +79,16 @@ obsd_read(struct pci_dev *d, int pos, byte *buf, int l
> >       else
> >               d->access->error("obsd_read: ioctl(PCIOCREAD) failed");
> >     }
> >
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 

-- 
Matthieu Herrb

Reply via email to