Hello! > * Hopefully fixed ABI issue with u64. Please scrutinize. > - I am wondering if we shouldn't just take the ABI hit and just change > pciaddr_t to be u64 for simplicity. I can't imagine that there are that many > apps that rely on the library that can't be recompiled. I would really like to keep the ABI of the shared library compatible as long as possible -- both having to recompile everything and keeping multiple versions of the same library on a single system are very annoying. > diff --git a/lib/types.h b/lib/types.h > index 3e0e5c3..818872d 100644 > --- a/lib/types.h > +++ b/lib/types.h > @@ -15,39 +15,50 @@ > typedef BYTE u8; > typedef WORD u16; > typedef DWORD u32; > +typedef unsigned __int64 u64; > + > +#ifdef PCI_HAVE_64BIT_ADDRESS > +#include <limits.h> > +#if ULONG_MAX > 0xffffffff > +#define PRIu64 "l" > +#else > +#define PRIu64 "ll" > +#endif > +#endif Does this make sense? Does anyone promise what format sequence should be used with __int64? > #elif defined(PCI_HAVE_STDINT_H) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) > -#include <stdint.h> > +#include <inttypes.h> Is there any guarantee that <inttypes.h> is available? Isn't it C99 only? > #ifdef PCI_HAVE_64BIT_ADDRESS > #include <limits.h> > #if ULONG_MAX > 0xffffffff > -typedef unsigned long u64; > -#define PCI_U64_FMT "l" > +typedef unsigned long pciaddr_t; > #else > -typedef unsigned long long u64; > -#define PCI_U64_FMT "ll" > -#endif > +typedef unsigned long long pciaddr_t; > #endif > > -#endif /* PCI_HAVE_Uxx_TYPES */ > +#define PCIADDR_T_FMT "%08" PRIu64 "x" > +#define PCIADDR_PORT_FMT "%04" PRIu64 "x" You cannot do this. `unsigned long long' and PRIu64 do not mix. > --- a/setpci.c > +++ b/setpci.c > @@ -12,6 +12,7 @@ > #include <stdarg.h> > #include <unistd.h> > #include <errno.h> > +#include <inttypes.h> Again, you cannot rely on C99. > -Finally, you should append a width specifier \fB.B\fP, \fB.W\fP, or \fB.L\fP to choose > -how many bytes (1, 2, or 4) should be transferred. The width can be omitted if you are > -accessing a named register whose width is well known. > +Finally, you should append a width specifier \fB.B\fP, \fB.W\fP, \fB.L\fP, or \fB.Q\fP > +to choose how many bytes (1, 2, 4, or 8) should be transferred. The width can be > +omitted if you are accessing a named register whose width is well known. Please emphasize that the 8-byte accesses are not atomic, unlike their shorter counterparts. Have a nice fortnight -- Martin `MJ' Mares <mj@xxxxxx> http://mj.ucw.cz/ Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth COBOL -- Compiles Only Because Of Luck -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html