--- Documentation/core-api/kernel-api.rst | 6 + init/kdoc-globals-test.c | 96 ++++++++++++++++++++++++ 2 files changed, 102 insertions(+) --- /dev/null +++ linux-next-20250908/init/kdoc-globals-test.c @@ -0,0 +1,96 @@ +// kdoc-globals-test.c: +// test kernel-doc "global" keyword. + +// from init/do_mounts.c: +/** + * global ROOT_DEV - system root device + * + * @ROOT_DEV is either the successful root device or the root device + * that failed boot in the boot failure message. + */ +unsigned long ROOT_DEV; +//dev_t ROOT_DEV; + +// from init/main.c: +/** + * global system_state - system state used during boot or suspend/hibernate/resume + * + * @system_state can be used during boot to determine if it is safe to + * make certain calls to other parts of the kernel. It can also be used + * during suspend/hibernate or resume to determine the order of actions + * that need to be executed. The numerical values of system_state are + * sometimes used in numerical ordering tests, so the relative values + * must not be altered. + */ +enum system_states system_state __read_mostly; + +/** + * global saved_command_line - kernel's command line, saved from use at + * any later time in the kernel. + */ +char *saved_command_line __ro_after_init; + +/** + * global loop_per_jiffy - calculated loop count needed to consume one jiffy + * of time + */ +unsigned long loops_per_jiffy = (1<<12); + +// from init/calibrate.c: +/** + * global preset_lpj - lpj (loops per jiffy) value set from kernel + * command line using "lpj=VALUE" + * + * See Documentation/admin-guide/kernel-parameters.txt ("lpj=") for details. + */ +unsigned long preset_lpj; + +// from init/version.c: +/** + * global linux_proc_banner - text used from /proc/version file + * + * * first %s is sysname (e.g., "Linux") + * * second %s is release + * * third %s is version + */ +char linux_proc_banner[]; +#if 0 +const char linux_proc_banner[] = + "%s version %s" + " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")" + " (" LINUX_COMPILER ") %s\n"; +#endif + +// from init/version-timestamp.c: +/** + * global linux_banner - Linux boot banner, usually printed at boot time + */ +const char linux_banner[]; +#if 0 +const char linux_banner[] = + "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" + LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n"; +#endif + +// from block/genhd.c: +/** + * global diskseq - unique sequence number for block device instances + * + * Allows userspace to associate uevents to the lifetime of a device + */ +static atomic64_t diskseq; + +// from net/core/rtnetlink.c: +/** + * global rtnl_mutex - historical global lock for networking control operations. + * + * @rtnl_mutex is used to serialize rtnetlink requests + * and protect all kernel internal data structures related to networking. + * + * See Documentation/networking/netdevices.rst for details. + * Often known as the rtnl_lock, although rtnl_lock is a kernel function. + */ +unsigned long rtnl_mutex; +//static DEFINE_MUTEX(rtnl_mutex); + +// end test. --- linux-next-20250908.orig/Documentation/core-api/kernel-api.rst +++ linux-next-20250908/Documentation/core-api/kernel-api.rst @@ -428,3 +428,9 @@ Read-Copy Update (RCU) .. kernel-doc:: include/linux/rcuref.h .. kernel-doc:: include/linux/rcutree.h + +Kernel Globals +========================== + +.. kernel-doc:: init/kdoc-globals-test.c + :identifiers: