Re: [GIT PULL -tip v3] fix 39 'make headers_check' warnings

Harvey Harrison
2009-01-19T18:08:51Z

On Mon, 2009-01-19 at 12:15 +0100, Ingo Molnar wrote:
> * Harvey Harrison <harvey.harrison@gmail.com> wrote:
> >
> > As part of doing the swab.h splitout it was very tempting to just stop
> > exporting _all_ of the asm/swab.h files now that there is a
> > linux/swab.h. But I ended up leaving things as they were on arches that
> > did expose their arch specific versions to userspace.
>
> i'd argue for a much narrower interface to user-space - we export so much
> stuff (more than 700 headers) and in such an unstructured way (75,000
> lines of code) that it's plain crazy.
>
> So if you think no x86 userspace actually needs swab.h, we can just wrap
> it all in __KERNEL__. I guess we cannot remove swab.h from
> include/linux/Kbuild, right?
>

Correct, include/linux/swab.h must stay as it provides the actual implementation
for the endian helpers cpu_to_le16, etc. But now that I've gotten all of this
split out of byteorder.h, we can hide all of the arch overrides by wrapping
the include of asm/swab.h in ifdef __KERNEL__ and unexporting it. That would
mean userpsace only gets the open-coded C versions and no inline asm from arch
overrides.

So, there wouldn't be any breakage, just possibly pessimization of generated
code if the compiler won't generate the optimized byteswaps on that arch.

Harvey