[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/59] qom: Add TYPE_CONTAINER macro
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 03/59] qom: Add TYPE_CONTAINER macro |
Date: |
Fri, 20 Dec 2024 17:14:54 +0100 |
From: Peter Xu <peterx@redhat.com>
Provide a macro for the container type across QEMU source tree, rather than
hard code it every time.
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-2-peterx@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/qom/object.h | 1 +
hw/arm/stellaris.c | 2 +-
qom/container.c | 4 ++--
qom/object.c | 4 ++--
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index a201c9712a1..de02e16817c 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -26,6 +26,7 @@ typedef struct InterfaceClass InterfaceClass;
typedef struct InterfaceInfo InterfaceInfo;
#define TYPE_OBJECT "object"
+#define TYPE_CONTAINER "container"
typedef struct ObjectProperty ObjectProperty;
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
index 7fc13d96c9b..e31884b23e9 100644
--- a/hw/arm/stellaris.c
+++ b/hw/arm/stellaris.c
@@ -1053,7 +1053,7 @@ static void stellaris_init(MachineState *ms,
stellaris_board_info *board)
flash_size = (((board->dc0 & 0xffff) + 1) << 1) * 1024;
sram_size = ((board->dc0 >> 18) + 1) * 1024;
- soc_container = object_new("container");
+ soc_container = object_new(TYPE_CONTAINER);
object_property_add_child(OBJECT(ms), "soc", soc_container);
/* Flash programming is done via the SCU, so pretend it is ROM. */
diff --git a/qom/container.c b/qom/container.c
index 455e8410c66..cfec92a9447 100644
--- a/qom/container.c
+++ b/qom/container.c
@@ -15,7 +15,7 @@
#include "qemu/module.h"
static const TypeInfo container_info = {
- .name = "container",
+ .name = TYPE_CONTAINER,
.parent = TYPE_OBJECT,
};
@@ -37,7 +37,7 @@ Object *container_get(Object *root, const char *path)
for (i = 1; parts[i] != NULL; i++, obj = child) {
child = object_resolve_path_component(obj, parts[i]);
if (!child) {
- child = object_new("container");
+ child = object_new(TYPE_CONTAINER);
object_property_add_child(obj, parts[i], child);
object_unref(child);
}
diff --git a/qom/object.c b/qom/object.c
index c7660f9a097..c9f8442b136 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1734,7 +1734,7 @@ Object *object_get_root(void)
static Object *root;
if (!root) {
- root = object_new("container");
+ root = object_new(TYPE_CONTAINER);
}
return root;
@@ -1750,7 +1750,7 @@ Object *object_get_internal_root(void)
static Object *internal_root;
if (!internal_root) {
- internal_root = object_new("container");
+ internal_root = object_new(TYPE_CONTAINER);
}
return internal_root;
--
2.47.1
- [PULL 00/59] Accel & exec patches for 2024-12-20, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 02/59] log: Add separate debug option for logging invalid memory accesses, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 01/59] hvf: arm: Ignore writes to CNTP_CTL_EL0, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 03/59] qom: Add TYPE_CONTAINER macro,
Philippe Mathieu-Daudé <=
- [PULL 04/59] qom: New object_property_add_new_container(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 05/59] tests: Fix test-qdev-global-props on anonymous qdev realize(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 06/59] tests: Explicitly create containers in test_qom_partial_path(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 07/59] ppc/e500: Avoid abuse of container_get(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 08/59] hw/ppc: Explicitly create the drc container, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 09/59] qom: Create system containers explicitly, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 10/59] target/i386/sev: Reduce system specific declarations, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 11/59] include: Rename sysemu/ -> system/, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 12/59] system: Move 'exec/confidential-guest-support.h' to system/, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 13/59] tcg/tci: Include missing 'disas/dis-asm.h' header, Philippe Mathieu-Daudé, 2024/12/20