]> Git Repo - qemu.git/commitdiff
hmp: Simplify qom-set
authorDr. David Alan Gilbert <[email protected]>
Wed, 20 May 2020 15:11:08 +0000 (16:11 +0100)
committerDr. David Alan Gilbert <[email protected]>
Mon, 1 Jun 2020 17:44:27 +0000 (18:44 +0100)
Simplify qom_set by making it use qmp_qom_set and the JSON parser.

(qemu) qom-get /machine smm
"auto"
(qemu) qom-set /machine smm "auto"

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20200520151108[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
  With 's'->'S' type change suggested by Paolo and Markus

hmp-commands.hx
qom/qom-hmp-cmds.c

index 250ddae54d7d9eea6a829e342e0bc06edba3e1be..28256209b54529495a0a86b14332909a3e200459 100644 (file)
@@ -1806,7 +1806,7 @@ ERST
 
     {
         .name       = "qom-set",
-        .args_type  = "path:s,property:s,value:s",
+        .args_type  = "path:s,property:s,value:S",
         .params     = "path property value",
         .help       = "set QOM property",
         .cmd        = hmp_qom_set,
index a8b0a080c740514966c55d79d6cb937e01fc3231..f704b6949a1bc964008803bff4350d6b38f5ece2 100644 (file)
@@ -48,19 +48,13 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict)
     const char *property = qdict_get_str(qdict, "property");
     const char *value = qdict_get_str(qdict, "value");
     Error *err = NULL;
-    bool ambiguous = false;
-    Object *obj;
+    QObject *obj;
 
-    obj = object_resolve_path(path, &ambiguous);
-    if (obj == NULL) {
-        error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
-                  "Device '%s' not found", path);
-    } else {
-        if (ambiguous) {
-            monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
-        }
-        object_property_parse(obj, value, property, &err);
+    obj = qobject_from_json(value, &err);
+    if (err == NULL) {
+        qmp_qom_set(path, property, obj, &err);
     }
+
     hmp_handle_error(mon, err);
 }
 
This page took 0.030489 seconds and 4 git commands to generate.