include: one folder per subsystem, and includes that name it

Sixty-five headers sat side by side in include/, so `#include "irq.h"`
said nothing about where irq.h was or what it belonged to, and errno.h,
stat.h and fcntl.h at the top shadowed the system's for any host tool
built with -I./include. They are in folders now -- arch/ core/ fs/
dev/ gfx/ net/ uapi/ (and ldls/ for the Linux driver layer) -- and
every include names the folder, as Linux's do: "core/proc.h".

Done mechanically and checked the hard way: the kernel built from this
tree disassembles identically to the one built from the tree before
it. The full image boots, and userland is the same set of programs.
Paths in docs and comments follow; docs/guides/layout.md has a table
of what is where, and tools/fix-includes.py rewrites old-style
includes from the folders in the tree, for code written before this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
Nexoniarz 2026-10-23 15:05:12 +02:00
commit a1c965da1e
267 changed files with 1560 additions and 1440 deletions

View file

@ -13,7 +13,7 @@
// programmer expects and getting it backwards produces something that almost
// works: Linux's writes take the **value first** and the address second.
#include "types.h"
#include "core/types.h"
#include "kpi.h"
// Every access is checked against the mapping `pci_iomap` returned.

View file

@ -9,12 +9,12 @@
// No comment, macro body or implementation has been carried over from
// anywhere. docs/architecture/ldls.md §3.
#include "types.h"
#include "user.h"
#include "fcntl.h"
#include "posix.h"
#include "pciuser.h"
#include "netuser.h"
#include "core/types.h"
#include "uapi/user.h"
#include "uapi/fcntl.h"
#include "uapi/posix.h"
#include "dev/pciuser.h"
#include "net/netuser.h"
#include "kpi.h"
struct kpi_ctx kpi;

View file

@ -16,7 +16,7 @@
// Organised under Linux's own header names so it is navigable: a reader who
// knows where `pci_iomap` lives in Linux knows where it is here.
#include "types.h"
#include "core/types.h"
// One entry per symbol LDLS can answer. The loader consults this before
// falling back to a logging stub, so an unimplemented symbol still reports

View file

@ -13,11 +13,11 @@
//
// The size comes from the same BTF the offsets do.
#include "types.h"
#include "user.h"
#include "fcntl.h"
#include "posix.h"
#include "netuser.h"
#include "core/types.h"
#include "uapi/user.h"
#include "uapi/fcntl.h"
#include "uapi/posix.h"
#include "net/netuser.h"
#include "kpi.h"
// Filled in by the host from BTF before the driver runs. Zero means the host

View file

@ -13,11 +13,11 @@
//
// This file is that claim being collected.
#include "types.h"
#include "user.h"
#include "fcntl.h"
#include "posix.h"
#include "pciuser.h"
#include "core/types.h"
#include "uapi/user.h"
#include "uapi/fcntl.h"
#include "uapi/posix.h"
#include "dev/pciuser.h"
#include "kpi.h"
// The PCI resource flag bits, which are ABI between the kernel and every

View file

@ -12,9 +12,9 @@
// from head**, not pointers. Treating them as pointers produces something that
// works for small packets on a lucky allocation and then does not.
#include "types.h"
#include "user.h"
#include "posix.h"
#include "core/types.h"
#include "uapi/user.h"
#include "uapi/posix.h"
#include "kpi.h"
// Room in front of the data for headers a stack might push. Linux reserves

View file

@ -13,7 +13,7 @@
// counter said packets were arriving and DHCP never completed. A crash would
// have been easier to find.
#include "types.h"
#include "core/types.h"
#include "kpi.h"
void *

View file

@ -27,9 +27,9 @@
// blocks stops everything, including the transmit path it is probably waiting
// for.
#include "types.h"
#include "user.h"
#include "posix.h"
#include "core/types.h"
#include "uapi/user.h"
#include "uapi/posix.h"
#include "kpi.h"
#define KPI_NWORK 16