puzzled by a couple things related to "uapi"

Luis R. Rodriguez mcgrof at do-not-panic.com
Thu Oct 25 14:53:47 EDT 2012


On Thu, Oct 25, 2012 at 11:46 AM, Robert P. J. Day
<rpjday at crashcourse.ca> wrote:
>
>   looking at the "uapi" reorganization in the kernel source for the
> first time, and a couple things confuse me.
>
>   i see the principle -- collect all the userspace API content in one
> place, in this case include/uapi/.  this obviously(?) is supposed to
> represent a newer way to represent what you got formerly with
>
>   $ make headers_install
>
> that is, header files identified in Kbuild files, cleansed of any
> kernel-only content, then placed under usr/include in the source tree.
> is that about right -- is that what it's supposed to represent?

Read this guy as well:

http://lwn.net/Articles/507794/

So avoiding issues with double dependency is really another objective.

>   so at a *guess*, it would seem that, if a header file that should be
> part of uapi didn't need any cleaning, it could go straight into
> include/uapi untouched.

Yup.

>   on the other hand, if a header file *did* have some kernel-only
> content, i would have *thought* that there would be two versions of
> that header file:
>
>   a) the one with the kernel-only content still under include/linux,
> which would turn around and, in some way, include ..

It includes the respective uapi header as well.

>   b) the common content file under include/uapi
>
>   does that make sense?  because i took a quick look and here's an
> example i don't understand.  there's include/linux/coda.h, with the
> contents:
>
> #if defined(__linux__)
> typedef unsigned long long u_quad_t;
> #else
> #endif
> #include <uapi/linux/coda.h>
> #endif
>
>   ok, so far, so good.  but then there's this in
> include/uapi/linux/coda.h:
>
> ... snip ...
> #ifdef KERNEL                    <--- ?????
> typedef unsigned long u_long;
> typedef unsigned int u_int;
> typedef unsigned short u_short;
> typedef u_long ino_t;
> typedef u_long dev_t;
> typedef void * caddr_t;
> ... snip ...

Interesting, not sure. David ? I do see some BSD'ish deps there  (#if
defined(__NetBSD__))... so not sure if that was left to them or what.

>   why is there still kernel-only content in the uapi/ directory?
> maybe i just don't understand the rationale for what's going on here.

No, I'm as puzzled.

  Luis



More information about the Kernelnewbies mailing list