[PATCH] remove kernel headers from hdparm

Rob Landley rob at landley.net
Fri Apr 28 19:17:42 UTC 2006


On Friday 28 April 2006 8:35 am, Tito wrote:
> In the meanwhile here is the patch.
> It contains also a minor fix to the code
> (for buggy logic)
> and reduces the size as the elements
> in linux/hdreg.h are defined only
> when needed
>
>   text    data     bss     dec     hex filename
>   27422     176     904   28502    6f56 hdparm.o.orig
>   27294     176     888   28358    6ec6 hdparm.o
>
> This is tested and safe.

Reducing the size is definitely attractive.  Do you know what's responsible 
for that?

> Please apply.
>
> PS: just take a look at this:
>
> #if BB_BIG_ENDIAN && !defined(__USE_XOPEN)
> # define __USE_XOPEN
> /* From /linux/byteorder/big_endian.h */
> #define __le16_to_cpus(x) __swab16s((x))
> #else
> /* From /linux/byteorder/little_endian.h */
> #define __le16_to_cpus(x) do {} while (0)
> #endif
>
> as this is tested only for little endian and maybe
> should be moved to platform.h?

That looks outright disgusting.  I note also that it's only used in two 
places.

Wasn't there a proposal recently for something like TO_BIG_ENDIAN(value), 
FROM_BIG_ENDIAN(value), TO_LITTLE_ENDIAN(value), and 
FROM_LITTLE_ENDIAN(value)?

I'd like to disguise this in platform.h, yes.  But I'd also like to try to 
find a more generic solution to whatever problem it's trying to solve.

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list