* [Qemu-devel] [PULL for-2.5 00/10] QOM devices patch queue 2015-11-18
@ 2015-11-18 20:22 Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 01/10] qdev: Change Property::offset field to ptrdiff_t type Andreas Färber
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Andreas Färber @ 2015-11-18 20:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Pavel Fedin, Andreas Färber
Hello Peter,
This is my late QOM (devices) patch queue. Please pull.
Regards,
Andreas
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Daniel P. Berrange <berrange@redhat.com>
Cc: Pavel Fedin <p.fedin@samsung.com>
The following changes since commit 74fcbd22d20a2fbc1a47a7b00cce5bf98fd7be5f:
hw/misc: Add support for ADC controller in Xilinx Zynq 7000 (2015-11-12 21:30:42 +0000)
are available in the git repository at:
git://github.com/afaerber/qemu-cpu.git tags/qom-devices-for-peter
for you to fetch changes up to c5760450796433621ccdc125866a84b892e2d5b6:
MAINTAINERS: Add check-qom-{interface,proplist} to QOM (2015-11-18 21:13:50 +0100)
----------------------------------------------------------------
QOM infrastructure fixes and device conversions
* Fix for properties on objects > 4 GiB
* Performance improvements for QOM property handling
* Assertion cleanups
* MAINTAINERS additions
----------------------------------------------------------------
Andreas Färber (2):
qom: Clean up assertions to display values on failure
MAINTAINERS: Add check-qom-{interface,proplist} to QOM
Daniel P. Berrange (6):
qom: Introduce ObjectPropertyIterator struct for iteration
qmp: Convert QMP code to use object property iterators
vl: Convert machine help code to use object property iterators
ppc: Convert spapr code to use object property iterators
net: Convert net filter code to use object property iterators
qom: Add a test case for complex property finalization
Ildar Isaev (1):
qdev: Change Property::offset field to ptrdiff_t type
Pavel Fedin (1):
qom: Replace object property list with GHashTable
MAINTAINERS | 2 +
hw/ppc/spapr_drc.c | 5 +-
include/hw/qdev-core.h | 2 +-
include/qom/object.h | 59 ++++++++++++-
net/filter.c | 5 +-
qmp.c | 10 ++-
qom/object.c | 148 ++++++++++++++++++++++----------
tests/check-qom-proplist.c | 205 +++++++++++++++++++++++++++++++++++++++++++++
vl.c | 5 +-
9 files changed, 388 insertions(+), 53 deletions(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 01/10] qdev: Change Property::offset field to ptrdiff_t type
2015-11-18 20:22 [Qemu-devel] [PULL for-2.5 00/10] QOM devices patch queue 2015-11-18 Andreas Färber
@ 2015-11-18 20:22 ` Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration Andreas Färber
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Andreas Färber @ 2015-11-18 20:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Ildar Isaev, Andreas Färber
From: Ildar Isaev <ild@inbox.ru>
Property::offset field is calculated as a diff between two pointers:
arrayprop->prop.offset = eltptr - (void *)dev;
If offset is declared as int, this subtraction can cause type overflow,
thus leading to failure of the subsequent assertion:
assert(qdev_get_prop_ptr(dev, &arrayprop->prop) == eltptr);
So ptrdiff_t should be used instead.
Signed-off-by: Ildar Isaev <ild@inbox.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
include/hw/qdev-core.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index e6dbde4..c537969 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -237,7 +237,7 @@ struct BusState {
struct Property {
const char *name;
PropertyInfo *info;
- int offset;
+ ptrdiff_t offset;
uint8_t bitnr;
qtype_code qtype;
int64_t defval;
--
2.6.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration
2015-11-18 20:22 [Qemu-devel] [PULL for-2.5 00/10] QOM devices patch queue 2015-11-18 Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 01/10] qdev: Change Property::offset field to ptrdiff_t type Andreas Färber
@ 2015-11-18 20:22 ` Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 03/10] qmp: Convert QMP code to use object property iterators Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 04/10] vl: Convert machine help " Andreas Färber
3 siblings, 0 replies; 11+ messages in thread
From: Andreas Färber @ 2015-11-18 20:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Andreas Färber
From: "Daniel P. Berrange" <berrange@redhat.com>
Some users of QOM need to be able to iterate over properties
defined against an object instance. Currently they are just
directly using the QTAIL macros against the object properties
data structure.
This is bad because it exposes them to changes in the data
structure used to store properties, as well as changes in
functionality such as ability to register properties against
the class.
This provides an ObjectPropertyIterator struct which will
insulate the callers from the particular data structure
used to store properties. It can be used thus
ObjectProperty *prop;
ObjectPropertyIterator *iter;
iter = object_property_iter_init(obj);
while ((prop = object_property_iter_next(iter))) {
... do something with prop ...
}
object_property_iter_free(iter);
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
[AF: Fixed examples, style cleanups]
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
include/qom/object.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++
qom/object.c | 28 ++++++++++++++++++++++++++
tests/check-qom-proplist.c | 46 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 123 insertions(+)
diff --git a/include/qom/object.h b/include/qom/object.h
index 0bb89d4..9f70314 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -960,6 +960,55 @@ void object_property_del(Object *obj, const char *name, Error **errp);
ObjectProperty *object_property_find(Object *obj, const char *name,
Error **errp);
+typedef struct ObjectPropertyIterator ObjectPropertyIterator;
+
+/**
+ * object_property_iter_init:
+ * @obj: the object
+ *
+ * Initializes an iterator for traversing all properties
+ * registered against an object instance.
+ *
+ * It is forbidden to modify the property list while iterating,
+ * whether removing or adding properties.
+ *
+ * Typical usage pattern would be
+ *
+ * <example>
+ * <title>Using object property iterators</title>
+ * <programlisting>
+ * ObjectProperty *prop;
+ * ObjectPropertyIterator *iter;
+ *
+ * iter = object_property_iter_init(obj);
+ * while ((prop = object_property_iter_next(iter))) {
+ * ... do something with prop ...
+ * }
+ * object_property_iter_free(iter);
+ * </programlisting>
+ * </example>
+ *
+ * Returns: the new iterator
+ */
+ObjectPropertyIterator *object_property_iter_init(Object *obj);
+
+/**
+ * object_property_iter_free:
+ * @iter: the iterator instance
+ *
+ * Releases any resources associated with the iterator.
+ */
+void object_property_iter_free(ObjectPropertyIterator *iter);
+
+/**
+ * object_property_iter_next:
+ * @iter: the iterator instance
+ *
+ * Returns: the next property, or %NULL when all properties
+ * have been traversed.
+ */
+ObjectProperty *object_property_iter_next(ObjectPropertyIterator *iter);
+
void object_unparent(Object *obj);
/**
diff --git a/qom/object.c b/qom/object.c
index c0decb6..1c926ce 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -67,6 +67,10 @@ struct TypeImpl
InterfaceImpl interfaces[MAX_INTERFACES];
};
+struct ObjectPropertyIterator {
+ ObjectProperty *next;
+};
+
static Type type_interface;
static GHashTable *type_table_get(void)
@@ -917,6 +921,30 @@ ObjectProperty *object_property_find(Object *obj, const char *name,
return NULL;
}
+ObjectPropertyIterator *object_property_iter_init(Object *obj)
+{
+ ObjectPropertyIterator *ret = g_new0(ObjectPropertyIterator, 1);
+ ret->next = QTAILQ_FIRST(&obj->properties);
+ return ret;
+}
+
+void object_property_iter_free(ObjectPropertyIterator *iter)
+{
+ if (!iter) {
+ return;
+ }
+ g_free(iter);
+}
+
+ObjectProperty *object_property_iter_next(ObjectPropertyIterator *iter)
+{
+ ObjectProperty *ret = iter->next;
+ if (ret) {
+ iter->next = QTAILQ_NEXT(iter->next, node);
+ }
+ return ret;
+}
+
void object_property_del(Object *obj, const char *name, Error **errp)
{
ObjectProperty *prop = object_property_find(obj, name, errp);
diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
index 7400b1f..1be8b9e 100644
--- a/tests/check-qom-proplist.c
+++ b/tests/check-qom-proplist.c
@@ -283,6 +283,51 @@ static void test_dummy_getenum(void)
&err);
g_assert(err != NULL);
error_free(err);
+
+ object_unparent(OBJECT(dobj));
+}
+
+
+static void test_dummy_iterator(void)
+{
+ Object *parent = object_get_objects_root();
+ DummyObject *dobj = DUMMY_OBJECT(
+ object_new_with_props(TYPE_DUMMY,
+ parent,
+ "dummy0",
+ &error_abort,
+ "bv", "yes",
+ "sv", "Hiss hiss hiss",
+ "av", "platypus",
+ NULL));
+
+ ObjectProperty *prop;
+ ObjectPropertyIterator *iter;
+ bool seenbv = false, seensv = false, seenav = false, seentype;
+
+ iter = object_property_iter_init(OBJECT(dobj));
+ while ((prop = object_property_iter_next(iter))) {
+ if (g_str_equal(prop->name, "bv")) {
+ seenbv = true;
+ } else if (g_str_equal(prop->name, "sv")) {
+ seensv = true;
+ } else if (g_str_equal(prop->name, "av")) {
+ seenav = true;
+ } else if (g_str_equal(prop->name, "type")) {
+ /* This prop comes from the base Object class */
+ seentype = true;
+ } else {
+ g_printerr("Found prop '%s'\n", prop->name);
+ g_assert_not_reached();
+ }
+ }
+ object_property_iter_free(iter);
+ g_assert(seenbv);
+ g_assert(seenav);
+ g_assert(seensv);
+ g_assert(seentype);
+
+ object_unparent(OBJECT(dobj));
}
@@ -297,6 +342,7 @@ int main(int argc, char **argv)
g_test_add_func("/qom/proplist/createv", test_dummy_createv);
g_test_add_func("/qom/proplist/badenum", test_dummy_badenum);
g_test_add_func("/qom/proplist/getenum", test_dummy_getenum);
+ g_test_add_func("/qom/proplist/iterator", test_dummy_iterator);
return g_test_run();
}
--
2.6.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 03/10] qmp: Convert QMP code to use object property iterators
2015-11-18 20:22 [Qemu-devel] [PULL for-2.5 00/10] QOM devices patch queue 2015-11-18 Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 01/10] qdev: Change Property::offset field to ptrdiff_t type Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration Andreas Färber
@ 2015-11-18 20:22 ` Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 04/10] vl: Convert machine help " Andreas Färber
3 siblings, 0 replies; 11+ messages in thread
From: Andreas Färber @ 2015-11-18 20:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Andreas Färber, Markus Armbruster
From: "Daniel P. Berrange" <berrange@redhat.com>
Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
qmp.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/qmp.c b/qmp.c
index ddc63ea..0a1fa19 100644
--- a/qmp.c
+++ b/qmp.c
@@ -210,6 +210,7 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
bool ambiguous = false;
ObjectPropertyInfoList *props = NULL;
ObjectProperty *prop;
+ ObjectPropertyIterator *iter;
obj = object_resolve_path(path, &ambiguous);
if (obj == NULL) {
@@ -222,7 +223,8 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
return NULL;
}
- QTAILQ_FOREACH(prop, &obj->properties, node) {
+ iter = object_property_iter_init(obj);
+ while ((prop = object_property_iter_next(iter))) {
ObjectPropertyInfoList *entry = g_malloc0(sizeof(*entry));
entry->value = g_malloc0(sizeof(ObjectPropertyInfo));
@@ -232,6 +234,7 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
entry->value->name = g_strdup(prop->name);
entry->value->type = g_strdup(prop->type);
}
+ object_property_iter_free(iter);
return props;
}
@@ -503,6 +506,7 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
ObjectClass *klass;
Object *obj;
ObjectProperty *prop;
+ ObjectPropertyIterator *iter;
DevicePropertyInfoList *prop_list = NULL;
klass = object_class_by_name(typename);
@@ -531,7 +535,8 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
obj = object_new(typename);
- QTAILQ_FOREACH(prop, &obj->properties, node) {
+ iter = object_property_iter_init(obj);
+ while ((prop = object_property_iter_next(iter))) {
DevicePropertyInfo *info;
DevicePropertyInfoList *entry;
@@ -562,6 +567,7 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
entry->next = prop_list;
prop_list = entry;
}
+ object_property_iter_free(iter);
object_unref(obj);
--
2.6.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 04/10] vl: Convert machine help code to use object property iterators
2015-11-18 20:22 [Qemu-devel] [PULL for-2.5 00/10] QOM devices patch queue 2015-11-18 Andreas Färber
` (2 preceding siblings ...)
2015-11-18 20:22 ` [Qemu-devel] [PULL 03/10] qmp: Convert QMP code to use object property iterators Andreas Färber
@ 2015-11-18 20:22 ` Andreas Färber
3 siblings, 0 replies; 11+ messages in thread
From: Andreas Färber @ 2015-11-18 20:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber
From: "Daniel P. Berrange" <berrange@redhat.com>
Stop directly accessing the Object::properties field data
structure and instead use the formal object property iterator
APIs. This insulates the code from future data structure
changes in the Object struct.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
vl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/vl.c b/vl.c
index 7d993a5..4211ff1 100644
--- a/vl.c
+++ b/vl.c
@@ -1536,12 +1536,14 @@ MachineInfoList *qmp_query_machines(Error **errp)
static int machine_help_func(QemuOpts *opts, MachineState *machine)
{
ObjectProperty *prop;
+ ObjectPropertyIterator *iter;
if (!qemu_opt_has_help_opt(opts)) {
return 0;
}
- QTAILQ_FOREACH(prop, &OBJECT(machine)->properties, node) {
+ iter = object_property_iter_init(OBJECT(machine));
+ while ((prop = object_property_iter_next(iter))) {
if (!prop->set) {
continue;
}
@@ -1554,6 +1556,7 @@ static int machine_help_func(QemuOpts *opts, MachineState *machine)
error_printf("\n");
}
}
+ object_property_iter_free(iter);
return 1;
}
--
2.6.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration
2015-11-18 20:39 [Qemu-devel] [PULL for-2.5 00/10] QOM devices patch queue 2015-11-18 Andreas Färber
@ 2015-11-18 20:39 ` Andreas Färber
2015-11-19 9:20 ` Markus Armbruster
0 siblings, 1 reply; 11+ messages in thread
From: Andreas Färber @ 2015-11-18 20:39 UTC (permalink / raw)
To: qemu-devel; +Cc: Andreas Färber
From: "Daniel P. Berrange" <berrange@redhat.com>
Some users of QOM need to be able to iterate over properties
defined against an object instance. Currently they are just
directly using the QTAIL macros against the object properties
data structure.
This is bad because it exposes them to changes in the data
structure used to store properties, as well as changes in
functionality such as ability to register properties against
the class.
This provides an ObjectPropertyIterator struct which will
insulate the callers from the particular data structure
used to store properties. It can be used thus
ObjectProperty *prop;
ObjectPropertyIterator *iter;
iter = object_property_iter_init(obj);
while ((prop = object_property_iter_next(iter))) {
... do something with prop ...
}
object_property_iter_free(iter);
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
[AF: Fixed examples, style cleanups]
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
include/qom/object.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++
qom/object.c | 28 ++++++++++++++++++++++++++
tests/check-qom-proplist.c | 46 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 123 insertions(+)
diff --git a/include/qom/object.h b/include/qom/object.h
index 0bb89d4..9f70314 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -960,6 +960,55 @@ void object_property_del(Object *obj, const char *name, Error **errp);
ObjectProperty *object_property_find(Object *obj, const char *name,
Error **errp);
+typedef struct ObjectPropertyIterator ObjectPropertyIterator;
+
+/**
+ * object_property_iter_init:
+ * @obj: the object
+ *
+ * Initializes an iterator for traversing all properties
+ * registered against an object instance.
+ *
+ * It is forbidden to modify the property list while iterating,
+ * whether removing or adding properties.
+ *
+ * Typical usage pattern would be
+ *
+ * <example>
+ * <title>Using object property iterators</title>
+ * <programlisting>
+ * ObjectProperty *prop;
+ * ObjectPropertyIterator *iter;
+ *
+ * iter = object_property_iter_init(obj);
+ * while ((prop = object_property_iter_next(iter))) {
+ * ... do something with prop ...
+ * }
+ * object_property_iter_free(iter);
+ * </programlisting>
+ * </example>
+ *
+ * Returns: the new iterator
+ */
+ObjectPropertyIterator *object_property_iter_init(Object *obj);
+
+/**
+ * object_property_iter_free:
+ * @iter: the iterator instance
+ *
+ * Releases any resources associated with the iterator.
+ */
+void object_property_iter_free(ObjectPropertyIterator *iter);
+
+/**
+ * object_property_iter_next:
+ * @iter: the iterator instance
+ *
+ * Returns: the next property, or %NULL when all properties
+ * have been traversed.
+ */
+ObjectProperty *object_property_iter_next(ObjectPropertyIterator *iter);
+
void object_unparent(Object *obj);
/**
diff --git a/qom/object.c b/qom/object.c
index c0decb6..1c926ce 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -67,6 +67,10 @@ struct TypeImpl
InterfaceImpl interfaces[MAX_INTERFACES];
};
+struct ObjectPropertyIterator {
+ ObjectProperty *next;
+};
+
static Type type_interface;
static GHashTable *type_table_get(void)
@@ -917,6 +921,30 @@ ObjectProperty *object_property_find(Object *obj, const char *name,
return NULL;
}
+ObjectPropertyIterator *object_property_iter_init(Object *obj)
+{
+ ObjectPropertyIterator *ret = g_new0(ObjectPropertyIterator, 1);
+ ret->next = QTAILQ_FIRST(&obj->properties);
+ return ret;
+}
+
+void object_property_iter_free(ObjectPropertyIterator *iter)
+{
+ if (!iter) {
+ return;
+ }
+ g_free(iter);
+}
+
+ObjectProperty *object_property_iter_next(ObjectPropertyIterator *iter)
+{
+ ObjectProperty *ret = iter->next;
+ if (ret) {
+ iter->next = QTAILQ_NEXT(iter->next, node);
+ }
+ return ret;
+}
+
void object_property_del(Object *obj, const char *name, Error **errp)
{
ObjectProperty *prop = object_property_find(obj, name, errp);
diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
index 7400b1f..1be8b9e 100644
--- a/tests/check-qom-proplist.c
+++ b/tests/check-qom-proplist.c
@@ -283,6 +283,51 @@ static void test_dummy_getenum(void)
&err);
g_assert(err != NULL);
error_free(err);
+
+ object_unparent(OBJECT(dobj));
+}
+
+
+static void test_dummy_iterator(void)
+{
+ Object *parent = object_get_objects_root();
+ DummyObject *dobj = DUMMY_OBJECT(
+ object_new_with_props(TYPE_DUMMY,
+ parent,
+ "dummy0",
+ &error_abort,
+ "bv", "yes",
+ "sv", "Hiss hiss hiss",
+ "av", "platypus",
+ NULL));
+
+ ObjectProperty *prop;
+ ObjectPropertyIterator *iter;
+ bool seenbv = false, seensv = false, seenav = false, seentype;
+
+ iter = object_property_iter_init(OBJECT(dobj));
+ while ((prop = object_property_iter_next(iter))) {
+ if (g_str_equal(prop->name, "bv")) {
+ seenbv = true;
+ } else if (g_str_equal(prop->name, "sv")) {
+ seensv = true;
+ } else if (g_str_equal(prop->name, "av")) {
+ seenav = true;
+ } else if (g_str_equal(prop->name, "type")) {
+ /* This prop comes from the base Object class */
+ seentype = true;
+ } else {
+ g_printerr("Found prop '%s'\n", prop->name);
+ g_assert_not_reached();
+ }
+ }
+ object_property_iter_free(iter);
+ g_assert(seenbv);
+ g_assert(seenav);
+ g_assert(seensv);
+ g_assert(seentype);
+
+ object_unparent(OBJECT(dobj));
}
@@ -297,6 +342,7 @@ int main(int argc, char **argv)
g_test_add_func("/qom/proplist/createv", test_dummy_createv);
g_test_add_func("/qom/proplist/badenum", test_dummy_badenum);
g_test_add_func("/qom/proplist/getenum", test_dummy_getenum);
+ g_test_add_func("/qom/proplist/iterator", test_dummy_iterator);
return g_test_run();
}
--
2.6.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration
2015-11-18 20:39 ` [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration Andreas Färber
@ 2015-11-19 9:20 ` Markus Armbruster
2015-11-19 9:25 ` Daniel P. Berrange
2015-11-19 10:24 ` Andreas Färber
0 siblings, 2 replies; 11+ messages in thread
From: Markus Armbruster @ 2015-11-19 9:20 UTC (permalink / raw)
To: Andreas Färber; +Cc: qemu-devel
Andreas Färber <afaerber@suse.de> writes:
> From: "Daniel P. Berrange" <berrange@redhat.com>
>
> Some users of QOM need to be able to iterate over properties
> defined against an object instance. Currently they are just
> directly using the QTAIL macros against the object properties
> data structure.
>
> This is bad because it exposes them to changes in the data
> structure used to store properties, as well as changes in
> functionality such as ability to register properties against
> the class.
>
> This provides an ObjectPropertyIterator struct which will
> insulate the callers from the particular data structure
> used to store properties. It can be used thus
>
> ObjectProperty *prop;
> ObjectPropertyIterator *iter;
>
> iter = object_property_iter_init(obj);
> while ((prop = object_property_iter_next(iter))) {
> ... do something with prop ...
> }
> object_property_iter_free(iter);
I see my review hasn't been addressed, probably because it came late.
Would you accept a follow-up patch to bring the iterator into line with
existing ones?
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> Tested-by: Pavel Fedin <p.fedin@samsung.com>
> [AF: Fixed examples, style cleanups]
> Signed-off-by: Andreas Färber <afaerber@suse.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration
2015-11-19 9:20 ` Markus Armbruster
@ 2015-11-19 9:25 ` Daniel P. Berrange
2015-11-19 9:49 ` Markus Armbruster
2015-11-19 10:24 ` Andreas Färber
1 sibling, 1 reply; 11+ messages in thread
From: Daniel P. Berrange @ 2015-11-19 9:25 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Andreas Färber, qemu-devel
On Thu, Nov 19, 2015 at 10:20:22AM +0100, Markus Armbruster wrote:
> Andreas Färber <afaerber@suse.de> writes:
>
> > From: "Daniel P. Berrange" <berrange@redhat.com>
> >
> > Some users of QOM need to be able to iterate over properties
> > defined against an object instance. Currently they are just
> > directly using the QTAIL macros against the object properties
> > data structure.
> >
> > This is bad because it exposes them to changes in the data
> > structure used to store properties, as well as changes in
> > functionality such as ability to register properties against
> > the class.
> >
> > This provides an ObjectPropertyIterator struct which will
> > insulate the callers from the particular data structure
> > used to store properties. It can be used thus
> >
> > ObjectProperty *prop;
> > ObjectPropertyIterator *iter;
> >
> > iter = object_property_iter_init(obj);
> > while ((prop = object_property_iter_next(iter))) {
> > ... do something with prop ...
> > }
> > object_property_iter_free(iter);
>
> I see my review hasn't been addressed, probably because it came late.
> Would you accept a follow-up patch to bring the iterator into line with
> existing ones?
I'll write such a patch if you like, but i guess waiting for it to merge
till 2.6 is no big deal ?
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration
2015-11-19 9:25 ` Daniel P. Berrange
@ 2015-11-19 9:49 ` Markus Armbruster
0 siblings, 0 replies; 11+ messages in thread
From: Markus Armbruster @ 2015-11-19 9:49 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: Andreas Färber, qemu-devel
"Daniel P. Berrange" <berrange@redhat.com> writes:
> On Thu, Nov 19, 2015 at 10:20:22AM +0100, Markus Armbruster wrote:
>> Andreas Färber <afaerber@suse.de> writes:
>>
>> > From: "Daniel P. Berrange" <berrange@redhat.com>
>> >
>> > Some users of QOM need to be able to iterate over properties
>> > defined against an object instance. Currently they are just
>> > directly using the QTAIL macros against the object properties
>> > data structure.
>> >
>> > This is bad because it exposes them to changes in the data
>> > structure used to store properties, as well as changes in
>> > functionality such as ability to register properties against
>> > the class.
>> >
>> > This provides an ObjectPropertyIterator struct which will
>> > insulate the callers from the particular data structure
>> > used to store properties. It can be used thus
>> >
>> > ObjectProperty *prop;
>> > ObjectPropertyIterator *iter;
>> >
>> > iter = object_property_iter_init(obj);
>> > while ((prop = object_property_iter_next(iter))) {
>> > ... do something with prop ...
>> > }
>> > object_property_iter_free(iter);
>>
>> I see my review hasn't been addressed, probably because it came late.
>> Would you accept a follow-up patch to bring the iterator into line with
>> existing ones?
>
> I'll write such a patch if you like, but i guess waiting for it to merge
> till 2.6 is no big deal ?
Not even a little deal :)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration
2015-11-19 9:20 ` Markus Armbruster
2015-11-19 9:25 ` Daniel P. Berrange
@ 2015-11-19 10:24 ` Andreas Färber
2015-11-19 13:42 ` Markus Armbruster
1 sibling, 1 reply; 11+ messages in thread
From: Andreas Färber @ 2015-11-19 10:24 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel
Am 19.11.2015 um 10:20 schrieb Markus Armbruster:
> Andreas Färber <afaerber@suse.de> writes:
>
>> From: "Daniel P. Berrange" <berrange@redhat.com>
>>
>> Some users of QOM need to be able to iterate over properties
>> defined against an object instance. Currently they are just
>> directly using the QTAIL macros against the object properties
>> data structure.
>>
>> This is bad because it exposes them to changes in the data
>> structure used to store properties, as well as changes in
>> functionality such as ability to register properties against
>> the class.
>>
>> This provides an ObjectPropertyIterator struct which will
>> insulate the callers from the particular data structure
>> used to store properties. It can be used thus
>>
>> ObjectProperty *prop;
>> ObjectPropertyIterator *iter;
>>
>> iter = object_property_iter_init(obj);
>> while ((prop = object_property_iter_next(iter))) {
>> ... do something with prop ...
>> }
>> object_property_iter_free(iter);
>
> I see my review hasn't been addressed,
Well, it has, I double-checked that the missing "Iterator" above was
already on my branch, therefore my IRC comment pointing you to qom-next.
> probably because it came late.
Other than that you only seemed to discuss design alternatives, for
which neither you nor Daniel provided any actual patch I could've
applied. While I regularly do style fixups myself, and with the series
missing -rc0 also functional fixes, posting a diff for review/record, I
do not see redesigning a 6-patch series as something I can silently do
last-minute without full respin, for which -rc1 did not leave time.
There was a v3 with iterators, and Pavel pinged v4 twice, I did once
too, and the last delay after getting the series to work was only due to
me inserting Daniel's test case (legit hardfreeze material), so ...
> Would you accept a follow-up patch to bring the iterator into line with
> existing ones?
... yes, from my perspective any such cleanups can be done post-2.5.
Please note that both patch 6/7 (included) and 7/7 (not in this pull)
enhance the iterator, so follow-up patches should be based on qom-next
please.
Thanks,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration
2015-11-19 10:24 ` Andreas Färber
@ 2015-11-19 13:42 ` Markus Armbruster
0 siblings, 0 replies; 11+ messages in thread
From: Markus Armbruster @ 2015-11-19 13:42 UTC (permalink / raw)
To: Andreas Färber; +Cc: qemu-devel
Andreas Färber <afaerber@suse.de> writes:
> Am 19.11.2015 um 10:20 schrieb Markus Armbruster:
>> Andreas Färber <afaerber@suse.de> writes:
>>
>>> From: "Daniel P. Berrange" <berrange@redhat.com>
>>>
>>> Some users of QOM need to be able to iterate over properties
>>> defined against an object instance. Currently they are just
>>> directly using the QTAIL macros against the object properties
>>> data structure.
>>>
>>> This is bad because it exposes them to changes in the data
>>> structure used to store properties, as well as changes in
>>> functionality such as ability to register properties against
>>> the class.
>>>
>>> This provides an ObjectPropertyIterator struct which will
>>> insulate the callers from the particular data structure
>>> used to store properties. It can be used thus
>>>
>>> ObjectProperty *prop;
>>> ObjectPropertyIterator *iter;
>>>
>>> iter = object_property_iter_init(obj);
>>> while ((prop = object_property_iter_next(iter))) {
>>> ... do something with prop ...
>>> }
>>> object_property_iter_free(iter);
>>
>> I see my review hasn't been addressed,
>
> Well, it has, I double-checked that the missing "Iterator" above was
> already on my branch, therefore my IRC comment pointing you to qom-next.
>
>> probably because it came late.
>
> Other than that you only seemed to discuss design alternatives, for
> which neither you nor Daniel provided any actual patch I could've
> applied. While I regularly do style fixups myself, and with the series
> missing -rc0 also functional fixes, posting a diff for review/record, I
> do not see redesigning a 6-patch series as something I can silently do
> last-minute without full respin, for which -rc1 did not leave time.
I certainly didn't expect you to address my review yourself. You
could've replied with a short note asking Dan to address the remainder
of my review in a follow-up patch. But no harm done, because I'm not
shy following up about remainders of my reviews myself.
> There was a v3 with iterators, and Pavel pinged v4 twice, I did once
> too, and the last delay after getting the series to work was only due to
> me inserting Daniel's test case (legit hardfreeze material), so ...
>
>> Would you accept a follow-up patch to bring the iterator into line with
>> existing ones?
>
> ... yes, from my perspective any such cleanups can be done post-2.5.
By now should be done, even.
> Please note that both patch 6/7 (included) and 7/7 (not in this pull)
> enhance the iterator, so follow-up patches should be based on qom-next
> please.
>
> Thanks,
> Andreas
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-11-19 13:42 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-18 20:22 [Qemu-devel] [PULL for-2.5 00/10] QOM devices patch queue 2015-11-18 Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 01/10] qdev: Change Property::offset field to ptrdiff_t type Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 03/10] qmp: Convert QMP code to use object property iterators Andreas Färber
2015-11-18 20:22 ` [Qemu-devel] [PULL 04/10] vl: Convert machine help " Andreas Färber
-- strict thread matches above, loose matches on Subject: below --
2015-11-18 20:39 [Qemu-devel] [PULL for-2.5 00/10] QOM devices patch queue 2015-11-18 Andreas Färber
2015-11-18 20:39 ` [Qemu-devel] [PULL 02/10] qom: Introduce ObjectPropertyIterator struct for iteration Andreas Färber
2015-11-19 9:20 ` Markus Armbruster
2015-11-19 9:25 ` Daniel P. Berrange
2015-11-19 9:49 ` Markus Armbruster
2015-11-19 10:24 ` Andreas Färber
2015-11-19 13:42 ` Markus Armbruster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).