mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
qemu-config: parse configuration files to a QDict
Change the parser to put the values into a QDict and pass them to a callback. qemu_config_parse's QemuOpts creation is itself turned into a callback function. This is useful for -readconfig to support keyval-based options; getting a QDict from the parser removes a roundtrip from QDict to QemuOpts and then back to QDict. Unfortunately there is a disadvantage in that semantic errors will point to the last line of the group, because the entries of the QDict do not have a location attached. Cc: Kevin Wolf <kwolf@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210524105752.3318299-2-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
4db4385a7a
commit
3770141139
3 changed files with 76 additions and 33 deletions
|
@ -2133,7 +2133,7 @@ static void qemu_read_default_config_file(Error **errp)
|
|||
int ret;
|
||||
g_autofree char *file = get_relocated_path(CONFIG_QEMU_CONFDIR "/qemu.conf");
|
||||
|
||||
ret = qemu_read_config_file(file, errp);
|
||||
ret = qemu_read_config_file(file, qemu_config_do_parse, errp);
|
||||
if (ret < 0) {
|
||||
if (ret == -ENOENT) {
|
||||
error_free(*errp);
|
||||
|
@ -3399,7 +3399,7 @@ void qemu_init(int argc, char **argv, char **envp)
|
|||
qemu_plugin_opt_parse(optarg, &plugin_list);
|
||||
break;
|
||||
case QEMU_OPTION_readconfig:
|
||||
qemu_read_config_file(optarg, &error_fatal);
|
||||
qemu_read_config_file(optarg, qemu_config_do_parse, &error_fatal);
|
||||
break;
|
||||
case QEMU_OPTION_spice:
|
||||
olist = qemu_find_opts_err("spice", NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue