insmod broken in 1.1.1

Robert P. J. Day rpjday at mindspring.com
Sun Mar 26 13:34:16 PST 2006


On Sun, 26 Mar 2006, Rob Landley wrote:

> On Sunday 26 March 2006 10:20 am, Robert P. J. Day wrote:
> > > And _this_ is why you want to use if(ENABLE_BLAH) instead of #if
> > > ENABLE_BLAH, so the compiler barfs if you get the symbol wrong
> > > rather than silently ignoring it.  (And no, "#ifdef UNKNOWN_SYMBOL"
> > > never caught this sort of thing either.)
> >
> > looking at this a bit closer, would it not be possible to move all
> > endian-ness checking into include/platform.h and get that sort of
> > thing out of the source files themselves?  you know -- like how it's
> > done in the header file <netinet/in.h>:
> >
> > # if __BYTE_ORDER == __BIG_ENDIAN
> > # define ntohl(x)       (x)
> > # define ntohs(x)       (x)
> > # define htonl(x)       (x)
> > # define htons(x)       (x)
> > # else
> > #  if __BYTE_ORDER == __LITTLE_ENDIAN
> > #   define ntohl(x)     __bswap_32 (x)
> > #   define ntohs(x)     __bswap_16 (x)
> > #   define htonl(x)     __bswap_32 (x)
> > #   define htons(x)     __bswap_16 (x)
> > #  endif
> > # endif
> >
> > and implement the source files in terms of *these* primitives.  i
> > mean, does libbb/md5.c really need to define its own "swap" routines
> > based on endianness?
>
> I was actually pondering trying to use the networking macros in
> place of endianness tests, but unfortunately the networking macros
> only go one way: they provide HOST2BIGEND(x) and BIGEND2HOST(x).
> We'd need HOST2LITEND(x) and LITEND2HOST(x) as well to do it right.
>
> But yeah, there's room for cleanup here...

sorry, i explained that badly.  i wasn't suggesting using *exactly*
the networking macros, but defining a canonical set of macros *like*
them in platform.h so no other file needs to do that, and most of
those endian-ness tests can be removed everywhere else (at least,
everywhere it's practical to do that).

rday


More information about the busybox mailing list