summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-09-16 13:06:25 +0200
committerMarkus Armbruster <armbru@redhat.com>2015-09-21 09:56:49 +0200
commit6eb3937e9b20319e1c4f4d53e906fda8f5ccda10 (patch)
tree598fa3e8ec2c7216e0eb48cd83b195f62d5c1ab0
parent28770e057f265a4e70bcbdfc2447cce7b5f2dc19 (diff)
downloadhqemu-6eb3937e9b20319e1c4f4d53e906fda8f5ccda10.zip
hqemu-6eb3937e9b20319e1c4f4d53e906fda8f5ccda10.tar.gz
qom: Don't use 'gen': false for qom-get, qom-set, object-add
With the previous commit, the generated marshalers just work, and save us a bit of handwritten code. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-23-git-send-email-armbru@redhat.com>
-rw-r--r--include/monitor/monitor.h3
-rw-r--r--qapi-schema.json9
-rw-r--r--qmp-commands.hx6
-rw-r--r--qmp.c21
-rw-r--r--scripts/qapi.py1
5 files changed, 14 insertions, 26 deletions
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 9aff47e..bc6cb6d 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -42,9 +42,6 @@ void monitor_read_command(Monitor *mon, int show_prompt);
int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
void *opaque);
-void qmp_qom_set(QDict *qdict, QObject **ret, Error **errp);
-void qmp_qom_get(QDict *qdict, QObject **ret, Error **errp);
-void qmp_object_add(QDict *qdict, QObject **ret, Error **errp);
void object_add(const char *type, const char *id, const QDict *qdict,
Visitor *v, Error **errp);
diff --git a/qapi-schema.json b/qapi-schema.json
index 2bada60..756ed9e 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1698,8 +1698,7 @@
##
{ 'command': 'qom-get',
'data': { 'path': 'str', 'property': 'str' },
- 'returns': '**',
- 'gen': false }
+ 'returns': 'any' }
##
# @qom-set:
@@ -1716,8 +1715,7 @@
# Since: 1.2
##
{ 'command': 'qom-set',
- 'data': { 'path': 'str', 'property': 'str', 'value': '**' },
- 'gen': false }
+ 'data': { 'path': 'str', 'property': 'str', 'value': 'any' } }
##
# @set_password:
@@ -2127,8 +2125,7 @@
# Since: 2.0
##
{ 'command': 'object-add',
- 'data': {'qom-type': 'str', 'id': 'str', '*props': '**'},
- 'gen': false }
+ 'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'} }
##
# @object-del:
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 4640a3d..7c74e20 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -953,7 +953,7 @@ EQMP
{
.name = "object-add",
.args_type = "qom-type:s,id:s,props:q?",
- .mhandler.cmd_new = qmp_object_add,
+ .mhandler.cmd_new = qmp_marshal_object_add,
},
SQMP
@@ -3575,13 +3575,13 @@ EQMP
{
.name = "qom-set",
.args_type = "path:s,property:s,value:q",
- .mhandler.cmd_new = qmp_qom_set,
+ .mhandler.cmd_new = qmp_marshal_qom_set,
},
{
.name = "qom-get",
.args_type = "path:s,property:s",
- .mhandler.cmd_new = qmp_qom_get,
+ .mhandler.cmd_new = qmp_marshal_qom_get,
},
{
diff --git a/qmp.c b/qmp.c
index 3feae9f..057a7cb 100644
--- a/qmp.c
+++ b/qmp.c
@@ -234,12 +234,9 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
return props;
}
-/* FIXME: teach qapi about how to pass through Visitors */
-void qmp_qom_set(QDict *qdict, QObject **ret, Error **errp)
+void qmp_qom_set(const char *path, const char *property, QObject *value,
+ Error **errp)
{
- const char *path = qdict_get_str(qdict, "path");
- const char *property = qdict_get_str(qdict, "property");
- QObject *value = qdict_get(qdict, "value");
Object *obj;
obj = object_resolve_path(path, NULL);
@@ -252,20 +249,18 @@ void qmp_qom_set(QDict *qdict, QObject **ret, Error **errp)
object_property_set_qobject(obj, value, property, errp);
}
-void qmp_qom_get(QDict *qdict, QObject **ret, Error **errp)
+QObject *qmp_qom_get(const char *path, const char *property, Error **errp)
{
- const char *path = qdict_get_str(qdict, "path");
- const char *property = qdict_get_str(qdict, "property");
Object *obj;
obj = object_resolve_path(path, NULL);
if (!obj) {
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
"Device '%s' not found", path);
- return;
+ return NULL;
}
- *ret = object_property_get_qobject(obj, property, errp);
+ return object_property_get_qobject(obj, property, errp);
}
void qmp_set_password(const char *protocol, const char *password,
@@ -661,11 +656,9 @@ out:
object_unref(obj);
}
-void qmp_object_add(QDict *qdict, QObject **ret, Error **errp)
+void qmp_object_add(const char *type, const char *id,
+ bool has_props, QObject *props, Error **errp)
{
- const char *type = qdict_get_str(qdict, "qom-type");
- const char *id = qdict_get_str(qdict, "id");
- QObject *props = qdict_get(qdict, "props");
const QDict *pdict = NULL;
QmpInputVisitor *qiv;
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 6a21bd6..8808ae6 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -40,6 +40,7 @@ builtin_types = {
returns_whitelist = [
# From QMP:
'human-monitor-command',
+ 'qom-get',
'query-migrate-cache-size',
'query-tpm-models',
'query-tpm-types',
OpenPOWER on IntegriCloud