Re: [RFC][PATCH 0/2] KABI example conversion and cleanup

Arnd Bergmann
2006-04-02T20:47:38Z

On Sunday 02 April 2006 21:30, Kyle Moffett wrote:
> > 3) 'Preprocess' include/ and generate a set of KABI files based on
> > current set of (cleaned up) kernel header files.  'Preprocess in ''
> > because a C-preprocessor will not be suitable.
>
> I got the idea of preprocessing, but your sentence seems to have
> gotten mangled somewhere.  Any chance you could clarify?  From what I
> can see by looking through the current headers, preprocessing will
> not solve some of the duplication I'd like to try to clean up.  One
> example being the duplication of bitops in various macros all over
> the place, FD_SET/FD_CLR/FD_ISSET being a prime example of that
> duplication.  It would be really nice to be able to implement those
> in terms of __set_bit, etc, however those macros themselves must be
> made userspace-clean, including adding C89-compat macros for non-GCC
> compilers and other mild ugliness, even though they'd never be
> directly exposed for user programs.

These seem to be two completely independent problems. Reducing the
amount of duplication is a good thing all by itself that can be done
independent from finding a better way to provide the headers to
user space.

About one year ago, I started down this route in order to autogenerate
something like linux-libc-headers from the kernel tree, but never got
around to submitting anything because I could not keep up with the
changes.

What I did there was to put a Makefile into each include directory
with a list of the files that should get installed (the list from
llc) and then add a headers_install target to Makefile that would
run each header file through an open-coded version of
'unifdef -U__KERNEL__ < include/$FILE > $PREFIX/include/$FILE'.

The advantage of this approach is that it minimises the amount of
change to each of the current header files while making it relatively
easy to audit by looking for wrong stuff (namespace pollution,
CONFIG_* dependencies, ...) in the installed headers.