aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-22 11:42:24 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-06-23 16:07:07 +0200
commit934df912966683b942840f67b9d1a07c8cfea102 (patch)
tree17f3e4de0095b30a947992d1b7614981c1aff186 /include
parent9572a787975fa27981cbcea5cecb8f250435dbe6 (diff)
downloadqemu-934df912966683b942840f67b9d1a07c8cfea102.zip
qemu-934df912966683b942840f67b9d1a07c8cfea102.tar.gz
qemu-934df912966683b942840f67b9d1a07c8cfea102.tar.bz2
qdev: Make qdev_prop_set_drive() match the other helpers
qdev_prop_set_drive() can fail. None of the other qdev_prop_set_FOO() can; they abort on error. To clean up this inconsistency, rename qdev_prop_set_drive() to qdev_prop_set_drive_err(), and create a qdev_prop_set_drive() that aborts on error. Coccinelle script to update callers: @ depends on !(file in "hw/core/qdev-properties-system.c")@ expression dev, name, value; symbol error_abort; @@ - qdev_prop_set_drive(dev, name, value, &error_abort); + qdev_prop_set_drive(dev, name, value); @@ expression dev, name, value, errp; @@ - qdev_prop_set_drive(dev, name, value, errp); + qdev_prop_set_drive_err(dev, name, value, errp); Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200622094227.1271650-14-armbru@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/qdev-properties.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index fc0b2f6..49c6cd2 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -233,8 +233,16 @@ extern const PropertyInfo qdev_prop_pcie_link_width;
#define DEFINE_PROP_END_OF_LIST() \
{}
-/* Set properties between creation and init. */
-void *qdev_get_prop_ptr(DeviceState *dev, Property *prop);
+/*
+ * Set properties between creation and realization.
+ */
+void qdev_prop_set_drive_err(DeviceState *dev, const char *name,
+ BlockBackend *value, Error **errp);
+
+/*
+ * Set properties between creation and realization.
+ * @value must be valid. Each property may be set at most once.
+ */
void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value);
void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value);
void qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t value);
@@ -245,11 +253,13 @@ void qdev_prop_set_string(DeviceState *dev, const char *name, const char *value)
void qdev_prop_set_chr(DeviceState *dev, const char *name, Chardev *value);
void qdev_prop_set_netdev(DeviceState *dev, const char *name, NetClientState *value);
void qdev_prop_set_drive(DeviceState *dev, const char *name,
- BlockBackend *value, Error **errp);
+ BlockBackend *value);
void qdev_prop_set_macaddr(DeviceState *dev, const char *name,
const uint8_t *value);
void qdev_prop_set_enum(DeviceState *dev, const char *name, int value);
+void *qdev_get_prop_ptr(DeviceState *dev, Property *prop);
+
void qdev_prop_register_global(GlobalProperty *prop);
const GlobalProperty *qdev_find_global_prop(DeviceState *dev,
const char *name);