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

@ -20,20 +20,20 @@
// over a PCI device and this decided it was a GPU, which is the property that
// makes the interface general rather than a hole shaped like one thing.
#include "types.h"
#include "user.h"
#include "fcntl.h"
#include "posix.h"
#include "pciuser.h"
#include "virtio.h"
#include "schinit.h"
#include "socket.h"
#include "theme.h" // SCH_BG, SCH_ACCENT -- one palette, see docs/branding
#include "logo.h" // the mark, the same bytes the loader and console draw
#include "fb.h" // the console framebuffer, which this mirrors
#include "core/types.h"
#include "uapi/user.h"
#include "uapi/fcntl.h"
#include "uapi/posix.h"
#include "dev/pciuser.h"
#include "dev/virtio.h"
#include "uapi/schinit.h"
#include "net/socket.h"
#include "gfx/theme.h" // SCH_BG, SCH_ACCENT -- one palette, see docs/branding
#include "gfx/logo.h" // the mark, the same bytes the loader and console draw
#include "gfx/fb.h" // the console framebuffer, which this mirrors
// lib/glue.c has these -- they exist because the compiler emits calls to them
// whether or not anything asks -- but include/user.h never declared them.
// whether or not anything asks -- but include/uapi/user.h never declared them.
void *memcpy(void *, const void *, unsigned long);
int memcmp(const void *, const void *, unsigned long);
@ -114,7 +114,7 @@ die(const char *why)
// Not a failure: a report. There is no virtio-gpu here, or the kernel will not
// give it up, and neither of those changes by trying again -- so this tells the
// supervisor to stop, rather than being restarted every three seconds for the
// rest of the uptime. See SCHINIT_EXIT_NORESTART in include/schinit.h.
// rest of the uptime. See SCHINIT_EXIT_NORESTART in include/uapi/schinit.h.
static void
nothing_to_do(const char *why)
{
@ -625,7 +625,7 @@ present(void)
//
// The mark answers the same question a black screen cannot -- something is
// driving this device -- and answers it as the system rather than as a test
// rig. Same include/logo.h the loader splash and the kernel console draw, so
// rig. Same include/gfx/logo.h the loader splash and the kernel console draw, so
// there is one mark and one set of bytes.
static void
draw_mark(void)
@ -812,7 +812,7 @@ mirror_pass(void)
//
// So the kernel is told, in advance, where to paint: it writes the report into
// this framebuffer and asks the kernel driver it took this device from to
// reset it and flush one frame. See PCIIOC_PANICFB in include/pciuser.h.
// reset it and flush one frame. See PCIIOC_PANICFB in include/dev/pciuser.h.
//
// Called again after every modeset, because the size is half of what was
// registered. Failing is not fatal to anything: it costs the crash screen on