* style guide recommendations when including UAPI files?
@ 2018-10-03 11:27 rpjday at crashcourse.ca
0 siblings, 0 replies; only message in thread
From: rpjday at crashcourse.ca @ 2018-10-03 11:27 UTC (permalink / raw)
To: kernelnewbies
is there a strong (or even weak) style recommendation when including
kernel header files under include/uapi in terms of explicitly including
the "uapi" path component?
i'm fully aware of the standard that most kernel code should include
the "standard" kernel headers, such as:
#include <linux/mii.h>
where those headers are, of course, free to turn around and include
the corresponding UAPI content; the above header file does indeed do
just that:
#include <linux/if.h>
#include <uapi/linux/mii.h>
however, in that very example, you can see the include of "linux/if.h"
where there is, in fact, no header file include/linux/if.h, only
include/uapi/linux/if.h.
i can see from the top-level Makefile that that include will
eventually pick up the UAPI version of the if.h header file:
# Use USERINCLUDE when you must reference the UAPI directories only.
USERINCLUDE := \
-I$(srctree)/arch/$(SRCARCH)/include/uapi \
-I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \
-I$(srctree)/include/uapi \
-I$(objtree)/include/generated/uapi \
-include $(srctree)/include/linux/kconfig.h
# Use LINUXINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option
LINUXINCLUDE := \
-I$(srctree)/arch/$(SRCARCH)/include \
-I$(objtree)/arch/$(SRCARCH)/include/generated \
$(if $(KBUILD_SRC), -I$(srctree)/include) \
-I$(objtree)/include \
$(USERINCLUDE)
the point is, is that acceptable style? when i'm perusing kernel
code and i see a reference to a header file <linux/if.h>, i
simply assume it's a standard header file under include/, and
i expect header files under the UAPI directory will explicitly
say so in the include directive.
thoughts?
rday
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-10-03 11:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-03 11:27 style guide recommendations when including UAPI files? rpjday at crashcourse.ca
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).