|
@@ -94,6 +94,8 @@ static int plugin_add(void *opaque, const char *name, const char *value,
|
|
{
|
|
{
|
|
struct qemu_plugin_parse_arg *arg = opaque;
|
|
struct qemu_plugin_parse_arg *arg = opaque;
|
|
struct qemu_plugin_desc *p;
|
|
struct qemu_plugin_desc *p;
|
|
|
|
+ bool is_on;
|
|
|
|
+ char *fullarg;
|
|
|
|
|
|
if (strcmp(name, "file") == 0) {
|
|
if (strcmp(name, "file") == 0) {
|
|
if (strcmp(value, "") == 0) {
|
|
if (strcmp(value, "") == 0) {
|
|
@@ -107,18 +109,32 @@ static int plugin_add(void *opaque, const char *name, const char *value,
|
|
QTAILQ_INSERT_TAIL(arg->head, p, entry);
|
|
QTAILQ_INSERT_TAIL(arg->head, p, entry);
|
|
}
|
|
}
|
|
arg->curr = p;
|
|
arg->curr = p;
|
|
- } else if (strcmp(name, "arg") == 0) {
|
|
|
|
|
|
+ } else {
|
|
if (arg->curr == NULL) {
|
|
if (arg->curr == NULL) {
|
|
error_setg(errp, "missing earlier '-plugin file=' option");
|
|
error_setg(errp, "missing earlier '-plugin file=' option");
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (g_strcmp0(name, "arg") == 0 &&
|
|
|
|
+ !qapi_bool_parse(name, value, &is_on, NULL)) {
|
|
|
|
+ if (strchr(value, '=') == NULL) {
|
|
|
|
+ /* Will treat arg="argname" as "argname=on" */
|
|
|
|
+ fullarg = g_strdup_printf("%s=%s", value, "on");
|
|
|
|
+ } else {
|
|
|
|
+ fullarg = g_strdup_printf("%s", value);
|
|
|
|
+ }
|
|
|
|
+ warn_report("using 'arg=%s' is deprecated", value);
|
|
|
|
+ error_printf("Please use '%s' directly\n", fullarg);
|
|
|
|
+ } else {
|
|
|
|
+ fullarg = g_strdup_printf("%s=%s", name, value);
|
|
|
|
+ }
|
|
|
|
+
|
|
p = arg->curr;
|
|
p = arg->curr;
|
|
p->argc++;
|
|
p->argc++;
|
|
p->argv = g_realloc_n(p->argv, p->argc, sizeof(char *));
|
|
p->argv = g_realloc_n(p->argv, p->argc, sizeof(char *));
|
|
- p->argv[p->argc - 1] = g_strdup(value);
|
|
|
|
- } else {
|
|
|
|
- error_setg(errp, "-plugin: unexpected parameter '%s'; ignored", name);
|
|
|
|
|
|
+ p->argv[p->argc - 1] = fullarg;
|
|
}
|
|
}
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|