From patchwork Fri Sep 15 17:02:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michal_Such=C3=A1nek?= X-Patchwork-Id: 814338 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xv1yD33zvz9s7m for ; Sat, 16 Sep 2017 03:06:12 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xv1yD1yX9zDrpB for ; Sat, 16 Sep 2017 03:06:12 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=suse.de (client-ip=195.135.220.15; helo=mx1.suse.de; envelope-from=msuchanek@suse.de; receiver=) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xv1td5KF9zDrYl for ; Sat, 16 Sep 2017 03:02:58 +1000 (AEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C69785CB15; Fri, 15 Sep 2017 17:02:55 +0000 (UTC) From: Michal Suchanek To: Jonathan Corbet , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Mauro Carvalho Chehab , Jani Nikula , Michal Suchanek , Kamlakant Patel , Bamvor Jian Zhang , Tamara Diaconita , Trond Myklebust , Hari Bathini , Mahesh Salgaonkar , Andrew Morton , Nicholas Piggin , Baoquan He , Ilya Matveychikov , Ingo Molnar , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/6] lib/cmdline.c: Add backslash support to kernel commandline parsing. Date: Fri, 15 Sep 2017 19:02:46 +0200 Message-Id: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> References: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This allows passing quotes in kernel arguments. It is useful for passing fadump nested arguemnts in fadump_extra_args and might be useful if somebody wanted to pass a double quote directly as part of an argument. It is also useful to have quoting grammar more similar to shells and bootloaders. Signed-off-by: Michal Suchanek --- lib/cmdline.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/lib/cmdline.c b/lib/cmdline.c index 6d398a8b63fc..d98bdc017545 100644 --- a/lib/cmdline.c +++ b/lib/cmdline.c @@ -193,30 +193,36 @@ bool parse_option_str(const char *str, const char *option) /* * Parse a string to get a param value pair. - * You can use " around spaces, but can't escape ". + * You can use " around spaces, and you can escape with \ * Hyphens and underscores equivalent in parameter names. */ char *next_arg(char *args, char **param, char **val) { unsigned int i, equals = 0; - int in_quote = 0, quoted = 0; + int in_quote = 0, backslash = 0; char *next; - if (*args == '"') { - args++; - in_quote = 1; - quoted = 1; - } - for (i = 0; args[i]; i++) { - if (isspace(args[i]) && !in_quote) + if (isspace(args[i]) && !in_quote && !backslash) break; - if (equals == 0) { - if (args[i] == '=') - equals = i; + + if ((equals == 0) && (args[i] == '=')) + equals = i; + + if (!backslash) { + if ((args[i] == '"') || (args[i] == '\\')) { + if (args[i] == '"') + in_quote = !in_quote; + if (args[i] == '\\') + backslash = 1; + + memmove(args + 1, args, i); + args++; + i--; + } + } else { + backslash = 0; } - if (args[i] == '"') - in_quote = !in_quote; } *param = args; @@ -225,13 +231,6 @@ char *next_arg(char *args, char **param, char **val) else { args[equals] = '\0'; *val = args + equals + 1; - - /* Don't include quotes in value. */ - if ((args[i-1] == '"') && ((quoted) || (**val == '"'))) { - args[i-1] = '\0'; - if (!quoted) - (*val)++; - } } if (args[i]) { From patchwork Fri Sep 15 17:02:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michal_Such=C3=A1nek?= X-Patchwork-Id: 814336 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xv1wV5xK7z9sNc for ; Sat, 16 Sep 2017 03:04:42 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xv1wV4HK2zDrZx for ; Sat, 16 Sep 2017 03:04:42 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=suse.de (client-ip=195.135.220.15; helo=mx1.suse.de; envelope-from=msuchanek@suse.de; receiver=) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xv1td5KS9zDrZC for ; Sat, 16 Sep 2017 03:02:59 +1000 (AEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 18AD45CB16; Fri, 15 Sep 2017 17:02:57 +0000 (UTC) From: Michal Suchanek To: Jonathan Corbet , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Mauro Carvalho Chehab , Jani Nikula , Michal Suchanek , Kamlakant Patel , Bamvor Jian Zhang , Tamara Diaconita , Trond Myklebust , Hari Bathini , Mahesh Salgaonkar , Andrew Morton , Nicholas Piggin , Baoquan He , Ilya Matveychikov , Ingo Molnar , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/6] Documentation/admin-guide: backslash support in commandline. Date: Fri, 15 Sep 2017 19:02:47 +0200 Message-Id: X-Mailer: git-send-email 2.10.2 In-Reply-To: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> References: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> In-Reply-To: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> References: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Signed-off-by: Michal Suchanek --- Documentation/admin-guide/kernel-parameters.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.rst b/Documentation/admin-guide/kernel-parameters.rst index b2598cc9834c..722d3f771924 100644 --- a/Documentation/admin-guide/kernel-parameters.rst +++ b/Documentation/admin-guide/kernel-parameters.rst @@ -35,9 +35,9 @@ can also be entered as:: log-buf-len=1M print_fatal_signals=1 -Double-quotes can be used to protect spaces in values, e.g.:: +Double-quotes and backslashes can be used to protect spaces in values, e.g.:: - param="spaces in here" + param="spaces in here" param2=spaces\ in\ here cpu lists: ---------- From patchwork Fri Sep 15 17:02:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michal_Such=C3=A1nek?= X-Patchwork-Id: 814339 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xv1zr4xXkz9s7m for ; Sat, 16 Sep 2017 03:07:36 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xv1zr3xmgzDrZt for ; Sat, 16 Sep 2017 03:07:36 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=suse.de (client-ip=195.135.220.15; helo=mx1.suse.de; envelope-from=msuchanek@suse.de; receiver=) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xv1tg1cMdzDrZf for ; Sat, 16 Sep 2017 03:03:07 +1000 (AEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 22C165CB18; Fri, 15 Sep 2017 17:02:59 +0000 (UTC) From: Michal Suchanek To: Jonathan Corbet , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Mauro Carvalho Chehab , Jani Nikula , Michal Suchanek , Kamlakant Patel , Bamvor Jian Zhang , Tamara Diaconita , Trond Myklebust , Hari Bathini , Mahesh Salgaonkar , Andrew Morton , Nicholas Piggin , Baoquan He , Ilya Matveychikov , Ingo Molnar , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 3/6] powerpc/fadump: stop removing quotes in argument parsing. Date: Fri, 15 Sep 2017 19:02:48 +0200 Message-Id: <7c84e1fab6b78006eabf819b453b826aff078be1.1505494668.git.msuchanek@suse.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> References: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> In-Reply-To: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> References: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Signed-off-by: Michal Suchanek --- arch/powerpc/kernel/fadump.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 1678d99ea835..275ea42a27d5 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -494,13 +494,6 @@ static void __init fadump_update_params(struct param_info *param_info, if (!val) return; - /* remove one leading and one trailing quote if both are present */ - if ((val[0] == '"') && (val[vallen - 1] == '"')) { - shortening += 2; - vallen -= 2; - val++; - } - strncpy(tgt, FADUMP_EXTRA_ARGS_PARAM, FADUMP_EXTRA_ARGS_LEN); tgt += FADUMP_EXTRA_ARGS_LEN; *tgt++ = ' '; From patchwork Fri Sep 15 17:02:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michal_Such=C3=A1nek?= X-Patchwork-Id: 814341 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xv21W3VG1z9sPs for ; Sat, 16 Sep 2017 03:09:03 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xv21W2XYDzDrq3 for ; Sat, 16 Sep 2017 03:09:03 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=suse.de (client-ip=195.135.220.15; helo=mx1.suse.de; envelope-from=msuchanek@suse.de; receiver=) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xv1tg1X2RzDrZZ for ; Sat, 16 Sep 2017 03:03:07 +1000 (AEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8D0685CB17; Fri, 15 Sep 2017 17:03:00 +0000 (UTC) From: Michal Suchanek To: Jonathan Corbet , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Mauro Carvalho Chehab , Jani Nikula , Michal Suchanek , Kamlakant Patel , Bamvor Jian Zhang , Tamara Diaconita , Trond Myklebust , Hari Bathini , Mahesh Salgaonkar , Andrew Morton , Nicholas Piggin , Baoquan He , Ilya Matveychikov , Ingo Molnar , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 4/6] powerpc/fadump: Update fadump ducumentation on quoting arguments. Date: Fri, 15 Sep 2017 19:02:49 +0200 Message-Id: <31980608f5b18f850076f4abe4f8aa2077b02fd0.1505494668.git.msuchanek@suse.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> References: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> In-Reply-To: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> References: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Signed-off-by: Michal Suchanek --- Documentation/powerpc/firmware-assisted-dump.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/powerpc/firmware-assisted-dump.txt b/Documentation/powerpc/firmware-assisted-dump.txt index 2df88524d2c7..5705f55ffae4 100644 --- a/Documentation/powerpc/firmware-assisted-dump.txt +++ b/Documentation/powerpc/firmware-assisted-dump.txt @@ -173,7 +173,7 @@ How to enable firmware-assisted dump (fadump): can be used to reduce memory consumption during dump capture by disabling unwarranted resources/subsystems like CPUs, NUMA and such. Value with spaces can be passed as - 'fadump_extra_args=""parameter="value with spaces"""' + 'fadump_extra_args="parameter=\"value with spaces\""' 4. Optionally, user can also set 'crashkernel=' kernel cmdline to specify size of the memory to reserve for boot memory dump preservation. From patchwork Fri Sep 15 17:02:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michal_Such=C3=A1nek?= X-Patchwork-Id: 814342 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xv23J3Hq2z9rvt for ; Sat, 16 Sep 2017 03:10:36 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xv23J2KnPzDrby for ; Sat, 16 Sep 2017 03:10:36 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=suse.de (client-ip=195.135.220.15; helo=mx1.suse.de; envelope-from=msuchanek@suse.de; receiver=) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xv1tg1T4DzDrZX for ; Sat, 16 Sep 2017 03:03:07 +1000 (AEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6C61B5CB19; Fri, 15 Sep 2017 17:03:01 +0000 (UTC) From: Michal Suchanek To: Jonathan Corbet , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Mauro Carvalho Chehab , Jani Nikula , Michal Suchanek , Kamlakant Patel , Bamvor Jian Zhang , Tamara Diaconita , Trond Myklebust , Hari Bathini , Mahesh Salgaonkar , Andrew Morton , Nicholas Piggin , Baoquan He , Ilya Matveychikov , Ingo Molnar , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 5/6] lib/cmdline.c: Implement single quotes in commandline argument parsing Date: Fri, 15 Sep 2017 19:02:50 +0200 Message-Id: <286201ef5be4f48110b8ec6ed02b12f01315333d.1505494668.git.msuchanek@suse.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> References: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> In-Reply-To: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> References: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This brings the kernel parser about on par with bourne shell, grub, and other tools that chew the arguments before kernel does. This should make it easier to deal with multiple levels of nesting/quoting. With same quoting grammar on each level there is less room for confusion. Signed-off-by: Michal Suchanek --- lib/cmdline.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/cmdline.c b/lib/cmdline.c index d98bdc017545..c5335a79a177 100644 --- a/lib/cmdline.c +++ b/lib/cmdline.c @@ -191,34 +191,45 @@ bool parse_option_str(const char *str, const char *option) return false; } +#define squash_char { \ + memmove(args + 1, args, i); \ + args++; \ + i--; \ +} + /* * Parse a string to get a param value pair. - * You can use " around spaces, and you can escape with \ + * You can use " or ' around spaces, and you can escape with \ * Hyphens and underscores equivalent in parameter names. */ char *next_arg(char *args, char **param, char **val) { unsigned int i, equals = 0; - int in_quote = 0, backslash = 0; + int in_quote = 0, backslash = 0, in_single = 0; char *next; for (i = 0; args[i]; i++) { - if (isspace(args[i]) && !in_quote && !backslash) + if (isspace(args[i]) && !in_quote && !backslash && !in_single) break; if ((equals == 0) && (args[i] == '=')) equals = i; - if (!backslash) { - if ((args[i] == '"') || (args[i] == '\\')) { + if (in_single) { + if (args[i] == '\'') { + in_single = 0; + squash_char; + } + } else if (!backslash) { + if ((args[i] == '"') || (args[i] == '\\') || + (args[i] == '\'')) { if (args[i] == '"') in_quote = !in_quote; if (args[i] == '\\') backslash = 1; - - memmove(args + 1, args, i); - args++; - i--; + if (args[i] == '\'') + in_single = 1; + squash_char; } } else { backslash = 0; From patchwork Fri Sep 15 17:02:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michal_Such=C3=A1nek?= X-Patchwork-Id: 814343 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xv25G2sjBz9s7m for ; Sat, 16 Sep 2017 03:12:18 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xv25G1y8XzDrc2 for ; Sat, 16 Sep 2017 03:12:18 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=suse.de (client-ip=195.135.220.15; helo=mx1.suse.de; envelope-from=msuchanek@suse.de; receiver=) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xv1tj0mYdzDrYl for ; Sat, 16 Sep 2017 03:03:09 +1000 (AEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id EB86E5CB1A; Fri, 15 Sep 2017 17:03:02 +0000 (UTC) From: Michal Suchanek To: Jonathan Corbet , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Mauro Carvalho Chehab , Jani Nikula , Michal Suchanek , Kamlakant Patel , Bamvor Jian Zhang , Tamara Diaconita , Trond Myklebust , Hari Bathini , Mahesh Salgaonkar , Andrew Morton , Nicholas Piggin , Baoquan He , Ilya Matveychikov , Ingo Molnar , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 6/6] Documentation/admin-guide: single quotes in kernel arguments. Date: Fri, 15 Sep 2017 19:02:51 +0200 Message-Id: <44dd719f756a9e1b8388730b0b4562507027d35a.1505494668.git.msuchanek@suse.de> X-Mailer: git-send-email 2.10.2 In-Reply-To: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> References: <28da60231eb848981e858fa33e3b7e33f8547111.1505494668.git.msuchanek@suse.de> In-Reply-To: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> References: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Signed-off-by: Michal Suchanek --- Documentation/admin-guide/kernel-parameters.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.rst b/Documentation/admin-guide/kernel-parameters.rst index 722d3f771924..1f9837266417 100644 --- a/Documentation/admin-guide/kernel-parameters.rst +++ b/Documentation/admin-guide/kernel-parameters.rst @@ -35,9 +35,10 @@ can also be entered as:: log-buf-len=1M print_fatal_signals=1 -Double-quotes and backslashes can be used to protect spaces in values, e.g.:: +Double-quotes single-quaotes and backslashes can be used to protect spaces +in values, e.g.:: - param="spaces in here" param2=spaces\ in\ here + param="spaces in here" param2=spaces\ in\ here param3='@%# !\' cpu lists: ----------