diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-07-01 13:13:04 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-07-01 13:13:04 +0100 |
commit | 8593efa4fb33b8c1f3e3af04f771d8376ae61092 (patch) | |
tree | 9bc4a0a5ac4e28282ef9843bf281ad08593f8ecd /hw/core | |
parent | c26f3a0a6dfe5ef2973ddfab03b1ceff641a7ebe (diff) | |
parent | 13d8cc515dfcf5574077f964332d34890c0101d0 (diff) | |
download | hqemu-8593efa4fb33b8c1f3e3af04f771d8376ae61092.zip hqemu-8593efa4fb33b8c1f3e3af04f771d8376ae61092.tar.gz |
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Block pull request
# gpg: Signature made Tue 01 Jul 2014 09:47:15 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>"
* remotes/stefanha/tags/block-pull-request: (23 commits)
block: add backing-file option to block-stream
block: extend block-commit to accept a string for the backing file
block: add helper function to determine if a BDS is in a chain
block: add QAPI command to allow live backing file change
qapi: Change back sector-count to sectors-count in quorum QAPI events.
block/cow: Avoid use of uninitialized cow_bs in error path
block: simplify bdrv_find_base() and bdrv_find_overlay()
block: make 'top' argument to block-commit optional
iotests: Add more tests to quick group
iotests: Add qemu tests to quick group
iotests: Simplify qemu-iotests-quick.sh
qemu-img create: add 'nocow' option
virtio-blk: remove need for explicit x-data-plane=on option
qdev: drop iothread property type
virtio-blk: replace x-iothread with iothread link property
virtio-blk: move qdev properties into virtio-blk.c
virtio: fix virtio-blk child refcount in transports
virtio-blk: drop virtio_blk_set_conf()
virtio-blk: use aliases instead of duplicate qdev properties
qdev: add qdev_alias_all_properties()
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/core')
-rw-r--r-- | hw/core/qdev-properties-system.c | 50 | ||||
-rw-r--r-- | hw/core/qdev.c | 21 |
2 files changed, 21 insertions, 50 deletions
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 52c2f8a..8e140af 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -385,56 +385,6 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd) nd->instantiated = 1; } -/* --- iothread --- */ - -static char *print_iothread(void *ptr) -{ - return iothread_get_id(ptr); -} - -static int parse_iothread(DeviceState *dev, const char *str, void **ptr) -{ - IOThread *iothread; - - iothread = iothread_find(str); - if (!iothread) { - return -ENOENT; - } - object_ref(OBJECT(iothread)); - *ptr = iothread; - return 0; -} - -static void get_iothread(Object *obj, struct Visitor *v, void *opaque, - const char *name, Error **errp) -{ - get_pointer(obj, v, opaque, print_iothread, name, errp); -} - -static void set_iothread(Object *obj, struct Visitor *v, void *opaque, - const char *name, Error **errp) -{ - set_pointer(obj, v, opaque, parse_iothread, name, errp); -} - -static void release_iothread(Object *obj, const char *name, void *opaque) -{ - DeviceState *dev = DEVICE(obj); - Property *prop = opaque; - IOThread **ptr = qdev_get_prop_ptr(dev, prop); - - if (*ptr) { - object_unref(OBJECT(*ptr)); - } -} - -PropertyInfo qdev_prop_iothread = { - .name = "iothread", - .get = get_iothread, - .set = set_iothread, - .release = release_iothread, -}; - static int qdev_add_one_global(QemuOpts *opts, void *opaque) { GlobalProperty *g; diff --git a/hw/core/qdev.c b/hw/core/qdev.c index a2feb5a..3bdda8e 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -780,6 +780,27 @@ void qdev_property_add_static(DeviceState *dev, Property *prop, } } +/* @qdev_alias_all_properties - Add alias properties to the source object for + * all qdev properties on the target DeviceState. + */ +void qdev_alias_all_properties(DeviceState *target, Object *source) +{ + ObjectClass *class; + Property *prop; + + class = object_get_class(OBJECT(target)); + do { + DeviceClass *dc = DEVICE_CLASS(class); + + for (prop = dc->props; prop && prop->name; prop++) { + object_property_add_alias(source, prop->name, + OBJECT(target), prop->name, + &error_abort); + } + class = object_class_get_parent(class); + } while (class != object_class_by_name(TYPE_DEVICE)); +} + static bool device_get_realized(Object *obj, Error **errp) { DeviceState *dev = DEVICE(obj); |