This series is not for 9.2, but for 10.0.
v1: https://lore.kernel.org/r/20241120215703.3918445-1-peterx@redhat.com
v2 changelog:
- Rename container_create() to object_property_add_new_container() [Markus]
- Drop "ui/console: Explicitly create "/backend" container", instead create
"/backend" container along with the rest root containers [Dan]
- Assert in qdev_get_machine() instead of allowing return NULL [Dan]
- machine_get_container(), remove assert, and tiny doc fix [Dan, Markus]
- Make machine_containers[] "const char *const" [Phil]
- Create ppc drc container in drc device class_init [Phil]
- Split the last patch into three [Phil, Dan]
In general, container_get() is a flaky interface in a few things. Firstly,
some of the users use it without getting a container object. Secondly, it
can implicitly create containers on the fly.
The series is about container_get() and its removal. After the whole
series applied, all the system containers will be created explicitly.
Meanwhile no lookup code will implicitly create container anymore.
As Dan (mostly) pointed out, we don't have a super complicated container
layout. It looks like this:
/objects
/chardevs
/backend
/dr-connector (ppc only)
/machine
/peripheral
/peripheral-anon
/unattached
This series create these containers explicitly.
There's a side benefit of dropping container_get(), which is to avoid
complicated string operations, as container_get() is never used in more
than one depth. It means switching to object_resolve_path_component()
should make existing code even tiny little faster.
To achieve this, some test needs to be fixed first. For that, see "tests:
Fix test-qdev-global-props on anonymous qdev realize()".
Comments welcomed, thanks.
Peter Xu (13):
qom: Add TYPE_CONTAINER macro
qom: New object_property_add_new_container()
tests: Fix test-qdev-global-props on anonymous qdev realize()
tests: Explicitly create containers in test_qom_partial_path()
ppc/e500: Avoid abuse of container_get()
hw/ppc: Explicitly create the drc container
qom: Create system containers explicitly
qdev: Make qdev_get_machine() not use container_get()
qdev: Add machine_get_container()
qom: Use machine_get_container()
qom: Add object_get_container()
qom: Use object_get_container()
qom: Remove container_get()
include/hw/qdev-core.h | 10 ++++++++
include/qom/object.h | 26 ++++++++++++++------
backends/cryptodev.c | 4 +--
chardev/char.c | 2 +-
hw/arm/stellaris.c | 2 +-
hw/core/gpio.c | 3 +--
hw/core/machine.c | 3 ---
hw/core/qdev.c | 21 +++++++++++++---
hw/core/sysbus.c | 4 +--
hw/i386/pc.c | 4 +--
hw/pci-host/ppce500.c | 4 +--
hw/ppc/spapr_drc.c | 29 ++++++++++++++--------
qom/container.c | 27 +++++---------------
qom/object.c | 38 ++++++++++++++++++++++++++---
scsi/pr-manager.c | 4 +--
system/ioport.c | 2 +-
system/memory.c | 2 +-
system/qdev-monitor.c | 6 ++---
system/vl.c | 19 +++++++++++++--
tests/unit/check-qom-proplist.c | 2 +-
tests/unit/test-qdev-global-props.c | 22 +++++++++++++++++
ui/console.c | 2 +-
ui/dbus-chardev.c | 2 +-
23 files changed, 167 insertions(+), 71 deletions(-)
--
2.45.0