[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/12] include: attempt to document device_class_set_props
From: |
Alex Bennée |
Subject: |
[PATCH 07/12] include: attempt to document device_class_set_props |
Date: |
Fri, 14 Apr 2023 17:04:28 +0100 |
I'm still not sure how I achieve by use case of the parent class
defining the following properties:
static Property vud_properties[] = {
DEFINE_PROP_CHR("chardev", VHostUserDevice, chardev),
DEFINE_PROP_UINT16("id", VHostUserDevice, id, 0),
DEFINE_PROP_UINT32("num_vqs", VHostUserDevice, num_vqs, 1),
DEFINE_PROP_END_OF_LIST(),
};
But for the specialisation of the class I want the id to default to
the actual device id, e.g.:
static Property vu_rng_properties[] = {
DEFINE_PROP_UINT16("id", VHostUserDevice, id, VIRTIO_ID_RNG),
DEFINE_PROP_UINT32("num_vqs", VHostUserDevice, num_vqs, 1),
DEFINE_PROP_END_OF_LIST(),
};
And so far the API for doing that isn't super clear.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
include/hw/qdev-core.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index bd50ad5ee1..d4bbc30c92 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -776,6 +776,15 @@ BusState *sysbus_get_default(void);
char *qdev_get_fw_dev_path(DeviceState *dev);
char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev);
+/**
+ * device_class_set_props(): add a set of properties to an device
+ * @dc: the parent DeviceClass all devices inherit
+ * @props: an array of properties, terminate by DEFINE_PROP_END_OF_LIST()
+ *
+ * This will add a set of properties to the object. It will fault if
+ * you attempt to add an existing property defined by a parent class.
+ * To modify an inherited property you need to use????
+ */
void device_class_set_props(DeviceClass *dc, Property *props);
/**
--
2.39.2
- [PATCH 12/12] docs/system: add a basic enumeration of vhost-user devices, (continued)
- [PATCH 12/12] docs/system: add a basic enumeration of vhost-user devices, Alex Bennée, 2023/04/14
- [PATCH 11/12] hw/virtio: derive vhost-user-gpio from vhost-user-device (!BROKEN), Alex Bennée, 2023/04/14
- [PATCH 05/12] virtio: add generic vhost-user-device, Alex Bennée, 2023/04/14
- [PATCH 09/12] hw/virtio: derive vhost-user-rng from vhost-user-device, Alex Bennée, 2023/04/14
- [PATCH 04/12] include/hw/virtio: document some more usage of notifiers, Alex Bennée, 2023/04/14
- [PATCH 10/12] hw/virtio: add config support to vhost-user-device, Alex Bennée, 2023/04/14
- [PATCH 08/12] qom: allow for properties to become "fixed", Alex Bennée, 2023/04/14
- [PATCH 07/12] include: attempt to document device_class_set_props,
Alex Bennée <=
- Re: [PATCH 00/12] virtio: add vhost-user-generic and reduce copy and paste, Viresh Kumar, 2023/04/17
- Re: [PATCH 00/12] virtio: add vhost-user-generic and reduce copy and paste, Stefan Hajnoczi, 2023/04/17