[{"id":2656335,"web_url":"http://patchwork.ozlabs.org/comment/2656335/","msgid":"<CAL_JsqKr3xekKSo3DtQvOOw_VoGC=FUTagZGY5g=CGGGdUZSMQ@mail.gmail.com>","date":"2021-03-26T15:42:35","subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","submitter":{"id":62529,"url":"http://patchwork.ozlabs.org/api/people/62529/","name":"Rob Herring (Arm)","email":"robh@kernel.org"},"content":"On Fri, Mar 26, 2021 at 7:44 AM Christophe Leroy\n<christophe.leroy@csgroup.eu> wrote:\n>\n> This code provides architectures with a way to build command line\n> based on what is built in the kernel and what is handed over by the\n> bootloader, based on selected compile-time options.\n\nNote that I have this patch pending:\n\nhttps://patchwork.ozlabs.org/project/devicetree-bindings/patch/20210316193820.3137-1-alex@ghiti.fr/\n\nIt's going to need to be adapted for this. I've held off applying to\nsee if this gets settled.\n\n>\n> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>\n> ---\n> v3:\n> - Addressed comments from Will\n> - Added capability to have src == dst\n> ---\n>  include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 57 insertions(+)\n>  create mode 100644 include/linux/cmdline.h\n>\n> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h\n> new file mode 100644\n> index 000000000000..dea87edd41be\n> --- /dev/null\n> +++ b/include/linux/cmdline.h\n> @@ -0,0 +1,57 @@\n> +/* SPDX-License-Identifier: GPL-2.0 */\n> +#ifndef _LINUX_CMDLINE_H\n> +#define _LINUX_CMDLINE_H\n> +\n> +#include <linux/string.h>\n> +\n> +/* Allow architectures to override strlcat, powerpc can't use strings so early */\n> +#ifndef cmdline_strlcat\n> +#define cmdline_strlcat strlcat\n> +#endif\n> +\n> +/*\n> + * This function will append or prepend a builtin command line to the command\n> + * line provided by the bootloader. Kconfig options can be used to alter\n> + * the behavior of this builtin command line.\n> + * @dst: The destination of the final appended/prepended string.\n> + * @src: The starting string or NULL if there isn't one.\n> + * @len: the length of dest buffer.\n> + */\n> +static __always_inline void __cmdline_build(char *dst, const char *src, size_t len)\n> +{\n> +       if (!len || src == dst)\n> +               return;\n> +\n> +       if (IS_ENABLED(CONFIG_CMDLINE_FORCE) || !src) {\n> +               dst[0] = 0;\n> +               cmdline_strlcat(dst, CONFIG_CMDLINE, len);\n> +               return;\n> +       }\n> +\n> +       if (dst != src)\n> +               dst[0] = 0;\n> +\n> +       if (IS_ENABLED(CONFIG_CMDLINE_PREPEND))\n> +               cmdline_strlcat(dst, CONFIG_CMDLINE \" \", len);\n> +\n> +       cmdline_strlcat(dst, src, len);\n> +\n> +       if (IS_ENABLED(CONFIG_CMDLINE_EXTEND))\n\nShould be APPEND.\n\n> +               cmdline_strlcat(dst, \" \" CONFIG_CMDLINE, len);\n> +}\n> +\n> +#define cmdline_build(dst, src, len) do {                              \\\n\nPerhaps a comment why we need this to be a define.\n\n> +       char *__c_dst = (dst);                                          \\\n> +       const char *__c_src = (src);                                    \\\n> +                                                                       \\\n> +       if (__c_src == __c_dst) {                                       \\\n> +               static char __c_tmp[COMMAND_LINE_SIZE] __initdata = \"\"; \\\n> +                                                                       \\\n> +               cmdline_strlcat(__c_tmp, __c_src, COMMAND_LINE_SIZE);   \\\n> +               __cmdline_build(__c_dst, __c_tmp, (len));               \\\n> +       } else {                                                        \\\n> +               __cmdline_build(__c_dst, __c_src, (len));               \\\n> +       }                                                               \\\n> +} while (0)\n> +\n> +#endif /* _LINUX_CMDLINE_H */\n> --\n> 2.25.0\n>","headers":{"Return-Path":"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Authentication-Results":["ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org;\n receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=DUfi5ugO;\n\tdkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=DUfi5ugO;\n\tdkim-atps=neutral","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org;\n envelope-from=robh@kernel.org; receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=DUfi5ugO;\n dkim-atps=neutral"],"Received":["from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4F6R8153VJz9sRf\n\tfor <patchwork-incoming@ozlabs.org>; Sat, 27 Mar 2021 02:43:13 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4F6R813rDJz3c3W\n\tfor <patchwork-incoming@ozlabs.org>; Sat, 27 Mar 2021 02:43:13 +1100 (AEDT)","from mail.kernel.org (mail.kernel.org [198.145.29.99])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4F6R7c0NW4z3c0P\n for <linuxppc-dev@lists.ozlabs.org>; Sat, 27 Mar 2021 02:42:51 +1100 (AEDT)","by mail.kernel.org (Postfix) with ESMTPSA id 49AFE61A1E\n for <linuxppc-dev@lists.ozlabs.org>; Fri, 26 Mar 2021 15:42:49 +0000 (UTC)","by mail-ej1-f44.google.com with SMTP id u5so9081285ejn.8\n for <linuxppc-dev@lists.ozlabs.org>; Fri, 26 Mar 2021 08:42:49 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1616773369;\n bh=vsTZ/vYOkJZ+dX5RIeYP0sX4VHZ0dMLJGNZeZ1Bm2LQ=;\n h=References:In-Reply-To:From:Date:Subject:To:Cc:From;\n b=DUfi5ugO3VGJM2909lBb9UInMPNrDa6EKQqVta1cIaa0jmi9PW3AK/KjrURwAztbo\n i8x5fBqV0zqtki7tKp5qsvRSp+6JN+/eJ6Ieou5FWpav1oVdXzMR9PQmnDp1YWOfOs\n rjJ3avEH5azOsGiVuuyxYhIiIBwrj4oZjmpnUvQIneHge5J52ma4iOUznrC66JY4V8\n tPmhAAColcWAlYEXk93IiPpU/VFt/H+KOGM/w6qxjuUILfYJP2A9DdngmKH0rgvYm1\n Dqclqe/hpH6HH+86ckSN06JT8aWetb7V0wJymW/nFAsU2yRrYVduN9qA2/Ow3crzZ9\n +c/utZ5v2WmJQ==","X-Gm-Message-State":"AOAM531DOvhAx3G5qz6oN1YvNL80EBT5gGJzfyDha8MsZ3cO6bWHvycy\n QQbDVc+uN+AzpvX4fWDcuNkmLzLfv8uMtHAhdw==","X-Google-Smtp-Source":"\n ABdhPJw290YYi5Bn9eJbiCdu+yLMROaG22thNNy/WhodM/XBcUW19HUG6/I3aYcxY0qwZKx/hSfuN8oDM18cKkgl6sQ=","X-Received":"by 2002:a17:906:7d48:: with SMTP id\n l8mr15784305ejp.108.1616773367877;\n Fri, 26 Mar 2021 08:42:47 -0700 (PDT)","MIME-Version":"1.0","References":"<cover.1616765869.git.christophe.leroy@csgroup.eu>\n <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu>","In-Reply-To":"\n <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu>","From":"Rob Herring <robh@kernel.org>","Date":"Fri, 26 Mar 2021 09:42:35 -0600","X-Gmail-Original-Message-ID":"\n <CAL_JsqKr3xekKSo3DtQvOOw_VoGC=FUTagZGY5g=CGGGdUZSMQ@mail.gmail.com>","Message-ID":"\n <CAL_JsqKr3xekKSo3DtQvOOw_VoGC=FUTagZGY5g=CGGGdUZSMQ@mail.gmail.com>","Subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","To":"Christophe Leroy <christophe.leroy@csgroup.eu>","Content-Type":"text/plain; charset=\"UTF-8\"","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"\"open list:GENERIC INCLUDE/ASM HEADER FILES\" <linux-arch@vger.kernel.org>,\n devicetree@vger.kernel.org, microblaze <monstr@monstr.eu>,\n Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>,\n linux-xtensa@linux-xtensa.org, SH-Linux <linux-sh@vger.kernel.org>,\n Will Deacon <will@kernel.org>, X86 ML <x86@kernel.org>,\n \"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n nios2 <ley.foon.tan@intel.com>,\n \"open list:MIPS\" <linux-mips@vger.kernel.org>,\n Openrisc <openrisc@lists.librecores.org>, linux-hexagon@vger.kernel.org,\n sparclinux <sparclinux@vger.kernel.org>,\n linux-riscv <linux-riscv@lists.infradead.org>,\n linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,\n linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,\n Daniel Walker <danielwa@cisco.com>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":2656352,"web_url":"http://patchwork.ozlabs.org/comment/2656352/","msgid":"<58834b01-aad5-fa1e-554e-6417b2357202@csgroup.eu>","date":"2021-03-26T15:55:31","subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","submitter":{"id":79086,"url":"http://patchwork.ozlabs.org/api/people/79086/","name":"Christophe Leroy","email":"christophe.leroy@csgroup.eu"},"content":"Le 26/03/2021 à 16:42, Rob Herring a écrit :\n> On Fri, Mar 26, 2021 at 7:44 AM Christophe Leroy\n> <christophe.leroy@csgroup.eu> wrote:\n>>\n>> This code provides architectures with a way to build command line\n>> based on what is built in the kernel and what is handed over by the\n>> bootloader, based on selected compile-time options.\n> \n> Note that I have this patch pending:\n> \n> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20210316193820.3137-1-alex@ghiti.fr/\n> \n> It's going to need to be adapted for this. I've held off applying to\n> see if this gets settled.\n\ngood point.\n\nHope we can't have things like\n\n\toption=\"beautiful weather\"\n\n> \n>>\n>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>\n>> ---\n>> v3:\n>> - Addressed comments from Will\n>> - Added capability to have src == dst\n>> ---\n>>   include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++\n>>   1 file changed, 57 insertions(+)\n>>   create mode 100644 include/linux/cmdline.h\n>>\n>> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h\n>> new file mode 100644\n>> index 000000000000..dea87edd41be\n>> --- /dev/null\n>> +++ b/include/linux/cmdline.h\n>> @@ -0,0 +1,57 @@\n>> +/* SPDX-License-Identifier: GPL-2.0 */\n>> +#ifndef _LINUX_CMDLINE_H\n>> +#define _LINUX_CMDLINE_H\n>> +\n>> +#include <linux/string.h>\n>> +\n>> +/* Allow architectures to override strlcat, powerpc can't use strings so early */\n>> +#ifndef cmdline_strlcat\n>> +#define cmdline_strlcat strlcat\n>> +#endif\n>> +\n>> +/*\n>> + * This function will append or prepend a builtin command line to the command\n>> + * line provided by the bootloader. Kconfig options can be used to alter\n>> + * the behavior of this builtin command line.\n>> + * @dst: The destination of the final appended/prepended string.\n>> + * @src: The starting string or NULL if there isn't one.\n>> + * @len: the length of dest buffer.\n>> + */\n>> +static __always_inline void __cmdline_build(char *dst, const char *src, size_t len)\n>> +{\n>> +       if (!len || src == dst)\n>> +               return;\n>> +\n>> +       if (IS_ENABLED(CONFIG_CMDLINE_FORCE) || !src) {\n>> +               dst[0] = 0;\n>> +               cmdline_strlcat(dst, CONFIG_CMDLINE, len);\n>> +               return;\n>> +       }\n>> +\n>> +       if (dst != src)\n>> +               dst[0] = 0;\n>> +\n>> +       if (IS_ENABLED(CONFIG_CMDLINE_PREPEND))\n>> +               cmdline_strlcat(dst, CONFIG_CMDLINE \" \", len);\n>> +\n>> +       cmdline_strlcat(dst, src, len);\n>> +\n>> +       if (IS_ENABLED(CONFIG_CMDLINE_EXTEND))\n> \n> Should be APPEND.\n\nNot yet. For the time being all architectures use EXTEND only.\n\nIn patch 3 it is changed to:\n\n-\tif (IS_ENABLED(CONFIG_CMDLINE_EXTEND))\n+\tif (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || IS_ENABLED(CONFIG_CMDLINE_APPEND))\n\nThen in last patch, I forgot but I should have done:\n\n-\tif (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || IS_ENABLED(CONFIG_CMDLINE_APPEND))\n+\tif (IS_ENABLED(CONFIG_CMDLINE_APPEND))\n\n\n> \n>> +               cmdline_strlcat(dst, \" \" CONFIG_CMDLINE, len);\n>> +}\n>> +\n>> +#define cmdline_build(dst, src, len) do {                              \\\n> \n> Perhaps a comment why we need this to be a define.\n\nProbably we don't need anymore as I finally decided to use COMMAND_LINE_SIZE instead of 'len' as the \nsize of the temporary buffer.\n\n> \n>> +       char *__c_dst = (dst);                                          \\\n>> +       const char *__c_src = (src);                                    \\\n>> +                                                                       \\\n>> +       if (__c_src == __c_dst) {                                       \\\n>> +               static char __c_tmp[COMMAND_LINE_SIZE] __initdata = \"\"; \\\n>> +                                                                       \\\n>> +               cmdline_strlcat(__c_tmp, __c_src, COMMAND_LINE_SIZE);   \\\n>> +               __cmdline_build(__c_dst, __c_tmp, (len));               \\\n>> +       } else {                                                        \\\n>> +               __cmdline_build(__c_dst, __c_src, (len));               \\\n>> +       }                                                               \\\n>> +} while (0)\n>> +\n>> +#endif /* _LINUX_CMDLINE_H */\n>> --\n>> 2.25.0\n>>\n\nChristophe","headers":{"Return-Path":"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Authentication-Results":["ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org;\n receiver=<UNKNOWN>)","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr;\n envelope-from=christophe.leroy@csgroup.eu; receiver=<UNKNOWN>)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4F6RQc6YHnz9sS8\n\tfor <patchwork-incoming@ozlabs.org>; Sat, 27 Mar 2021 02:55:52 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4F6RQc5XvNz3c4h\n\tfor <patchwork-incoming@ozlabs.org>; Sat, 27 Mar 2021 02:55:52 +1100 (AEDT)","from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4F6RQK3SM9z2xxj\n for <linuxppc-dev@lists.ozlabs.org>; Sat, 27 Mar 2021 02:55:36 +1100 (AEDT)","from localhost (mailhub1-int [192.168.12.234])\n by localhost (Postfix) with ESMTP id 4F6RQB6DtPz9v0Mx;\n Fri, 26 Mar 2021 16:55:30 +0100 (CET)","from pegase1.c-s.fr ([192.168.12.234])\n by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024)\n with ESMTP id fRfLPhr5ARx4; Fri, 26 Mar 2021 16:55:30 +0100 (CET)","from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192])\n by pegase1.c-s.fr (Postfix) with ESMTP id 4F6RQB5JGZz9v0Mw;\n Fri, 26 Mar 2021 16:55:30 +0100 (CET)","from localhost (localhost [127.0.0.1])\n by messagerie.si.c-s.fr (Postfix) with ESMTP id 354458B8CF;\n Fri, 26 Mar 2021 16:55:32 +0100 (CET)","from messagerie.si.c-s.fr ([127.0.0.1])\n by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023)\n with ESMTP id o-ftwDSIO1we; Fri, 26 Mar 2021 16:55:32 +0100 (CET)","from [192.168.4.90] (unknown [192.168.4.90])\n by messagerie.si.c-s.fr (Postfix) with ESMTP id 249F98B8C7;\n Fri, 26 Mar 2021 16:55:31 +0100 (CET)"],"X-Virus-Scanned":["Debian amavisd-new at c-s.fr","amavisd-new at c-s.fr"],"Subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","To":"Rob Herring <robh@kernel.org>","References":"<cover.1616765869.git.christophe.leroy@csgroup.eu>\n <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu>\n <CAL_JsqKr3xekKSo3DtQvOOw_VoGC=FUTagZGY5g=CGGGdUZSMQ@mail.gmail.com>","From":"Christophe Leroy <christophe.leroy@csgroup.eu>","Message-ID":"<58834b01-aad5-fa1e-554e-6417b2357202@csgroup.eu>","Date":"Fri, 26 Mar 2021 16:55:31 +0100","User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101\n Thunderbird/78.9.0","MIME-Version":"1.0","In-Reply-To":"\n <CAL_JsqKr3xekKSo3DtQvOOw_VoGC=FUTagZGY5g=CGGGdUZSMQ@mail.gmail.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"fr","Content-Transfer-Encoding":"8bit","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"\"open list:GENERIC INCLUDE/ASM HEADER FILES\" <linux-arch@vger.kernel.org>,\n devicetree@vger.kernel.org, microblaze <monstr@monstr.eu>,\n Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>,\n linux-xtensa@linux-xtensa.org, SH-Linux <linux-sh@vger.kernel.org>,\n Will Deacon <will@kernel.org>, X86 ML <x86@kernel.org>,\n \"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n nios2 <ley.foon.tan@intel.com>,\n \"open list:MIPS\" <linux-mips@vger.kernel.org>,\n Openrisc <openrisc@lists.librecores.org>, linux-hexagon@vger.kernel.org,\n sparclinux <sparclinux@vger.kernel.org>,\n linux-riscv <linux-riscv@lists.infradead.org>,\n linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,\n linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,\n Daniel Walker <danielwa@cisco.com>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":2658392,"web_url":"http://patchwork.ozlabs.org/comment/2658392/","msgid":"<20210330172714.GR109100@zorba>","date":"2021-03-30T17:27:14","subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","submitter":{"id":67374,"url":"http://patchwork.ozlabs.org/api/people/67374/","name":"Daniel Walker (danielwa)","email":"danielwa@cisco.com"},"content":"On Fri, Mar 26, 2021 at 01:44:48PM +0000, Christophe Leroy wrote:\n> This code provides architectures with a way to build command line\n> based on what is built in the kernel and what is handed over by the\n> bootloader, based on selected compile-time options.\n> \n> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>\n> ---\n> v3:\n> - Addressed comments from Will\n> - Added capability to have src == dst\n> ---\n>  include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 57 insertions(+)\n>  create mode 100644 include/linux/cmdline.h\n> \n> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h\n> new file mode 100644\n> index 000000000000..dea87edd41be\n> --- /dev/null\n> +++ b/include/linux/cmdline.h\n> @@ -0,0 +1,57 @@\n> +/* SPDX-License-Identifier: GPL-2.0 */\n> +#ifndef _LINUX_CMDLINE_H\n> +#define _LINUX_CMDLINE_H\n> +\n> +#include <linux/string.h>\n> +\n> +/* Allow architectures to override strlcat, powerpc can't use strings so early */\n> +#ifndef cmdline_strlcat\n> +#define cmdline_strlcat strlcat\n> +#endif\n> +\n> +/*\n> + * This function will append or prepend a builtin command line to the command\n> + * line provided by the bootloader. Kconfig options can be used to alter\n> + * the behavior of this builtin command line.\n> + * @dst: The destination of the final appended/prepended string.\n> + * @src: The starting string or NULL if there isn't one.\n> + * @len: the length of dest buffer.\n> + */\n\nAppend or prepend ? Cisco requires both at the same time. This is why my\nimplementation provides both. I can't use this with both at once.\n\nDaniel","headers":{"Return-Path":"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Authentication-Results":["ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org;\n receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=II5NU/e0;\n\tdkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=II5NU/e0;\n\tdkim-atps=neutral","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=cisco.com (client-ip=173.37.86.77; helo=rcdn-iport-6.cisco.com;\n envelope-from=danielwa@cisco.com; receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=II5NU/e0; dkim-atps=neutral"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4F8xGp5cg8z9sWb\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 31 Mar 2021 04:27:46 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4F8xGp4jpBz3byj\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 31 Mar 2021 04:27:46 +1100 (AEDT)","from rcdn-iport-6.cisco.com (rcdn-iport-6.cisco.com [173.37.86.77])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n bits)) (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4F8xGN4bYxz3bcq\n for <linuxppc-dev@lists.ozlabs.org>; Wed, 31 Mar 2021 04:27:23 +1100 (AEDT)","from alln-core-11.cisco.com ([173.36.13.133])\n by rcdn-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA;\n 30 Mar 2021 17:27:19 +0000","from zorba ([10.24.8.123])\n by alln-core-11.cisco.com (8.15.2/8.15.2) with ESMTPS id 12UHREPN013894\n (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);\n Tue, 30 Mar 2021 17:27:16 GMT"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=cisco.com; i=@cisco.com; l=1640; q=dns/txt; s=iport;\n t=1617125245; x=1618334845;\n h=date:from:to:cc:subject:message-id:references:\n mime-version:in-reply-to;\n bh=DLlq6Eg2HUUvE9Fdg0Ebob6Tw5pX5R4uRXQoNV4sDwc=;\n b=II5NU/e0omr/fcsPCXcBYrO3Foi1Ywy5VY9dCEAGHfqavRMhFuXE2rkh\n mWTvCx+ny3zuihpnczcoN8hmD24SfD9GDXSupCirwN45nRVxVP+Q+XKn7\n QDB0uJkyOfw6MBfmWbZ+TiZzis+VO1r8FOHMh8/P59dU/VYByduXcYzA4 g=;","IronPort-HdrOrdr":"\n A9a23:oTmckqE8NgKcaaN3pLqEVceALOonbusQ8zAX/mp6ICY7TuWzkceykPMHkTL1ki8WQnE8mdaGUZPwJE/035hz/IUXIPOeTBDr0VHYTr1KwIP+z1TbcRHW2fVa0c5bHpRWKNq1NlRiiNa/3Q/QKadF/PCi0ISFwdjT1G1sSwYCUdAC0y5cBhyAGkN7AClqbKBZKLOm6sBKpyWtdB0sB6zROlA/U+fOvNHNnp79CCRnOzcc9AKMgTm0gYSVLzGk2H4lPw9n8PMF7XXPlRD/6+GFtfy2oyWssVP73tBxhMbrzMdFCYi3rvUtbh/oigquee1aKtq/gAw=","X-IronPort-Anti-Spam-Filtered":"true","X-IronPort-Anti-Spam-Result":"\n A0BhAABKXmNg/4UNJK1aHAEBAQEBAQcBARIBAQQEAQFAgTwHAQELAYIqgUwBOTGMZYkukAgWikWBfAsBAQENAQE0BAEBhFACgXoCJTQJDgIDAQEMAQEFAQEBAgEGBHGFboZFAQU6PxALGC48GwYThXirInWBNIkLgUQigRcBjUkmHIFJQoESgm4uPoo2BIJHgQ6CMCyeTZwigxGBI5s2MRCkQrgSAgQGBQIWgVQ6gVkzGggbFYMkUBkNnQchAy84AgYKAQEDCYkfAQE","X-IronPort-AV":"E=Sophos;i=\"5.81,291,1610409600\"; d=\"scan'208\";a=\"880406225\"","Date":"Tue, 30 Mar 2021 10:27:14 -0700","From":"Daniel Walker <danielwa@cisco.com>","To":"Christophe Leroy <christophe.leroy@csgroup.eu>","Subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","Message-ID":"<20210330172714.GR109100@zorba>","References":"<cover.1616765869.git.christophe.leroy@csgroup.eu>\n <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"\n <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu>","X-Outbound-SMTP-Client":"10.24.8.123, [10.24.8.123]","X-Outbound-Node":"alln-core-11.cisco.com","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linux-arch@vger.kernel.org, robh@kernel.org,\n microblaze <monstr@monstr.eu>,\n daniel@gimpelevich.san-francisco.ca.us, devicetree@vger.kernel.org,\n linux-sh@vger.kernel.org, will@kernel.org, linux-xtensa@linux-xtensa.org,\n x86@kernel.org, linux-kernel@vger.kernel.org, nios2 <ley.foon.tan@intel.com>,\n linux-mips@vger.kernel.org, openrisc@lists.librecores.org,\n linux-hexagon@vger.kernel.org, sparclinux@vger.kernel.org,\n linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,\n linux-arm-kernel@lists.infradead.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":2658422,"web_url":"http://patchwork.ozlabs.org/comment/2658422/","msgid":"<D8C1FBF6-E5C0-4233-BCB8-694274EA28F9@goldelico.com>","date":"2021-03-30T18:07:30","subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","submitter":{"id":42442,"url":"http://patchwork.ozlabs.org/api/people/42442/","name":"H. Nikolaus Schaller","email":"hns@goldelico.com"},"content":"> Am 30.03.2021 um 19:27 schrieb Daniel Walker <danielwa@cisco.com>:\n> \n> On Fri, Mar 26, 2021 at 01:44:48PM +0000, Christophe Leroy wrote:\n>> This code provides architectures with a way to build command line\n>> based on what is built in the kernel and what is handed over by the\n>> bootloader, based on selected compile-time options.\n>> \n>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>\n>> ---\n>> v3:\n>> - Addressed comments from Will\n>> - Added capability to have src == dst\n>> ---\n>> include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++\n>> 1 file changed, 57 insertions(+)\n>> create mode 100644 include/linux/cmdline.h\n>> \n>> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h\n>> new file mode 100644\n>> index 000000000000..dea87edd41be\n>> --- /dev/null\n>> +++ b/include/linux/cmdline.h\n>> @@ -0,0 +1,57 @@\n>> +/* SPDX-License-Identifier: GPL-2.0 */\n>> +#ifndef _LINUX_CMDLINE_H\n>> +#define _LINUX_CMDLINE_H\n>> +\n>> +#include <linux/string.h>\n>> +\n>> +/* Allow architectures to override strlcat, powerpc can't use strings so early */\n>> +#ifndef cmdline_strlcat\n>> +#define cmdline_strlcat strlcat\n>> +#endif\n>> +\n>> +/*\n>> + * This function will append or prepend a builtin command line to the command\n>> + * line provided by the bootloader. Kconfig options can be used to alter\n>> + * the behavior of this builtin command line.\n>> + * @dst: The destination of the final appended/prepended string.\n>> + * @src: The starting string or NULL if there isn't one.\n>> + * @len: the length of dest buffer.\n>> + */\n> \n> Append or prepend ? Cisco requires both at the same time. This is why my\n> implementation provides both. I can't use this with both at once.\n\nJust an idea: what about defining CMDLINE as a pattern where e.g. \"$$\" or \"%%\"\nis replaced by the boot loader command line?\n\nThen you can formulate replace, prepend, append, prepend+append with a single\nCONFIG setting.\n\nIt may be a little more complex in code (scanning for the pattern and replacing\nit and take care to temporary memory) but IMHO it could be worth to consider.\n\nBR,\nNikolaus Schaller","headers":{"Return-Path":"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Authentication-Results":["ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org;\n receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=goldelico.com header.i=@goldelico.com\n header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=mbDZevjF;\n\tdkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=goldelico.com header.i=@goldelico.com\n header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=mbDZevjF;\n\tdkim-atps=neutral","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.helo=mo4-p02-ob.smtp.rzone.de (client-ip=81.169.146.168;\n helo=mo4-p02-ob.smtp.rzone.de; envelope-from=hns@goldelico.com;\n receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (2048-bit key;\n unprotected) header.d=goldelico.com header.i=@goldelico.com\n header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=mbDZevjF;\n dkim-atps=neutral","strato.com;\n    dkim=none"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4F8yDc5tj7z9sVm\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 31 Mar 2021 05:10:56 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4F8yDc4csLz3c7K\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 31 Mar 2021 05:10:56 +1100 (AEDT)","from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de\n [81.169.146.168])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4F8yDC2cXyz2yyt\n for <linuxppc-dev@lists.ozlabs.org>; Wed, 31 Mar 2021 05:10:34 +1100 (AEDT)","from [192.168.178.35] by smtp.strato.de (RZmta 47.23.1 DYNA|AUTH)\n with ESMTPSA id h03350x2UI7VJS3\n (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with\n 256\n ECDH bits, eq. 3072 bits RSA))\n (Client did not present a certificate);\n Tue, 30 Mar 2021 20:07:31 +0200 (CEST)"],"X-Greylist":"delayed 147 seconds by postgrey-1.36 at boromir;\n Wed, 31 Mar 2021 05:10:35 AEDT","ARC-Seal":"i=1; a=rsa-sha256; t=1617127652; cv=none;\n d=strato.com; s=strato-dkim-0002;\n b=Eyq7UqYoQqaEh0TMUnq5UzdsBNGHStBafdmSxV9W2kisa22bG7lmyAywbGT1XJNba7\n eioohjWH90m+ApCCaLfIJxxrR0fQOvTVZ+fpgqmhqIMk/mcG5vvv755Km5wHzjfz85eD\n AIodf4KHXJpzky4K9Aqs3tShThestACt/nWf04t592qQQCRQl6j3BZfA4sQbOP2xon7H\n CO2OSrUFpfKhmJRWkNPpKptwmAM6sMygUV0eEVrdYDzhUtLa+wHtAn+mOZEsc3EVuVuK\n I1WEqmTMsSz6bLFh8xF0oI/lJJm26GPzvsu8uvlw+eAR9YXciV1S+X5IXCmUg1qJUIug\n fnig==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; t=1617127652;\n s=strato-dkim-0002; d=strato.com;\n h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject:Cc:Date:\n From:Subject:Sender;\n bh=TBtxdLUkTjgMvDEB4mRh0JBbXrVFmzYUj0lLVMFFsdA=;\n b=iDxuBxBtN4zGXwH2FsNDucbzs44++UuByW9OubNfPa+SgIUVYehN+9wajhoPfWf8ne\n AJBeDpLzfO9gvPi1AhT0jxBhUc3mkrU3McdEHDV+b0zDo5wFvykL3ipqabsAzZU6O7uz\n is7TqCigWd9ZbgrEsfGbT107MDunzyDPutsq+PzsCSPNZocW9LxvOzLbkyCPLhoBlc7/\n oipum/qvWNjCcVAwprWos80uz+EPG1wDUnbl2HlPeD0LPZubEv85OlwKgkt04b/wC3ze\n Q/YiSR5IF99tHUC2aAp+hTj0JNzGcOYR8WbAB/c0XCz3bibgnOfYzQ2C5UX/ZGASRCMW\n /9Eg==","ARC-Authentication-Results":"i=1; strato.com;\n    dkim=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; t=1617127652;\n s=strato-dkim-0002; d=goldelico.com;\n h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject:Cc:Date:\n From:Subject:Sender;\n bh=TBtxdLUkTjgMvDEB4mRh0JBbXrVFmzYUj0lLVMFFsdA=;\n b=mbDZevjFp2b5R5VUle8FDC8MwkfYJzBYGCwkaBTe2ybLg6GWxZEJsH5woKenUz96DZ\n HLCOwfabBd5h1GPxw3d1/qdKw063SU3JfrMvJjSZc4etXqVgZ2OuBchcRp0XGZjLqw0Q\n XI9sVLA8HjveKwrt594YK3I6FiUVUxeNeTlYhNwAe6WYcF1jzcOR6pVtqoJP9uP/xZ/D\n Syv6uzaw6Ma5RlMrYSJzO01MZ2ln4j1+WzqLWaT+SnK0MZvUpV72FVIyBP3MJRqqvVES\n dGUeryXh/+ZW1PiQ4IEXCAuRPM4Xx3PnN8Xk5C5+DltqN18M43BTURpT9dF2flHnmD8l\n liYA==","X-RZG-AUTH":"\n \":JGIXVUS7cutRB/49FwqZ7WcJeFKiMgPgp8VKxflSZ1P34KBj4Qpw9iZeHmAjw47t884=\"","X-RZG-CLASS-ID":"mo00","Subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","Mime-Version":"1.0 (Mac OS X Mail 9.3 \\(3124\\))","Content-Type":"text/plain; charset=us-ascii","From":"\"H. Nikolaus Schaller\" <hns@goldelico.com>","In-Reply-To":"<20210330172714.GR109100@zorba>","Date":"Tue, 30 Mar 2021 20:07:30 +0200","Content-Transfer-Encoding":"quoted-printable","Message-Id":"<D8C1FBF6-E5C0-4233-BCB8-694274EA28F9@goldelico.com>","References":"<cover.1616765869.git.christophe.leroy@csgroup.eu>\n <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu>\n <20210330172714.GR109100@zorba>","To":"Daniel Walker <danielwa@cisco.com>,\n Christophe Leroy <christophe.leroy@csgroup.eu>","X-Mailer":"Apple Mail (2.3124)","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linux-arch@vger.kernel.org, Rob Herring <robh@kernel.org>,\n microblaze <monstr@monstr.eu>, daniel@gimpelevich.san-francisco.ca.us,\n devicetree <devicetree@vger.kernel.org>, linux-sh@vger.kernel.org,\n will@kernel.org, linux-xtensa@linux-xtensa.org, x86@kernel.org,\n Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n nios2 <ley.foon.tan@intel.com>, linux-mips <linux-mips@vger.kernel.org>,\n openrisc@lists.librecores.org, linux-hexagon@vger.kernel.org,\n sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org,\n linuxppc-dev@lists.ozlabs.org,\n linux-arm-kernel <linux-arm-kernel@lists.infradead.org>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":2658434,"web_url":"http://patchwork.ozlabs.org/comment/2658434/","msgid":"<20210330182339.GU109100@zorba>","date":"2021-03-30T18:23:39","subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","submitter":{"id":67374,"url":"http://patchwork.ozlabs.org/api/people/67374/","name":"Daniel Walker (danielwa)","email":"danielwa@cisco.com"},"content":"On Tue, Mar 30, 2021 at 08:07:30PM +0200, H. Nikolaus Schaller wrote:\n> \n> > Am 30.03.2021 um 19:27 schrieb Daniel Walker <danielwa@cisco.com>:\n> > \n> > On Fri, Mar 26, 2021 at 01:44:48PM +0000, Christophe Leroy wrote:\n> >> This code provides architectures with a way to build command line\n> >> based on what is built in the kernel and what is handed over by the\n> >> bootloader, based on selected compile-time options.\n> >> \n> >> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>\n> >> ---\n> >> v3:\n> >> - Addressed comments from Will\n> >> - Added capability to have src == dst\n> >> ---\n> >> include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++\n> >> 1 file changed, 57 insertions(+)\n> >> create mode 100644 include/linux/cmdline.h\n> >> \n> >> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h\n> >> new file mode 100644\n> >> index 000000000000..dea87edd41be\n> >> --- /dev/null\n> >> +++ b/include/linux/cmdline.h\n> >> @@ -0,0 +1,57 @@\n> >> +/* SPDX-License-Identifier: GPL-2.0 */\n> >> +#ifndef _LINUX_CMDLINE_H\n> >> +#define _LINUX_CMDLINE_H\n> >> +\n> >> +#include <linux/string.h>\n> >> +\n> >> +/* Allow architectures to override strlcat, powerpc can't use strings so early */\n> >> +#ifndef cmdline_strlcat\n> >> +#define cmdline_strlcat strlcat\n> >> +#endif\n> >> +\n> >> +/*\n> >> + * This function will append or prepend a builtin command line to the command\n> >> + * line provided by the bootloader. Kconfig options can be used to alter\n> >> + * the behavior of this builtin command line.\n> >> + * @dst: The destination of the final appended/prepended string.\n> >> + * @src: The starting string or NULL if there isn't one.\n> >> + * @len: the length of dest buffer.\n> >> + */\n> > \n> > Append or prepend ? Cisco requires both at the same time. This is why my\n> > implementation provides both. I can't use this with both at once.\n> \n> Just an idea: what about defining CMDLINE as a pattern where e.g. \"$$\" or \"%%\"\n> is replaced by the boot loader command line?\n> \n> Then you can formulate replace, prepend, append, prepend+append with a single\n> CONFIG setting.\n> \n> It may be a little more complex in code (scanning for the pattern and replacing\n> it and take care to temporary memory) but IMHO it could be worth to consider.\n\nIn some cases this code could be used extremely early in boot up. For example in the\nprom_init.c powerpc code, or in efi changes. The flexibility to find and replace\nlike that is not always an option due to the nature of the environment. It's not\nimpossible of course.\n\nDaniel","headers":{"Return-Path":"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Authentication-Results":["ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org;\n receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=cjOi9tmU;\n\tdkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=cjOi9tmU;\n\tdkim-atps=neutral","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=cisco.com (client-ip=173.37.142.92;\n helo=alln-iport-5.cisco.com;\n envelope-from=danielwa@cisco.com; receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=cjOi9tmU; dkim-atps=neutral"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4F8yWt6Jrxz9sRf\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 31 Mar 2021 05:24:10 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4F8yWt51Csz3c5D\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 31 Mar 2021 05:24:10 +1100 (AEDT)","from alln-iport-5.cisco.com (alln-iport-5.cisco.com [173.37.142.92])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n bits)) (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4F8yWT2FMHz3br4\n for <linuxppc-dev@lists.ozlabs.org>; Wed, 31 Mar 2021 05:23:46 +1100 (AEDT)","from rcdn-core-2.cisco.com ([173.37.93.153])\n by alln-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA;\n 30 Mar 2021 18:23:43 +0000","from zorba ([10.24.8.123])\n by rcdn-core-2.cisco.com (8.15.2/8.15.2) with ESMTPS id 12UINdP0017615\n (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);\n Tue, 30 Mar 2021 18:23:41 GMT"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=cisco.com; i=@cisco.com; l=2604; q=dns/txt; s=iport;\n t=1617128629; x=1618338229;\n h=date:from:to:cc:subject:message-id:references:\n mime-version:in-reply-to;\n bh=xMStwoujyvRVt+OuzbkoYXvA32+qhvWOh/uecqwPFaM=;\n b=cjOi9tmUjIPuykkAOS2iZpDynzGKpVG8Pj9NiY0OE+OliKBDfUIZF9O4\n zQNvxSIRJqusrFzTpPF6cgzLH2AluMlAUVEzWYCQsjGwHLmK1ZM/sQEKY\n D+IFsckQiUl7ZmdBhxOkxgUUUiJ0y8NiBmEhK/gysVAlKqj1ecg0PkeIi w=;","X-IPAS-Result":"\n A0ADAAC0a2NgmJldJa1aGgEBAQEBAQEBAQEDAQEBARIBAQEBAgIBAQEBQIE8BQEBAQELAYN2ATkxjGWJLpAIFopFgXwLAQEBDQEBNAQBAYRQAoF6AiU0CQ4CAwEBAQMCAwEBAQEBBQEBAQIBBgQUAQEBAQEBAQGGQ4ZFAQIDOj8QCxguPBsGE4JwgwirOXWBNIkLgUQigRcBjUkmHIFJQoESgm4uPoo2BIJHgQ6CMCyUAYpMmw6BFIMRgSObNjEQpEK4EgIEBgUCFoFUOIFbMxoIGxWDJFAZDY44jk8hAy84AgYKAQEDCYZaLIIZAQE","IronPort-HdrOrdr":"A9a23:OGIYBqgWvJdablCjWRAu+Iu5lnBQXmcji2hD6mlwRA09T+Wzna\n mV88gz/xnylToXRTUMmcqYPrOBXHPb8vdOkOwsFJ2lWxTrv3btEZF64eLZsl/dMgD36+I178\n 1dWodkDtmYNzVHpOb8pDK1CtMxhOSAmZrY4dv261dIYUVUZ7p77wF/YzzrcXFeYAVdH5I2GN\n 69y6N8xgaIQngcYsSlCnRtZYGqzOHjr57obQULABQq8mC17Q+A0qLwEBSTw34lPQ9n/LFKyw\n T4uj28wLm/uPemzRKZ8Gnf4/1t6b3c4+oGItCQgc4ILTipsCKUXcBKXr2Puy1dmpDJ1GoX","X-IronPort-Anti-Spam-Filtered":"true","X-IronPort-AV":"E=Sophos;i=\"5.81,291,1610409600\"; d=\"scan'208\";a=\"689174954\"","Date":"Tue, 30 Mar 2021 11:23:39 -0700","From":"Daniel Walker <danielwa@cisco.com>","To":"\"H. Nikolaus Schaller\" <hns@goldelico.com>","Subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","Message-ID":"<20210330182339.GU109100@zorba>","References":"<cover.1616765869.git.christophe.leroy@csgroup.eu>\n <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu>\n <20210330172714.GR109100@zorba>\n <D8C1FBF6-E5C0-4233-BCB8-694274EA28F9@goldelico.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<D8C1FBF6-E5C0-4233-BCB8-694274EA28F9@goldelico.com>","X-Outbound-SMTP-Client":"10.24.8.123, [10.24.8.123]","X-Outbound-Node":"rcdn-core-2.cisco.com","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linux-arch@vger.kernel.org, Rob Herring <robh@kernel.org>,\n microblaze <monstr@monstr.eu>, daniel@gimpelevich.san-francisco.ca.us,\n devicetree <devicetree@vger.kernel.org>, linux-sh@vger.kernel.org,\n linuxppc-dev@lists.ozlabs.org, linux-xtensa@linux-xtensa.org, x86@kernel.org,\n Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n linux-mips <linux-mips@vger.kernel.org>, openrisc@lists.librecores.org,\n nios2 <ley.foon.tan@intel.com>, linux-hexagon@vger.kernel.org,\n sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, will@kernel.org,\n linux-arm-kernel <linux-arm-kernel@lists.infradead.org>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":2660451,"web_url":"http://patchwork.ozlabs.org/comment/2660451/","msgid":"<53aa0b8c-4ee3-a6af-6fb8-2edc5cd79ea5@csgroup.eu>","date":"2021-04-02T15:23:32","subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","submitter":{"id":79086,"url":"http://patchwork.ozlabs.org/api/people/79086/","name":"Christophe Leroy","email":"christophe.leroy@csgroup.eu"},"content":"Le 26/03/2021 à 16:42, Rob Herring a écrit :\n> On Fri, Mar 26, 2021 at 7:44 AM Christophe Leroy\n> <christophe.leroy@csgroup.eu> wrote:\n>>\n>> This code provides architectures with a way to build command line\n>> based on what is built in the kernel and what is handed over by the\n>> bootloader, based on selected compile-time options.\n> \n> Note that I have this patch pending:\n> \n> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20210316193820.3137-1-alex@ghiti.fr/\n> \n> It's going to need to be adapted for this. I've held off applying to\n> see if this gets settled.\n\nWhen reworking EFI, I found out that they are a similar handling, which in addition takes care of \nspace inside quotes.\n\nI added something similar now in cmdline_build() function.\n\n\n> \n>>\n>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>\n>> ---\n>> v3:\n>> - Addressed comments from Will\n>> - Added capability to have src == dst\n>> ---\n>>   include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++\n>>   1 file changed, 57 insertions(+)\n>>   create mode 100644 include/linux/cmdline.h\n>>\n>> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h\n>> new file mode 100644\n>> index 000000000000..dea87edd41be\n>> --- /dev/null\n>> +++ b/include/linux/cmdline.h\n>> @@ -0,0 +1,57 @@\n>> +/* SPDX-License-Identifier: GPL-2.0 */\n>> +#ifndef _LINUX_CMDLINE_H\n>> +#define _LINUX_CMDLINE_H\n>> +\n>> +#include <linux/string.h>\n>> +\n>> +/* Allow architectures to override strlcat, powerpc can't use strings so early */\n>> +#ifndef cmdline_strlcat\n>> +#define cmdline_strlcat strlcat\n>> +#endif\n>> +\n>> +/*\n>> + * This function will append or prepend a builtin command line to the command\n>> + * line provided by the bootloader. Kconfig options can be used to alter\n>> + * the behavior of this builtin command line.\n>> + * @dst: The destination of the final appended/prepended string.\n>> + * @src: The starting string or NULL if there isn't one.\n>> + * @len: the length of dest buffer.\n>> + */\n>> +static __always_inline void __cmdline_build(char *dst, const char *src, size_t len)\n>> +{\n>> +       if (!len || src == dst)\n>> +               return;\n>> +\n>> +       if (IS_ENABLED(CONFIG_CMDLINE_FORCE) || !src) {\n>> +               dst[0] = 0;\n>> +               cmdline_strlcat(dst, CONFIG_CMDLINE, len);\n>> +               return;\n>> +       }\n>> +\n>> +       if (dst != src)\n>> +               dst[0] = 0;\n>> +\n>> +       if (IS_ENABLED(CONFIG_CMDLINE_PREPEND))\n>> +               cmdline_strlcat(dst, CONFIG_CMDLINE \" \", len);\n>> +\n>> +       cmdline_strlcat(dst, src, len);\n>> +\n>> +       if (IS_ENABLED(CONFIG_CMDLINE_EXTEND))\n> \n> Should be APPEND.\n> \n>> +               cmdline_strlcat(dst, \" \" CONFIG_CMDLINE, len);\n>> +}\n>> +\n>> +#define cmdline_build(dst, src, len) do {                              \\\n> \n> Perhaps a comment why we need this to be a define.\n> \n>> +       char *__c_dst = (dst);                                          \\\n>> +       const char *__c_src = (src);                                    \\\n>> +                                                                       \\\n>> +       if (__c_src == __c_dst) {                                       \\\n>> +               static char __c_tmp[COMMAND_LINE_SIZE] __initdata = \"\"; \\\n>> +                                                                       \\\n>> +               cmdline_strlcat(__c_tmp, __c_src, COMMAND_LINE_SIZE);   \\\n>> +               __cmdline_build(__c_dst, __c_tmp, (len));               \\\n>> +       } else {                                                        \\\n>> +               __cmdline_build(__c_dst, __c_src, (len));               \\\n>> +       }                                                               \\\n>> +} while (0)\n>> +\n>> +#endif /* _LINUX_CMDLINE_H */\n>> --\n>> 2.25.0\n>>","headers":{"Return-Path":"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Authentication-Results":["ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org;\n receiver=<UNKNOWN>)","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr;\n envelope-from=christophe.leroy@csgroup.eu; receiver=<UNKNOWN>)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4FBkS20tP6z9sRf\n\tfor <patchwork-incoming@ozlabs.org>; Sat,  3 Apr 2021 02:26:58 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4FBkS16t7xz3g8s\n\tfor <patchwork-incoming@ozlabs.org>; Sat,  3 Apr 2021 02:26:57 +1100 (AEDT)","from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4FBkN74pn7z3fLx\n for <linuxppc-dev@lists.ozlabs.org>; Sat,  3 Apr 2021 02:23:35 +1100 (AEDT)","from localhost (mailhub1-int [192.168.12.234])\n by localhost (Postfix) with ESMTP id 4FBkN2601bz9v2lr;\n Fri,  2 Apr 2021 17:23:30 +0200 (CEST)","from pegase1.c-s.fr ([192.168.12.234])\n by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024)\n with ESMTP id omz2sWo61eF3; Fri,  2 Apr 2021 17:23:30 +0200 (CEST)","from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192])\n by pegase1.c-s.fr (Postfix) with ESMTP id 4FBkN25477z9v2lh;\n Fri,  2 Apr 2021 17:23:30 +0200 (CEST)","from localhost (localhost [127.0.0.1])\n by messagerie.si.c-s.fr (Postfix) with ESMTP id A7DF98BB7C;\n Fri,  2 Apr 2021 17:23:32 +0200 (CEST)","from messagerie.si.c-s.fr ([127.0.0.1])\n by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023)\n with ESMTP id uhizq2EL8v5n; Fri,  2 Apr 2021 17:23:32 +0200 (CEST)","from [192.168.4.90] (unknown [192.168.4.90])\n by messagerie.si.c-s.fr (Postfix) with ESMTP id 9D75E8BB6F;\n Fri,  2 Apr 2021 17:23:31 +0200 (CEST)"],"X-Virus-Scanned":["Debian amavisd-new at c-s.fr","amavisd-new at c-s.fr"],"Subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","To":"Rob Herring <robh@kernel.org>","References":"<cover.1616765869.git.christophe.leroy@csgroup.eu>\n <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu>\n <CAL_JsqKr3xekKSo3DtQvOOw_VoGC=FUTagZGY5g=CGGGdUZSMQ@mail.gmail.com>","From":"Christophe Leroy <christophe.leroy@csgroup.eu>","Message-ID":"<53aa0b8c-4ee3-a6af-6fb8-2edc5cd79ea5@csgroup.eu>","Date":"Fri, 2 Apr 2021 17:23:32 +0200","User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101\n Thunderbird/78.9.0","MIME-Version":"1.0","In-Reply-To":"\n <CAL_JsqKr3xekKSo3DtQvOOw_VoGC=FUTagZGY5g=CGGGdUZSMQ@mail.gmail.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"fr","Content-Transfer-Encoding":"8bit","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"\"open list:GENERIC INCLUDE/ASM HEADER FILES\" <linux-arch@vger.kernel.org>,\n devicetree@vger.kernel.org, microblaze <monstr@monstr.eu>,\n Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>,\n linux-xtensa@linux-xtensa.org, SH-Linux <linux-sh@vger.kernel.org>,\n Will Deacon <will@kernel.org>, X86 ML <x86@kernel.org>,\n \"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n nios2 <ley.foon.tan@intel.com>,\n \"open list:MIPS\" <linux-mips@vger.kernel.org>,\n Openrisc <openrisc@lists.librecores.org>, linux-hexagon@vger.kernel.org,\n sparclinux <sparclinux@vger.kernel.org>,\n linux-riscv <linux-riscv@lists.infradead.org>,\n linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,\n linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,\n Daniel Walker <danielwa@cisco.com>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":2660461,"web_url":"http://patchwork.ozlabs.org/comment/2660461/","msgid":"<9c74d82f-f58f-1ccb-bf22-8eb02a4cd55d@csgroup.eu>","date":"2021-04-02T15:33:06","subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","submitter":{"id":79086,"url":"http://patchwork.ozlabs.org/api/people/79086/","name":"Christophe Leroy","email":"christophe.leroy@csgroup.eu"},"content":"Le 30/03/2021 à 19:27, Daniel Walker a écrit :\n> On Fri, Mar 26, 2021 at 01:44:48PM +0000, Christophe Leroy wrote:\n>> This code provides architectures with a way to build command line\n>> based on what is built in the kernel and what is handed over by the\n>> bootloader, based on selected compile-time options.\n>>\n>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>\n>> ---\n>> v3:\n>> - Addressed comments from Will\n>> - Added capability to have src == dst\n>> ---\n>>   include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++\n>>   1 file changed, 57 insertions(+)\n>>   create mode 100644 include/linux/cmdline.h\n>>\n>> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h\n>> new file mode 100644\n>> index 000000000000..dea87edd41be\n>> --- /dev/null\n>> +++ b/include/linux/cmdline.h\n>> @@ -0,0 +1,57 @@\n>> +/* SPDX-License-Identifier: GPL-2.0 */\n>> +#ifndef _LINUX_CMDLINE_H\n>> +#define _LINUX_CMDLINE_H\n>> +\n>> +#include <linux/string.h>\n>> +\n>> +/* Allow architectures to override strlcat, powerpc can't use strings so early */\n>> +#ifndef cmdline_strlcat\n>> +#define cmdline_strlcat strlcat\n>> +#endif\n>> +\n>> +/*\n>> + * This function will append or prepend a builtin command line to the command\n>> + * line provided by the bootloader. Kconfig options can be used to alter\n>> + * the behavior of this builtin command line.\n>> + * @dst: The destination of the final appended/prepended string.\n>> + * @src: The starting string or NULL if there isn't one.\n>> + * @len: the length of dest buffer.\n>> + */\n> \n> Append or prepend ? Cisco requires both at the same time. This is why my\n> implementation provides both. I can't use this with both at once.\n> \n\nI think it can be added as a second step if dimmed necessary. The feeling I have from all the \ndiscussion is that it's not what people from the community are looking for at the moment.\n\nAnyway, once all architectures are moved to generic handling, I believe it is then easier to split \nCONFIG_CMDLINE in two configuration items in order to provide both appending and prepending at the \nsame time.\n\nI see some concerns about risk of double changes, but I have focussed in changing as little as \npossible the existing configuration items, in order to minimise that.","headers":{"Return-Path":"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Authentication-Results":["ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org;\n receiver=<UNKNOWN>)","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr;\n envelope-from=christophe.leroy@csgroup.eu; receiver=<UNKNOWN>)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4FBkbZ49bwz9sRK\n\tfor <patchwork-incoming@ozlabs.org>; Sat,  3 Apr 2021 02:33:30 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4FBkbZ3S2Mz3dZ1\n\tfor <patchwork-incoming@ozlabs.org>; Sat,  3 Apr 2021 02:33:30 +1100 (AEDT)","from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4FBkbG29LSz2xy0\n for <linuxppc-dev@lists.ozlabs.org>; Sat,  3 Apr 2021 02:33:12 +1100 (AEDT)","from localhost (mailhub1-int [192.168.12.234])\n by localhost (Postfix) with ESMTP id 4FBkb71LDWz9v2m9;\n Fri,  2 Apr 2021 17:33:07 +0200 (CEST)","from pegase1.c-s.fr ([192.168.12.234])\n by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024)\n with ESMTP id 3l8bzcUaAS9w; Fri,  2 Apr 2021 17:33:07 +0200 (CEST)","from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192])\n by pegase1.c-s.fr (Postfix) with ESMTP id 4FBkb70P7lz9v2m7;\n Fri,  2 Apr 2021 17:33:07 +0200 (CEST)","from localhost (localhost [127.0.0.1])\n by messagerie.si.c-s.fr (Postfix) with ESMTP id EB14E8BB77;\n Fri,  2 Apr 2021 17:33:08 +0200 (CEST)","from messagerie.si.c-s.fr ([127.0.0.1])\n by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023)\n with ESMTP id 9sXjhQ8q7Sww; Fri,  2 Apr 2021 17:33:08 +0200 (CEST)","from [192.168.4.90] (unknown [192.168.4.90])\n by messagerie.si.c-s.fr (Postfix) with ESMTP id B4BFB8BB6F;\n Fri,  2 Apr 2021 17:33:07 +0200 (CEST)"],"X-Virus-Scanned":["Debian amavisd-new at c-s.fr","amavisd-new at c-s.fr"],"Subject":"Re: [PATCH v3 01/17] cmdline: Add generic function to build command\n line.","To":"Daniel Walker <danielwa@cisco.com>","References":"<cover.1616765869.git.christophe.leroy@csgroup.eu>\n <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu>\n <20210330172714.GR109100@zorba>","From":"Christophe Leroy <christophe.leroy@csgroup.eu>","Message-ID":"<9c74d82f-f58f-1ccb-bf22-8eb02a4cd55d@csgroup.eu>","Date":"Fri, 2 Apr 2021 17:33:06 +0200","User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101\n Thunderbird/78.9.0","MIME-Version":"1.0","In-Reply-To":"<20210330172714.GR109100@zorba>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"fr","Content-Transfer-Encoding":"8bit","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linux-arch@vger.kernel.org, robh@kernel.org,\n microblaze <monstr@monstr.eu>,\n daniel@gimpelevich.san-francisco.ca.us, devicetree@vger.kernel.org,\n linux-sh@vger.kernel.org, will@kernel.org, linux-xtensa@linux-xtensa.org,\n x86@kernel.org, linux-kernel@vger.kernel.org, nios2 <ley.foon.tan@intel.com>,\n linux-mips@vger.kernel.org, openrisc@lists.librecores.org,\n linux-hexagon@vger.kernel.org, sparclinux@vger.kernel.org,\n linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,\n Andrew Morton <akpm@linux-foundation.org>,\n linux-arm-kernel@lists.infradead.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}}]