|
@@ -3,12 +3,14 @@
|
|
|
#include "qapi/error.h"
|
|
|
#include "qapi/qapi-types-misc.h"
|
|
|
#include "qapi/qmp/qerror.h"
|
|
|
+#include "qapi/qmp/qlist.h"
|
|
|
#include "qemu/ctype.h"
|
|
|
#include "qemu/error-report.h"
|
|
|
#include "qapi/visitor.h"
|
|
|
#include "qemu/units.h"
|
|
|
#include "qemu/cutils.h"
|
|
|
#include "qdev-prop-internal.h"
|
|
|
+#include "qom/qom-qobject.h"
|
|
|
|
|
|
void qdev_prop_set_after_realize(DeviceState *dev, const char *name,
|
|
|
Error **errp)
|
|
@@ -739,6 +741,25 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value)
|
|
|
&error_abort);
|
|
|
}
|
|
|
|
|
|
+void qdev_prop_set_array(DeviceState *dev, const char *name, QList *values)
|
|
|
+{
|
|
|
+ const QListEntry *entry;
|
|
|
+ g_autofree char *prop_len = g_strdup_printf("len-%s", name);
|
|
|
+ uint32_t i = 0;
|
|
|
+
|
|
|
+ object_property_set_int(OBJECT(dev), prop_len, qlist_size(values),
|
|
|
+ &error_abort);
|
|
|
+
|
|
|
+ QLIST_FOREACH_ENTRY(values, entry) {
|
|
|
+ g_autofree char *prop_idx = g_strdup_printf("%s[%u]", name, i);
|
|
|
+ object_property_set_qobject(OBJECT(dev), prop_idx, entry->value,
|
|
|
+ &error_abort);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ qobject_unref(values);
|
|
|
+}
|
|
|
+
|
|
|
static GPtrArray *global_props(void)
|
|
|
{
|
|
|
static GPtrArray *gp;
|