xen/cmdline: Extend parse_boolean() to signal a name match
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 12 Jul 2022 09:15:03 +0000 (11:15 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 12 Jul 2022 09:15:03 +0000 (11:15 +0200)
commiteec5b02403a9df2523527caad24f17af5060fbe7
tree169ff2b382b13e6d4c24c51200703810d88a4682
parent61b9c2ceeb94b0cdaff01023cc5523b1f13e66e2
xen/cmdline: Extend parse_boolean() to signal a name match

This will help parsing a sub-option which has boolean and non-boolean options
available.

First, rework 'int val' into 'bool has_neg_prefix'.  This inverts it's value,
but the resulting logic is far easier to follow.

Second, reject anything of the form 'no-$FOO=' which excludes ambiguous
constructs such as 'no-$foo=yes' which have never been valid.

This just leaves the case where everything is otherwise fine, but parse_bool()
can't interpret the provided string.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 382326cac528dd1eb0d04efd5c05363c453e29f4
master date: 2022-07-11 15:21:35 +0100
xen/common/kernel.c
xen/include/xen/lib.h