xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xen.org
Cc: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH 46/52] xen: carve out a generic parsing function from _cmdline_parse()
Date: Wed,  9 Aug 2017 09:07:00 +0200	[thread overview]
Message-ID: <20170809070706.13481-47-jgross@suse.com> (raw)
In-Reply-To: <20170809070706.13481-1-jgross@suse.com>

In order to support generic parameter parsing carve out the parser from
_cmdline_parse(). As this generic function might be called after boot
remove the __init annotations from all called sub-functions.

Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/common/kernel.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 3fd3abe79c..0d63685c4f 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -23,8 +23,7 @@ enum system_state system_state = SYS_STATE_early_boot;
 xen_commandline_t saved_cmdline;
 static const char __initconst opt_builtin_cmdline[] = CONFIG_CMDLINE;
 
-static int __init assign_integer_param(
-    const struct kernel_param *param, uint64_t val)
+static int assign_integer_param(const struct kernel_param *param, uint64_t val)
 {
     unsigned int bits = param->len * 8;
 
@@ -50,12 +49,13 @@ static int __init assign_integer_param(
            -EOVERFLOW : 0;
 }
 
-static void __init _cmdline_parse(const char *cmdline)
+static int parse_params(const char *cmdline, const struct kernel_param *start,
+                        const struct kernel_param *end)
 {
     char opt[128], *optval, *optkey, *q;
     const char *p = cmdline, *s;
     const struct kernel_param *param;
-    int bool_assert, rc = 0;
+    int bool_assert, rc = 0, final_rc = 0;
 
     for ( ; ; )
     {
@@ -93,7 +93,7 @@ static void __init _cmdline_parse(const char *cmdline)
         if ( !bool_assert )
             optkey += 3;
 
-        for ( param = __setup_start; param < __setup_end; param++ )
+        for ( param = start; param < end; param++ )
         {
             if ( strcmp(param->name, optkey) )
             {
@@ -158,11 +158,24 @@ static void __init _cmdline_parse(const char *cmdline)
         }
 
         if ( rc )
+        {
             printk("parameter \"%s\" has invalid value \"%s\"!\n", optkey,
                    optval);
-        if ( param >= __setup_end )
+            final_rc = rc;
+        }
+        if ( param >= end )
+        {
             printk("parameter \"%s\" unknown!\n", optkey);
+            final_rc = -EINVAL;
+        }
     }
+
+    return final_rc;
+}
+
+static void __init _cmdline_parse(const char *cmdline)
+{
+    parse_params(cmdline, __setup_start, __setup_end);
 }
 
 /**
@@ -187,7 +200,7 @@ void __init cmdline_parse(const char *cmdline)
 #endif
 }
 
-int __init parse_bool(const char *s)
+int parse_bool(const char *s)
 {
     if ( !strcmp("no", s) ||
          !strcmp("off", s) ||
-- 
2.12.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-08-09  7:07 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09  7:06 [PATCH 00/52] Support for modifying parameters at runtime Juergen Gross
2017-08-09  7:06 ` [PATCH 01/52] xen/arch/arm/acpi/boot.c: let custom parameter parsing routines return errno Juergen Gross
2017-08-09  7:06 ` [PATCH 02/52] xen/arch/arm/domain_build.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 03/52] xen/arch/arm/traps.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 04/52] xen/arch/x86/apic.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 05/52] xen/arch/x86/cpu/mcheck/mce.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 06/52] xen/arch/x86/cpu/vpmu.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 07/52] xen/arch/x86/dom0_build.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 08/52] xen/arch/x86/genapic/probe.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 09/52] xen/arch/x86/hvm/viridian.c: " Juergen Gross
2017-08-09  8:02   ` Paul Durrant
2017-08-09  7:06 ` [PATCH 10/52] xen/arch/x86/hvm/vmx/vmcs.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 11/52] xen/arch/x86/io_apic.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 12/52] xen/arch/x86/irq.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 13/52] xen/arch/x86/microcode.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 14/52] xen/arch/x86/mm.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 15/52] xen/arch/x86/nmi.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 16/52] xen/arch/x86/numa.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 17/52] xen/arch/x86/oprofile/nmi_int.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 18/52] xen/arch/x86/psr.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 19/52] xen/arch/x86/setup.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 20/52] xen/arch/x86/shutdown.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 21/52] xen/arch/x86/time.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 22/52] xen/arch/x86/x86_64/mmconfig-shared.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 23/52] xen/common/core_parking.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 24/52] xen/common/domain.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 25/52] xen/common/efi/boot.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 26/52] xen/common/kexec.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 27/52] xen/common/memory.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 28/52] xen/common/sched_credit2.c: " Juergen Gross
2017-08-09  7:16   ` Dario Faggioli
2017-08-09  7:06 ` [PATCH 29/52] xen/drivers/acpi/tables.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 30/52] xen/drivers/char/console.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 31/52] xen/drivers/cpufreq/cpufreq.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 32/52] xen/drivers/passthrough/amd/iommu_acpi.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 33/52] xen/drivers/passthrough/iommu.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 34/52] xen/drivers/passthrough/pci.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 35/52] xen/drivers/passthrough/vtd/dmar.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 36/52] xen/drivers/passthrough/vtd/quirks.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 37/52] xen/drivers/video/vesa.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 38/52] xen/xsm/flask/flask_op.c: " Juergen Gross
2017-08-09 15:31   ` Daniel De Graaf
2017-08-09  7:06 ` [PATCH 39/52] xen: check parameter validity when parsing command line Juergen Gross
2017-08-10 13:02   ` Wei Liu
2017-08-10 13:24     ` Juergen Gross
2017-08-10 13:32       ` Jan Beulich
     [not found]       ` <598C7C96020000780016E8F0@suse.com>
2017-08-10 13:36         ` Juergen Gross
2017-08-10 13:38       ` Wei Liu
2017-08-09  7:06 ` [PATCH 40/52] xen/arch/x86/apic.c: remove custom_param() error messages Juergen Gross
2017-08-09  7:06 ` [PATCH 41/52] xen/arch/x86/cpu/mcheck/mce.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 42/52] xen/arch/x86/hvm/viridian.c: " Juergen Gross
2017-08-09  8:08   ` Paul Durrant
2017-08-09  7:06 ` [PATCH 43/52] xen/arch/x86/io_apic.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 44/52] xen/common/kexec.c: " Juergen Gross
2017-08-09  7:06 ` [PATCH 45/52] xen/common/sched_credit2.c: " Juergen Gross
2017-08-09  7:17   ` Dario Faggioli
2017-08-09  7:07 ` Juergen Gross [this message]
2017-08-10 16:07   ` [PATCH 46/52] xen: carve out a generic parsing function from _cmdline_parse() Wei Liu
2017-08-09  7:07 ` [PATCH 47/52] xen: add basic support for runtime parameter changing Juergen Gross
2017-08-10 16:17   ` Wei Liu
2017-08-10 17:31     ` Juergen Gross
2017-08-09  7:07 ` [PATCH 48/52] xen: add hypercall for setting parameters at runtime Juergen Gross
2017-08-09 16:56   ` Daniel De Graaf
2017-08-09  7:07 ` [PATCH 49/52] libxc: add function to set hypervisor parameters Juergen Gross
2017-08-10 16:27   ` Wei Liu
2017-08-09  7:07 ` [PATCH 50/52] libxl: add libxl_set_parameters() function Juergen Gross
2017-08-10 16:28   ` Wei Liu
2017-08-10 17:32     ` Juergen Gross
2017-08-09  7:07 ` [PATCH 51/52] xl: add new xl command set-parameters Juergen Gross
2017-08-10 16:29   ` Wei Liu
2017-08-09  7:07 ` [PATCH 52/52] xen: make some console related parameters settable at runtime Juergen Gross
2017-08-10 16:31   ` Wei Liu
2017-08-10 16:42 ` [PATCH 00/52] Support for modifying parameters " Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170809070706.13481-47-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).