mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
qom: Factor out user_creatable_add_dict()
The QMP handler qmp_object_add() and the implementation of --object in qemu-storage-daemon can share most of the code. Currently, qemu-storage-daemon calls qmp_object_add(), but this is not correct because different visitors need to be used. As a first step towards a fix, make qmp_object_add() a wrapper around a new function user_creatable_add_dict() that can get an additional parameter. The handling of "props" is only required for compatibility and not required for the qemu-storage-daemon command line, so it stays in qmp_object_add(). Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
6cf9413229
commit
d6a5beeb2b
3 changed files with 40 additions and 23 deletions
|
@ -87,6 +87,18 @@ Object *user_creatable_add_type(const char *type, const char *id,
|
|||
const QDict *qdict,
|
||||
Visitor *v, Error **errp);
|
||||
|
||||
/**
|
||||
* user_creatable_add_dict:
|
||||
* @qdict: the object definition
|
||||
* @errp: if an error occurs, a pointer to an area to store the error
|
||||
*
|
||||
* Create an instance of the user creatable object that is defined by
|
||||
* @qdict. The object type is taken from the QDict key 'qom-type', its
|
||||
* ID from the key 'id'. The remaining entries in @qdict are used to
|
||||
* initialize the object properties.
|
||||
*/
|
||||
void user_creatable_add_dict(QDict *qdict, Error **errp);
|
||||
|
||||
/**
|
||||
* user_creatable_add_opts:
|
||||
* @opts: the object definition
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue