aboutsummaryrefslogtreecommitdiff
path: root/storage-daemon
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2020-10-11 09:35:02 +0200
committerKevin Wolf <kwolf@redhat.com>2020-10-15 16:06:27 +0200
commit8bf12c4f752b439eb37e3de8a063af32e986c730 (patch)
treeb7cb13dcfd038f122643016139eeef1da40f6f74 /storage-daemon
parent7051ae6cf1ec1072d2cdaa978660b22245a1efad (diff)
keyval: Parse help options
This adds a special meaning for 'help' and '?' as options to the keyval parser. Instead of being an error (because of a missing value) or a value for an implied key, they now request help, which is a new boolean output of the parser in addition to the QDict. A new parameter 'p_help' is added to keyval_parse() that contains on return whether help was requested. If NULL is passed, requesting help results in an error and all other cases work like before. Turning previous error cases into help is a compatible extension. The behaviour potentially changes for implied keys: They could previously get 'help' as their value, which is now interpreted as requesting help. This is not a problem in practice because 'help' and '?' are not a valid values for the implied key of any option parsed with keyval_parse(): * audiodev: union Audiodev, implied key "driver" is enum AudiodevDriver, "help" and "?" are not among its values * display: union DisplayOptions, implied key "type" is enum DisplayType, "help" and "?" are not among its values * blockdev: union BlockdevOptions, implied key "driver is enum BlockdevDriver, "help" and "?" are not among its values * export: union BlockExport, implied key "type" is enum BlockExportType, "help" and "?" are not among its values * monitor: struct MonitorOptions, implied key "mode" is enum MonitorMode, "help" and "?" are not among its values * nbd-server: struct NbdServerOptions, no implied key. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201011073505.1185335-5-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'storage-daemon')
-rw-r--r--storage-daemon/qemu-storage-daemon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
index 1ae1cda481..6f0e0cfb36 100644
--- a/storage-daemon/qemu-storage-daemon.c
+++ b/storage-daemon/qemu-storage-daemon.c
@@ -278,7 +278,7 @@ static void process_options(int argc, char *argv[])
}
qemu_opts_del(opts);
- args = keyval_parse(optarg, "qom-type", &error_fatal);
+ args = keyval_parse(optarg, "qom-type", NULL, &error_fatal);
user_creatable_add_dict(args, true, &error_fatal);
qobject_unref(args);
break;