[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/11] qom: Add object_property_set_default_list()
From: |
Kevin Wolf |
Subject: |
[PULL 09/11] qom: Add object_property_set_default_list() |
Date: |
Tue, 7 Nov 2023 14:48:26 +0100 |
This function provides a default for properties that are accessed using
the list visitor interface. The default is always an empty list.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20231030142658.182193-11-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/qom/object.h | 8 ++++++++
qom/object.c | 6 ++++++
2 files changed, 14 insertions(+)
diff --git a/include/qom/object.h b/include/qom/object.h
index ef7258a5e1..afccd24ca7 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1093,6 +1093,14 @@ void object_property_set_default_bool(ObjectProperty
*prop, bool value);
*/
void object_property_set_default_str(ObjectProperty *prop, const char *value);
+/**
+ * object_property_set_default_list:
+ * @prop: the property to set
+ *
+ * Set the property default value to be an empty list.
+ */
+void object_property_set_default_list(ObjectProperty *prop);
+
/**
* object_property_set_default_int:
* @prop: the property to set
diff --git a/qom/object.c b/qom/object.c
index 8557fe8e4e..95c0dc8285 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -31,6 +31,7 @@
* of the QOM core on QObject? */
#include "qom/qom-qobject.h"
#include "qapi/qmp/qbool.h"
+#include "qapi/qmp/qlist.h"
#include "qapi/qmp/qnum.h"
#include "qapi/qmp/qstring.h"
#include "qemu/error-report.h"
@@ -1588,6 +1589,11 @@ void object_property_set_default_str(ObjectProperty
*prop, const char *value)
object_property_set_default(prop, QOBJECT(qstring_from_str(value)));
}
+void object_property_set_default_list(ObjectProperty *prop)
+{
+ object_property_set_default(prop, QOBJECT(qlist_new()));
+}
+
void object_property_set_default_int(ObjectProperty *prop, int64_t value)
{
object_property_set_default(prop, QOBJECT(qnum_from_int(value)));
--
2.41.0
- [PULL 00/11] qdev: Make array properties user accessible again, Kevin Wolf, 2023/11/07
- [PULL 02/11] hw/arm/mps2-tz: Use qdev_prop_set_array(), Kevin Wolf, 2023/11/07
- [PULL 06/11] hw/arm/virt: Use qdev_prop_set_array(), Kevin Wolf, 2023/11/07
- [PULL 03/11] hw/arm/mps2: Use qdev_prop_set_array(), Kevin Wolf, 2023/11/07
- [PULL 07/11] hw/arm/xlnx-versal: Use qdev_prop_set_array(), Kevin Wolf, 2023/11/07
- [PULL 11/11] qdev: Rework array properties based on list visitor, Kevin Wolf, 2023/11/07
- [PULL 04/11] hw/arm/sbsa-ref: Use qdev_prop_set_array(), Kevin Wolf, 2023/11/07
- [PULL 08/11] hw/rx/rx62n: Use qdev_prop_set_array(), Kevin Wolf, 2023/11/07
- [PULL 09/11] qom: Add object_property_set_default_list(),
Kevin Wolf <=
- [PULL 10/11] qdev: Make netdev properties work as list elements, Kevin Wolf, 2023/11/07
- [PULL 01/11] hw/i386/pc: Use qdev_prop_set_array(), Kevin Wolf, 2023/11/07
- [PULL 05/11] hw/arm/vexpress: Use qdev_prop_set_array(), Kevin Wolf, 2023/11/07
- Re: [PULL 00/11] qdev: Make array properties user accessible again, Stefan Hajnoczi, 2023/11/07