How to sanitize in/out routines?

Matt Turner mattst88 at gmail.com
Thu Oct 15 18:58:17 PDT 2009


X predates glibc, so this is understandable, but the in/out/_in/_out
stuff is a mess.

For instance, the out* routines X defines are of the format outb(port,
val), which matches with with BSD provides, whereas glibc/Linux uses
outb(val, port). Then, since they're named identically with functions
in glibc, we've got to do silly things like naming them _outb.

Ideally, we want to call the C library-provided functions directly, or
maybe a static inline function to eliminate the call overhead.

This forces us to do silly things like

static __inline__ void
xf_outb(unsigned short port, unsigned char val)
{
    outb(val, port);
}
#define outb xf_outb

which also screws up clean ups like d908ee6e549fd8ff6.

So what's the best way of fixing this? Macros like OUTB? Should we
reverse the argument order to match glibc while we're at it?

I'd like to do this clean up to get rid of crap code in sys.c (see
commit above) and to fix the mess that is dense vs sparse on Alpha.

Thanks,
Matt


More information about the xorg-devel mailing list