[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 07/52] xen/arch/x86/dom0_build.c: let custom parameter parsing routines return errno
Modify the custom parameter parsing routines in: xen/arch/x86/dom0_build.c to indicate whether the parameter value was parsed successfully. Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Signed-off-by: Juergen Gross <jgross@xxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/dom0_build.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 0c125e61eb..21eb640a48 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -47,7 +47,7 @@ static long __init parse_amt(const char *s, const char **ps) long pages = parse_size_and_unit((*s == '-') ? s+1 : s, ps) >> PAGE_SHIFT; return (*s == '-') ? -pages : pages; } -static void __init parse_dom0_mem(const char *s) +static int __init parse_dom0_mem(const char *s) { do { if ( !strncmp(s, "min:", 4) ) @@ -57,13 +57,15 @@ static void __init parse_dom0_mem(const char *s) else dom0_nrpages = parse_amt(s, &s); } while ( *s++ == ',' ); + + return *s ? -EINVAL : 0; } custom_param("dom0_mem", parse_dom0_mem); static unsigned int __initdata opt_dom0_max_vcpus_min = 1; static unsigned int __initdata opt_dom0_max_vcpus_max = UINT_MAX; -static void __init parse_dom0_max_vcpus(const char *s) +static int __init parse_dom0_max_vcpus(const char *s) { if ( *s == '-' ) /* -M */ opt_dom0_max_vcpus_max = simple_strtoul(s + 1, &s, 0); @@ -77,6 +79,8 @@ static void __init parse_dom0_max_vcpus(const char *s) else if ( *s++ == '-' && *s ) /* N-M */ opt_dom0_max_vcpus_max = simple_strtoul(s, &s, 0); } + + return *s ? -EINVAL : 0; } custom_param("dom0_max_vcpus", parse_dom0_max_vcpus); @@ -85,7 +89,7 @@ static __initdata unsigned int dom0_pxms[MAX_NUMNODES] = { [0 ... MAX_NUMNODES - 1] = ~0 }; static __initdata bool dom0_affinity_relaxed; -static void __init parse_dom0_nodes(const char *s) +static int __init parse_dom0_nodes(const char *s) { do { if ( isdigit(*s) ) @@ -103,6 +107,8 @@ static void __init parse_dom0_nodes(const char *s) else break; } while ( ++dom0_nr_pxms < ARRAY_SIZE(dom0_pxms) && *s++ == ',' ); + + return *s ? -EINVAL : 0; } custom_param("dom0_nodes", parse_dom0_nodes); @@ -183,9 +189,10 @@ bool __initdata dom0_pvh; * - pvh Create a PVHv2 Dom0. * - shadow Use shadow paging for Dom0. */ -static void __init parse_dom0_param(char *s) +static int __init parse_dom0_param(char *s) { char *ss; + int rc = 0; do { @@ -199,9 +206,13 @@ static void __init parse_dom0_param(char *s) else if ( !strcmp(s, "shadow") ) opt_dom0_shadow = true; #endif + else + rc = -EINVAL; s = ss + 1; } while ( ss ); + + return rc; } custom_param("dom0", parse_dom0_param); -- 2.12.3 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |