On Fri, Mar 13, 2026 at 11:09:13AM -0400, Sasha Levin wrote:
> Add a debugfs interface to expose kernel API specifications at runtime.
> This allows tools and users to query the complete API specifications
> through the debugfs filesystem.
> 
> The interface provides:
> - /sys/kernel/debug/kapi/list - lists all available API specifications
> - /sys/kernel/debug/kapi/specs/<name> - detailed info for each API
> 
> Each specification file includes:
> - Function name, version, and descriptions
> - Execution context requirements and flags
> - Parameter details with types, flags, and constraints
> - Return value specifications and success conditions
> - Error codes with descriptions and conditions
> - Locking requirements and constraints
> - Signal handling specifications
> - Examples, notes, and deprecation status
> 
> This enables runtime introspection of kernel APIs for documentation
> tools, static analyzers, and debugging purposes.
> 
> Signed-off-by: Sasha Levin <[email protected]>
> ---
>  Documentation/dev-tools/kernel-api-spec.rst |  88 ++--

You are removing stuff from the file you created earlier in this patch
series, is that ok?

> --- /dev/null
> +++ b/kernel/api/kapi_debugfs.c
> @@ -0,0 +1,503 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Kernel API specification debugfs interface
> + *
> + * This provides a debugfs interface to expose kernel API specifications
> + * at runtime, allowing tools and users to query the complete API specs.
> + */

No copyright line?  :)

And this is, a totally and crazy interface with debugfs, I love it!

Two minor minor nits:

> +static int __init kapi_debugfs_init(void)
> +{
> +     struct kernel_api_spec *spec;
> +     struct dentry *spec_dir;
> +
> +     /* Create main directory */
> +     kapi_debugfs_root = debugfs_create_dir("kapi", NULL);
> +
> +     /* Create list file */
> +     debugfs_create_file("list", 0444, kapi_debugfs_root, NULL, 
> &kapi_list_fops);
> +
> +     /* Create specs subdirectory */
> +     spec_dir = debugfs_create_dir("specs", kapi_debugfs_root);
> +
> +     /* Create a file for each API spec */
> +     for (spec = __start_kapi_specs; spec < __stop_kapi_specs; spec++) {
> +             debugfs_create_file(spec->name, 0444, spec_dir, spec, 
> &kapi_spec_fops);
> +     }

No need for { }

> +
> +     pr_info("Kernel API debugfs interface initialized\n");

When code is working properly, it should be quiet, no need for this as
initializing this can not fail.

thanks,

greg k-h

Reply via email to