[PATCH 1/4] freebsd: Implement I/O port API

Adam Jackson ajax at redhat.com
Thu Sep 23 07:48:41 PDT 2010


On Wed, 2010-09-22 at 16:03 -0700, Keith Packard wrote:
> On Wed, 22 Sep 2010 16:10:49 -0400, Adam Jackson <ajax at redhat.com> wrote:
> 
> > +static struct pci_io_handle *
> > +pci_device_freebsd_open_legacy_io(struct pci_io_handle *ret,
> > +                                  struct pci_device *dev, pciaddr_t base,
> > +                                  pciaddr_t size)
> > +{
> > +    ret->fd = open("/dev/io", O_RDWR);
> > +
> > +    if (ret->fd < 0)
> > +	return NULL;
> > +
> > +    ret->base = base;
> > +    ret->size = size;
> > +
> > +    return ret;
> > +}
> 
> That's a terrible API. Is this fixed in stone somewhere? Or can it just
> return an error indication instead of NULL?

This isn't app API, this is just the backend talking to the frontend.
The external API is pretty similar.

libpciaccess in general doesn't really attempt to encode why an API call
would fail; the caller is assumed to have whatever privileges it needs
and to look at errno for any details.  Fixable, I suppose, but now
you're in soname bump territory for not a lot of win.

- ajax
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100923/7525c597/attachment.pgp>


More information about the xorg-devel mailing list