mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
qom: Add object_get_container()
Add a helper to fetch a root container (under object_get_root()). Sanity check on the type of the object. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-ID: <20241121192202.4155849-12-peterx@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
1c34335844
commit
180e8f16f0
2 changed files with 20 additions and 0 deletions
10
qom/object.c
10
qom/object.c
|
@ -1751,6 +1751,16 @@ static Object *object_root_initialize(void)
|
|||
return root;
|
||||
}
|
||||
|
||||
Object *object_get_container(const char *name)
|
||||
{
|
||||
Object *container;
|
||||
|
||||
container = object_resolve_path_component(object_get_root(), name);
|
||||
assert(object_dynamic_cast(container, TYPE_CONTAINER));
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
Object *object_get_root(void)
|
||||
{
|
||||
static Object *root;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue