Re: [PATCH v4] xen/common: add keyhandler to show Xen command line

Jan Beulich <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On 11.08.2026 23:09, [email protected] wrote:
> @@ -505,6 +506,37 @@ static int __init cf_check param_init(void)
>  __initcall(param_init);
>  #endif
>  
> +static void cf_check show_cmdline(unsigned char key)
> +{
> +    const char *builtin_cmdline = CONFIG_CMDLINE;

Maybe compilers manage to optimize this to the equivalent of

    static const char builtin_cmdline[] = CONFIG_CMDLINE;

yet even then I see no reason why it wouldn't want spelling that way anyway.

Plus this raises the question: Why would we need two instances of the string
in the Xen image? If you need the literal at runtime, re-use
opt_builtin_cmdline[] by dropping __initconst from it.

> +    const char *cmdline;
> +
> +    printk("'%c' pressed -> showing hypervisor command line\n", key);
> +
> +    if ( builtin_cmdline[0] )
> +        cmdline = builtin_cmdline;
> +    else
> +        cmdline = "<NULL>";
> +
> +    printk("Built-in command line: %s\n", cmdline);

What use is this line when <NULL> is shown?

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.