xen/cmdline: Extend parse_boolean() to signal a name match
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 5 Jul 2022 18:19:01 +0000 (19:19 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 11 Jul 2022 14:21:35 +0000 (15:21 +0100)
commit382326cac528dd1eb0d04efd5c05363c453e29f4
tree38e49e8de453c2627af4742173c7269b797a628b
parent4cdb519d797c19ebb8fadc5938cdb47479d5a21b
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>
xen/common/kernel.c
xen/include/xen/lib.h