lkml.org 
[lkml]   [2023]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC bootconfig] 1/2] fs/proc: Add /proc/cmdline_load for boot loader arguments
On Thu, Jul 27, 2023 at 08:37:00PM -0700, Paul E. McKenney wrote:
> In kernels built with CONFIG_BOOT_CONFIG_FORCE=y, /proc/cmdline will
> show all kernel boot parameters, both those supplied by the boot loader
> and those embedded in the kernel image. This works well for those who
> just want to see all of the kernel boot parameters, but is not helpful to
> those who need to see only those parameters supplied by the boot loader.
> This is especially important when these parameters are presented to the
> boot loader by automation that might gather them from diverse sources.
>
> Therefore, provide a /proc/cmdline_load file that shows only those kernel
> boot parameters supplied by the boot loader.

> +static int cmdline_load_proc_show(struct seq_file *m, void *v)
> +{
> + seq_puts(m, boot_command_line);
> + seq_putc(m, '\n');
> + return 0;
> +}
> +
> static int __init proc_cmdline_init(void)
> {
> struct proc_dir_entry *pde;
> @@ -19,6 +27,11 @@ static int __init proc_cmdline_init(void)
> pde = proc_create_single("cmdline", 0, NULL, cmdline_proc_show);
> pde_make_permanent(pde);
> pde->size = saved_command_line_len + 1;
> + if (IS_ENABLED(CONFIG_BOOT_CONFIG_FORCE)) {
> + pde = proc_create_single("cmdline_load", 0, NULL, cmdline_load_proc_show);
> + pde_make_permanent(pde);
> + pde->size = strnlen(boot_command_line, COMMAND_LINE_SIZE) + 1;
> + }

Please add it as separate fs/proc/cmdline_load.c file so that name of
the file matches name of the /proc file.

The name "cmdline_load" is kind of non-descriptive. Mentioning "bootloader"
somewhere should improve things.

\
 
 \ /
  Last update: 2023-08-04 19:24    [W:0.118 / U:2.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site