@samitouri / QOSamiQemu / commits / da36151de1

qom: Declare GlobalProperty structure in 'qom/compat-properties.h'

While GlobalProperty is expected to only be used by QDev board layer, it is used by the lower QOM API, so define it in the qom/ namespace. This helps to build binary which use QOM but don't need the QDev layer. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Message-Id: <20260325151728.45378-4-philmd@linaro.org>

Philippe Mathieu-Daudé committed Mar 25, 2026 at 15:44 UTC da36151de17e25cd68192bd00ae10de03bf48437
5 files changed +35 -18
include/hw/core/boards.h
+1
@@ -8,6 +8,7 @@
8 #include "system/blockdev.h"
9 #include "qapi/qapi-types-machine.h"
10 #include "qemu/module.h"
11 +#include "qom/compat-properties.h"
12 #include "qom/object.h"
13 #include "hw/core/cpu.h"
14 #include "hw/core/resettable.h"
include/hw/core/qdev-properties.h
+1
@@ -1,6 +1,7 @@
1 #ifndef QEMU_QDEV_PROPERTIES_H
2 #define QEMU_QDEV_PROPERTIES_H
3
4 +#include "qom/compat-properties.h"
5 #include "hw/core/qdev.h"
6
7 /**
include/hw/core/qdev.h
-17
@@ -404,23 +404,6 @@ struct BusState {
404 ResettableState reset;
405 };
406
407 -/**
408 - * typedef GlobalProperty - a global property type
409 - *
410 - * @used: Set to true if property was used when initializing a device.
411 - * @optional: If set to true, GlobalProperty will be skipped without errors
412 - * if the property doesn't exist.
413 - *
414 - * An error is fatal for non-hotplugged devices, when the global is applied.
415 - */
416 -typedef struct GlobalProperty {
417 - const char *driver;
418 - const char *property;
419 - const char *value;
420 - bool used;
421 - bool optional;
422 -} GlobalProperty;
423 -
407 /*** Board API. This should go away once we have a machine config file. ***/
408
409 /**
include/qom/compat-properties.h new
+32
@@ -0,0 +1,32 @@
1 +/*
2 + * QEMU Object Model
3 + *
4 + * Copyright IBM, Corp. 2011
5 + *
6 + * Authors:
7 + * Anthony Liguori <aliguori@us.ibm.com>
8 + *
9 + * SPDX-License-Identifier: GPL-2.0-or-later
10 + */
11 +
12 +#ifndef QEMU_COMPAT_PROPERTIES_H
13 +#define QEMU_COMPAT_PROPERTIES_H
14 +
15 +/**
16 + * typedef GlobalProperty - a global property type
17 + *
18 + * @used: Set to true if property was used when initializing a device.
19 + * @optional: If set to true, GlobalProperty will be skipped without errors
20 + * if the property doesn't exist.
21 + *
22 + * An error is fatal for non-hotplugged devices, when the global is applied.
23 + */
24 +typedef struct GlobalProperty {
25 + const char *driver;
26 + const char *property;
27 + const char *value;
28 + bool used;
29 + bool optional;
30 +} GlobalProperty;
31 +
32 +#endif
qom/object.c
+1 -1
@@ -11,8 +11,8 @@
11 */
12
13 #include "qemu/osdep.h"
14 -#include "hw/core/qdev.h"
14 #include "qapi/error.h"
15 +#include "qom/compat-properties.h"
16 #include "qom/object.h"
17 #include "qom/object_interfaces.h"
18 #include "qemu/cutils.h"