mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
qdev: Add machine_get_container()
Add a helper to fetch machine containers. Add some sanity check around. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Peter Xu <peterx@redhat.com> Message-ID: <20241121192202.4155849-10-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
63450f322b
commit
41fc917728
2 changed files with 21 additions and 0 deletions
|
@ -828,6 +828,17 @@ Object *qdev_get_machine(void)
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object *machine_get_container(const char *name)
|
||||||
|
{
|
||||||
|
Object *container, *machine;
|
||||||
|
|
||||||
|
machine = qdev_get_machine();
|
||||||
|
container = object_resolve_path_component(machine, name);
|
||||||
|
assert(object_dynamic_cast(container, TYPE_CONTAINER));
|
||||||
|
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
char *qdev_get_human_name(DeviceState *dev)
|
char *qdev_get_human_name(DeviceState *dev)
|
||||||
{
|
{
|
||||||
g_assert(dev != NULL);
|
g_assert(dev != NULL);
|
||||||
|
|
|
@ -1033,6 +1033,16 @@ Object *qdev_get_machine(void);
|
||||||
*/
|
*/
|
||||||
void qdev_create_fake_machine(void);
|
void qdev_create_fake_machine(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* machine_get_container:
|
||||||
|
* @name: The name of container to lookup
|
||||||
|
*
|
||||||
|
* Get a container of the machine (QOM path "/machine/NAME").
|
||||||
|
*
|
||||||
|
* Returns: the machine container object.
|
||||||
|
*/
|
||||||
|
Object *machine_get_container(const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qdev_get_human_name() - Return a human-readable name for a device
|
* qdev_get_human_name() - Return a human-readable name for a device
|
||||||
* @dev: The device. Must be a valid and non-NULL pointer.
|
* @dev: The device. Must be a valid and non-NULL pointer.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue