[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 0/2] qapi/qom: use correct field name when getting/setting al
Re: [PATCH 0/2] qapi/qom: use correct field name when getting/setting alias properties
Tue, 20 Jul 2021 17:54:33 +0200
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Running out of time for today, so I'm sending what I have, with real
review to follow.
First, let me describe what's wrong in my own words, because that's how
I understand stuff.
Reproducer (hidden behind the link to the bug tracker):
$ qemu-system-x86_64 \
The -machine gets (keyval-)parsed into a QDict, which is then processed
by object_set_properties_from_qdict() with the (keyval) QObject input
visitor. Makes sense.
object_set_properties_from_qdict() performs a virtual struct visit
guided by the QDict's keys. It calls object_property_set() for each
For "pflash0", this calls object_property_set(obj, "pflash0", v, &err).
Since "pflash0" is a QOM alias property, this in turn calls
object_property_set(prop->target_obj, "drive0", v, &err), where prop is
the alias property, and prop->target_obj is the "cfi.pflash01" device.
Since "drive" is a drive property, this calls set_drive(), which calls
visit_type_str(v, "drive", &str, errp). Fails, because the QDict
wrapped in visitor @v does not have a "drive" member, it has a "pflash0"
Next, the solution. I get the idea of a wrapper visitor which gives you
"pflash0" when you ask for "drive", but oh boy do I wish we could fix
the bug with a lot less code.