Re: [PATCH v5 05/11] kernel/api: add API specification for sys_open

From: Gregory Price

Date: Thu Oct 08 2026 - 09:14:09 EST


On Thu, Oct 08, 2026 at 07:49:34AM -0500, Serge E. Hallyn wrote:
> On Thu, Oct 08, 2026 at 04:49:45AM -0400, Sasha Levin wrote:
> > Add KAPI-annotated kerneldoc for the sys_open system call in fs/open.c.
> >
> > The specification documents parameter constraints (pathname, flags
> > bitmask, permission mode), 24 error conditions, locking requirements,
> > side effects, required capabilities, and usage examples.
> >
> > Assisted-by: LLM
> > Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
>
> I know Kees and Jonathan and others asked for exactly this. But one
> downside to this is it makes just paging through fs/open.c a lot more
> painful. Maybe it's worth it. Maybe "noone will ever do that again" bc
> that's why we have ai and tools. But a) that's how I've historically
> done a lot of code research, b) IMO something like a manpages section 2
> under Documentation/ would be a great place for this, and c) we can also
> use tools to always sync these, or even show/edit in a single view when
> you want ('kdocedit fs/open.c').
>

In many, many other projects i've worked on, these docs are placed in
the header as opposed to the .c file, but I understand there is some
pain that comes with ifdef.

Keeping it in the header ties the definition to exactly the location
external users import to find the function - so it makes sense.

But separating the contracts from the code guarantees they'll go stale,
so I don't think shoving it in Documentation/ does anyone any good.

~Gregory