mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-17 09:52:14 -07:00
It is reasonably common to want to create an object, set a
number of properties, register it in the hierarchy and then
mark it as complete (if a user creatable type). This requires
quite a lot of error prone, verbose, boilerplate code to achieve.
First a pair of functions object_set_props() / object_set_propv()
are added which allow for a list of objects to be set in
one single API call.
Then object_new_with_props() / object_new_with_propv() constructors
are added which simplify the sequence of calls to create an
object, populate properties, register in the object composition
tree and mark the object complete, into a single method call.
Usage would be:
Error *err = NULL;
Object *obj;
obj = object_new_with_propv(TYPE_MEMORY_BACKEND_FILE,
object_get_objects_root(),
"hostmem0",
&err,
"share", "yes",
"mem-path", "/dev/shm/somefile",
"prealloc", "yes",
"size", "1048576",
NULL);
Note all property values are passed in string form and will
be parsed into their required data types, using normal QOM
semantics for parsing from string format.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
43 lines
706 B
Text
43 lines
706 B
Text
check-qdict
|
|
check-qfloat
|
|
check-qint
|
|
check-qjson
|
|
check-qlist
|
|
check-qstring
|
|
check-qom-interface
|
|
check-qom-proplist
|
|
rcutorture
|
|
test-aio
|
|
test-bitops
|
|
test-coroutine
|
|
test-cutils
|
|
test-hbitmap
|
|
test-int128
|
|
test-iov
|
|
test-mul64
|
|
test-opts-visitor
|
|
test-qapi-event.[ch]
|
|
test-qapi-types.[ch]
|
|
test-qapi-visit.[ch]
|
|
test-qdev-global-props
|
|
test-qemu-opts
|
|
test-qmp-commands
|
|
test-qmp-commands.h
|
|
test-qmp-event
|
|
test-qmp-input-strict
|
|
test-qmp-input-visitor
|
|
test-qmp-marshal.c
|
|
test-qmp-output-visitor
|
|
test-rcu-list
|
|
test-rfifolock
|
|
test-string-input-visitor
|
|
test-string-output-visitor
|
|
test-thread-pool
|
|
test-throttle
|
|
test-visitor-serialization
|
|
test-vmstate
|
|
test-write-threshold
|
|
test-x86-cpuid
|
|
test-xbzrle
|
|
*-test
|
|
qapi-schema/*.test.*
|