diff options
author | Markus Armbruster <armbru@redhat.com> | 2011-08-03 15:07:40 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-09-06 11:23:51 +0200 |
commit | fa879d62eb51253d00b6920ce1d1d9d261370a49 (patch) | |
tree | f83542a0ae74fe8ef0078f90098ae6aa7e02a7d6 /hw/qdev-properties.c | |
parent | 648fb0ea5e9d7f32c80ec23c3ece4321403dfecd (diff) | |
download | qemu-fa879d62eb51253d00b6920ce1d1d9d261370a49.zip qemu-fa879d62eb51253d00b6920ce1d1d9d261370a49.tar.gz qemu-fa879d62eb51253d00b6920ce1d1d9d261370a49.tar.bz2 |
block: Attach non-qdev devices as well
For now, this just protects against programming errors like having the
same drive back multiple non-qdev devices, or untimely bdrv_delete().
Later commits will add other interesting uses.
While there, rename BlockDriverState member peer to dev, bdrv_attach()
to bdrv_attach_dev(), bdrv_detach() to bdrv_detach_dev(), and
bdrv_get_attached() to bdrv_get_attached_dev().
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/qdev-properties.c')
-rw-r--r-- | hw/qdev-properties.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 0c0c292..7ce95b6 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -312,7 +312,7 @@ static int parse_drive(DeviceState *dev, Property *prop, const char *str) bs = bdrv_find(str); if (bs == NULL) return -ENOENT; - if (bdrv_attach(bs, dev) < 0) + if (bdrv_attach_dev(bs, dev) < 0) return -EEXIST; *ptr = bs; return 0; @@ -323,7 +323,7 @@ static void free_drive(DeviceState *dev, Property *prop) BlockDriverState **ptr = qdev_get_prop_ptr(dev, prop); if (*ptr) { - bdrv_detach(*ptr, dev); + bdrv_detach_dev(*ptr, dev); blockdev_auto_del(*ptr); } } @@ -678,7 +678,7 @@ int qdev_prop_set_drive(DeviceState *dev, const char *name, BlockDriverState *va { int res; - res = bdrv_attach(value, dev); + res = bdrv_attach_dev(value, dev); if (res < 0) { error_report("Can't attach drive %s to %s.%s: %s", bdrv_get_device_name(value), |