Skip to content

Commit

Permalink
uapi: export all headers under uapi directories
Browse files Browse the repository at this point in the history
Regularly, when a new header is created in include/uapi/, the developer
forgets to add it in the corresponding Kbuild file. This error is usually
detected after the release is out.

In fact, all headers under uapi directories should be exported, thus it's
useless to have an exhaustive list.

After this patch, the following files, which were not exported, are now
exported (with make headers_install_all):
asm-arc/kvm_para.h
asm-arc/ucontext.h
asm-blackfin/shmparam.h
asm-blackfin/ucontext.h
asm-c6x/shmparam.h
asm-c6x/ucontext.h
asm-cris/kvm_para.h
asm-h8300/shmparam.h
asm-h8300/ucontext.h
asm-hexagon/shmparam.h
asm-m32r/kvm_para.h
asm-m68k/kvm_para.h
asm-m68k/shmparam.h
asm-metag/kvm_para.h
asm-metag/shmparam.h
asm-metag/ucontext.h
asm-mips/hwcap.h
asm-mips/reg.h
asm-mips/ucontext.h
asm-nios2/kvm_para.h
asm-nios2/ucontext.h
asm-openrisc/shmparam.h
asm-parisc/kvm_para.h
asm-powerpc/perf_regs.h
asm-sh/kvm_para.h
asm-sh/ucontext.h
asm-tile/shmparam.h
asm-unicore32/shmparam.h
asm-unicore32/ucontext.h
asm-x86/hwcap2.h
asm-xtensa/kvm_para.h
drm/armada_drm.h
drm/etnaviv_drm.h
drm/vgem_drm.h
linux/aspeed-lpc-ctrl.h
linux/auto_dev-ioctl.h
linux/bcache.h
linux/btrfs_tree.h
linux/can/vxcan.h
linux/cifs/cifs_mount.h
linux/coresight-stm.h
linux/cryptouser.h
linux/fsmap.h
linux/genwqe/genwqe_card.h
linux/hash_info.h
linux/kcm.h
linux/kcov.h
linux/kfd_ioctl.h
linux/lightnvm.h
linux/module.h
linux/nbd-netlink.h
linux/nilfs2_api.h
linux/nilfs2_ondisk.h
linux/nsfs.h
linux/pr.h
linux/qrtr.h
linux/rpmsg.h
linux/sched/types.h
linux/sed-opal.h
linux/smc.h
linux/smc_diag.h
linux/stm.h
linux/switchtec_ioctl.h
linux/vfio_ccw.h
linux/wil6210_uapi.h
rdma/bnxt_re-abi.h

Note that I have removed from this list the files which are generated in every
exported directories (like .install or .install.cmd).

Thanks to Julien Floret <[email protected]> for the tip to get all
subdirs with a pure makefile command.

For the record, note that exported files for asm directories are a mix of
files listed by:
 - include/uapi/asm-generic/Kbuild.asm;
 - arch/<arch>/include/uapi/asm/Kbuild;
 - arch/<arch>/include/asm/Kbuild.

Signed-off-by: Nicolas Dichtel <[email protected]>
Acked-by: Daniel Vetter <[email protected]>
Acked-by: Russell King <[email protected]>
Acked-by: Mark Salter <[email protected]>
Acked-by: Michael Ellerman <[email protected]> (powerpc)
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
NicolasDichtel authored and masahir0y committed May 10, 2017
1 parent ea6819e commit fcc8487
Show file tree
Hide file tree
Showing 80 changed files with 111 additions and 1,750 deletions.
66 changes: 41 additions & 25 deletions Documentation/kbuild/makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ This document describes the Linux kernel Makefiles.
--- 6.11 Post-link pass

=== 7 Kbuild syntax for exported headers
--- 7.1 header-y
--- 7.1 no-export-headers
--- 7.2 genhdr-y
--- 7.3 generic-y
--- 7.4 generated-y
--- 7.5 mandatory-y
--- 7.6 subdir-y

=== 8 Kbuild Variables
=== 9 Makefile language
Expand Down Expand Up @@ -1235,7 +1237,7 @@ When kbuild executes, the following steps are followed (roughly):
that may be shared between individual architectures.
The recommended approach how to use a generic header file is
to list the file in the Kbuild file.
See "7.4 generic-y" for further info on syntax etc.
See "7.3 generic-y" for further info on syntax etc.

--- 6.11 Post-link pass

Expand All @@ -1262,37 +1264,30 @@ The pre-processing does:
- drop include of compiler.h
- drop all sections that are kernel internal (guarded by ifdef __KERNEL__)

Each relevant directory contains a file name "Kbuild" which specifies the
headers to be exported.
See subsequent chapter for the syntax of the Kbuild file.

--- 7.1 header-y

header-y specifies header files to be exported.

Example:
#include/linux/Kbuild
header-y += usb/
header-y += aio_abi.h
All headers under include/uapi/, include/generated/uapi/,
arch/<arch>/include/uapi/asm/ and arch/<arch>/include/generated/uapi/asm/
are exported.

The convention is to list one file per line and
preferably in alphabetic order.
A Kbuild file may be defined under arch/<arch>/include/uapi/asm/ and
arch/<arch>/include/asm/ to list asm files coming from asm-generic.
See subsequent chapter for the syntax of the Kbuild file.

header-y also specifies which subdirectories to visit.
A subdirectory is identified by a trailing '/' which
can be seen in the example above for the usb subdirectory.
--- 7.1 no-export-headers

Subdirectories are visited before their parent directories.
no-export-headers is essentially used by include/uapi/linux/Kbuild to
avoid exporting specific headers (e.g. kvm.h) on architectures that do
not support it. It should be avoided as much as possible.

--- 7.2 genhdr-y

genhdr-y specifies generated files to be exported.
Generated files are special as they need to be looked
up in another directory when doing 'make O=...' builds.
genhdr-y specifies asm files to be generated.

Example:
#include/linux/Kbuild
genhdr-y += version.h
#arch/x86/include/uapi/asm/Kbuild
genhdr-y += unistd_32.h
genhdr-y += unistd_64.h
genhdr-y += unistd_x32.h


--- 7.3 generic-y

Expand Down Expand Up @@ -1334,6 +1329,27 @@ See subsequent chapter for the syntax of the Kbuild file.
#arch/x86/include/asm/Kbuild
generated-y += syscalls_32.h

--- 7.5 mandatory-y

mandatory-y is essentially used by include/uapi/asm-generic/Kbuild.asm
to define the minimun set of headers that must be exported in
include/asm.

The convention is to list one subdir per line and
preferably in alphabetic order.

--- 7.6 subdir-y

subdir-y may be used to specify a subdirectory to be exported.

Example:
#arch/cris/include/uapi/asm/Kbuild
subdir-y += ../arch-v10/arch/
subdir-y += ../arch-v32/arch/

The convention is to list one subdir per line and
preferably in alphabetic order.

=== 8 Kbuild Variables

The top Makefile exports the following variables:
Expand Down
41 changes: 0 additions & 41 deletions arch/alpha/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,43 +1,2 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

header-y += a.out.h
header-y += auxvec.h
header-y += bitsperlong.h
header-y += byteorder.h
header-y += compiler.h
header-y += console.h
header-y += errno.h
header-y += fcntl.h
header-y += fpu.h
header-y += gentrap.h
header-y += ioctl.h
header-y += ioctls.h
header-y += ipcbuf.h
header-y += kvm_para.h
header-y += mman.h
header-y += msgbuf.h
header-y += pal.h
header-y += param.h
header-y += poll.h
header-y += posix_types.h
header-y += ptrace.h
header-y += reg.h
header-y += regdef.h
header-y += resource.h
header-y += sembuf.h
header-y += setup.h
header-y += shmbuf.h
header-y += sigcontext.h
header-y += siginfo.h
header-y += signal.h
header-y += socket.h
header-y += sockios.h
header-y += stat.h
header-y += statfs.h
header-y += swab.h
header-y += sysinfo.h
header-y += termbits.h
header-y += termios.h
header-y += types.h
header-y += unistd.h
3 changes: 0 additions & 3 deletions arch/arc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm
header-y += elf.h
header-y += page.h
header-y += cachectl.h
17 changes: 0 additions & 17 deletions arch/arm/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

header-y += auxvec.h
header-y += byteorder.h
header-y += fcntl.h
header-y += hwcap.h
header-y += ioctls.h
header-y += kvm_para.h
header-y += mman.h
header-y += perf_regs.h
header-y += posix_types.h
header-y += ptrace.h
header-y += setup.h
header-y += sigcontext.h
header-y += signal.h
header-y += stat.h
header-y += statfs.h
header-y += swab.h
header-y += unistd.h
genhdr-y += unistd-common.h
genhdr-y += unistd-oabi.h
genhdr-y += unistd-eabi.h
18 changes: 0 additions & 18 deletions arch/arm64/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,3 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += kvm_para.h

header-y += auxvec.h
header-y += bitsperlong.h
header-y += byteorder.h
header-y += fcntl.h
header-y += hwcap.h
header-y += kvm_para.h
header-y += perf_regs.h
header-y += param.h
header-y += ptrace.h
header-y += setup.h
header-y += sigcontext.h
header-y += siginfo.h
header-y += signal.h
header-y += stat.h
header-y += statfs.h
header-y += ucontext.h
header-y += unistd.h
17 changes: 0 additions & 17 deletions arch/blackfin/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,19 +1,2 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

header-y += bfin_sport.h
header-y += byteorder.h
header-y += cachectl.h
header-y += fcntl.h
header-y += fixed_code.h
header-y += ioctls.h
header-y += kvm_para.h
header-y += poll.h
header-y += posix_types.h
header-y += ptrace.h
header-y += sigcontext.h
header-y += siginfo.h
header-y += signal.h
header-y += stat.h
header-y += swab.h
header-y += unistd.h
8 changes: 0 additions & 8 deletions arch/c6x/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,3 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += kvm_para.h

header-y += byteorder.h
header-y += kvm_para.h
header-y += ptrace.h
header-y += setup.h
header-y += sigcontext.h
header-y += swab.h
header-y += unistd.h
5 changes: 0 additions & 5 deletions arch/cris/include/uapi/arch-v10/arch/Kbuild

This file was deleted.

3 changes: 0 additions & 3 deletions arch/cris/include/uapi/arch-v32/arch/Kbuild

This file was deleted.

43 changes: 2 additions & 41 deletions arch/cris/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,44 +1,5 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

header-y += ../arch-v10/arch/
header-y += ../arch-v32/arch/
header-y += auxvec.h
header-y += bitsperlong.h
header-y += byteorder.h
header-y += elf.h
header-y += elf_v10.h
header-y += elf_v32.h
header-y += errno.h
header-y += ethernet.h
header-y += etraxgpio.h
header-y += fcntl.h
header-y += ioctl.h
header-y += ioctls.h
header-y += ipcbuf.h
header-y += mman.h
header-y += msgbuf.h
header-y += param.h
header-y += poll.h
header-y += posix_types.h
header-y += ptrace.h
header-y += ptrace_v10.h
header-y += ptrace_v32.h
header-y += resource.h
header-y += rs485.h
header-y += sembuf.h
header-y += setup.h
header-y += shmbuf.h
header-y += sigcontext.h
header-y += siginfo.h
header-y += signal.h
header-y += socket.h
header-y += sockios.h
header-y += stat.h
header-y += statfs.h
header-y += swab.h
header-y += sync_serial.h
header-y += termbits.h
header-y += termios.h
header-y += types.h
header-y += unistd.h
subdir-y += ../arch-v10/arch/
subdir-y += ../arch-v32/arch/
33 changes: 0 additions & 33 deletions arch/frv/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,35 +1,2 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

header-y += auxvec.h
header-y += bitsperlong.h
header-y += byteorder.h
header-y += errno.h
header-y += fcntl.h
header-y += ioctl.h
header-y += ioctls.h
header-y += ipcbuf.h
header-y += kvm_para.h
header-y += mman.h
header-y += msgbuf.h
header-y += param.h
header-y += poll.h
header-y += posix_types.h
header-y += ptrace.h
header-y += registers.h
header-y += resource.h
header-y += sembuf.h
header-y += setup.h
header-y += shmbuf.h
header-y += sigcontext.h
header-y += siginfo.h
header-y += signal.h
header-y += socket.h
header-y += sockios.h
header-y += stat.h
header-y += statfs.h
header-y += swab.h
header-y += termbits.h
header-y += termios.h
header-y += types.h
header-y += unistd.h
28 changes: 0 additions & 28 deletions arch/h8300/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,30 +1,2 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

header-y += auxvec.h
header-y += bitsperlong.h
header-y += errno.h
header-y += fcntl.h
header-y += ioctl.h
header-y += ioctls.h
header-y += ipcbuf.h
header-y += kvm_para.h
header-y += mman.h
header-y += msgbuf.h
header-y += param.h
header-y += poll.h
header-y += posix_types.h
header-y += resource.h
header-y += sembuf.h
header-y += setup.h
header-y += shmbuf.h
header-y += siginfo.h
header-y += socket.h
header-y += sockios.h
header-y += stat.h
header-y += statfs.h
header-y += swab.h
header-y += termbits.h
header-y += termios.h
header-y += types.h
header-y += unistd.h
3 changes: 0 additions & 3 deletions arch/hexagon/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

header-y += ucontext.h

generic-y += auxvec.h
generic-y += barrier.h
generic-y += bug.h
Expand Down
13 changes: 0 additions & 13 deletions arch/hexagon/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm

header-y += bitsperlong.h
header-y += byteorder.h
header-y += kvm_para.h
header-y += param.h
header-y += ptrace.h
header-y += registers.h
header-y += setup.h
header-y += sigcontext.h
header-y += signal.h
header-y += swab.h
header-y += unistd.h
header-y += user.h
Loading

0 comments on commit fcc8487

Please sign in to comment.