Paolo Bonzini <pbonzini@redhat.com> writes:
Add generic machinery to support parsing command line options with
keyval in -set and -readconfig, choosing between QDict and
QemuOpts as the underlying data structure.
The keyval_merge function is slightly heavyweight as a way to
do qemu_set_option for QDict-based options, but it will be put
to further use later to merge entire -readconfig sections together
with their command-line equivalents.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Watch this:
$ cat test.cfg
[machine]
accel = "kvm"
usb = "on"
$ qemu-system-x86_64 -S -display none -readconfig test.cfg
Aborted (core dumped)
Backtrace:
#0 0x00007ffff52f19e5 in raise () at /lib64/libc.so.6
#1 0x00007ffff52da895 in abort () at /lib64/libc.so.6
#2 0x0000555555c44a77 in qemu_record_config_group
(group=0x7fffffffd1b0 "machine", dict=0x5555565fb740, errp=0x5555564ffca0
<error_fatal>) at ../softmmu/vl.c:2103
#3 0x0000555555c44bd8 in qemu_parse_config_group
(group=0x7fffffffd1b0 "machine", qdict=0x5555565f9640, opaque=0x5555564ff9e0
<vm_config_groups>, errp=0x5555564ffca0 <error_fatal>) at ../softmmu/vl.c:2135
#4 0x0000555555eda3e6 in qemu_config_foreach
(fp=0x5555565f3e00, cb=0x555555c44af5 <qemu_parse_config_group>, opaque=0x5555564ff9e0
<vm_config_groups>, fname=0x7fffffffe0dd "test.cfg", errp=0x5555564ffca0
<error_fatal>) at ../util/qemu-config.c:378
#5 0x0000555555eda5d5 in qemu_read_config_file
(filename=0x7fffffffe0dd "test.cfg", cb=0x555555c44af5
<qemu_parse_config_group>, errp=0x5555564ffca0 <error_fatal>) at ../util/qemu-config.c:421
#6 0x0000555555c47d3f in qemu_init
(argc=6, argv=0x7fffffffdcc8, envp=0x7fffffffdd00) at
../softmmu/vl.c:3405
#7 0x00005555558234e1 in main
(argc=6, argv=0x7fffffffdcc8, envp=0x7fffffffdd00) at
../softmmu/main.c:49
Similar result for
[memory]
size = "1024"
and
[chardev "mon0"]
backend = "stdio"
I didn't look for more.