bootconfig: Support mixing a value and subkeys under a key
authorMasami Hiramatsu <mhiramat@kernel.org>
Wed, 2 Jun 2021 08:19:07 +0000 (17:19 +0900)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 10 Jun 2021 17:41:26 +0000 (13:41 -0400)
commite5efaeb8a8f527d6e91289ff1f67fbcae452b2ca
treeb2a1a004dc24a7e03f2fb819689e5c35cce00d12
parentca24306d83a125df187ad53eddb038fe0cffb8ca
bootconfig: Support mixing a value and subkeys under a key

Support mixing a value and subkeys under a key. Since kernel cmdline
options will support "aaa.bbb=value1 aaa.bbb.ccc=value2", it is
better that the bootconfig supports such configuration too.

Note that this does not change syntax itself but just accepts
mixed value and subkeys e.g.

key = value1
key.subkey = value2

But this is not accepted;

key {
 value1
 subkey = value2
}

That will make value1 as a subkey.

Also, the order of the value node under a key is fixed. If there
are a value and subkeys, the value is always the first child node
of the key. Thus if user specifies subkeys first, e.g.

key.subkey = value1
key = value2

In the program (and /proc/bootconfig), it will be shown as below

key = value2
key.subkey = value1

Link: https://lkml.kernel.org/r/162262194685.264090.7738574774030567419.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
include/linux/bootconfig.h
lib/bootconfig.c
tools/bootconfig/main.c