From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v2 08/11] qom: Have class_base_init() take a const data argument
Date: Mon, 10 Feb 2025 14:31:31 +0100 [thread overview]
Message-ID: <20250210133134.90879-9-philmd@linaro.org> (raw)
In-Reply-To: <20250210133134.90879-1-philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/qom/object.h | 2 +-
hw/core/machine.c | 2 +-
hw/core/qdev.c | 2 +-
hw/pci/pci.c | 2 +-
qom/object.c | 2 +-
rust/qemu-api/src/qom.rs | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index 9192265db76..7bb14ca7067 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -487,7 +487,7 @@ struct TypeInfo
size_t class_size;
void (*class_init)(ObjectClass *klass, void *data);
- void (*class_base_init)(ObjectClass *klass, void *data);
+ void (*class_base_init)(ObjectClass *klass, const void *data);
void *class_data;
InterfaceInfo *interfaces;
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 254cc20c4cb..7bdde9286c2 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1236,7 +1236,7 @@ static void machine_class_init(ObjectClass *oc, void *data)
"Memory size configuration");
}
-static void machine_class_base_init(ObjectClass *oc, void *data)
+static void machine_class_base_init(ObjectClass *oc, const void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
mc->max_cpus = mc->max_cpus ?: 1;
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 82bbdcb654e..54578299147 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -693,7 +693,7 @@ static void device_finalize(Object *obj)
g_free(dev->id);
}
-static void device_class_base_init(ObjectClass *class, void *data)
+static void device_class_base_init(ObjectClass *class, const void *data)
{
DeviceClass *klass = DEVICE_CLASS(class);
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 2afa423925c..00f50e6f2cc 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2712,7 +2712,7 @@ static void pci_device_class_init(ObjectClass *klass, void *data)
"access to indirect DMA memory");
}
-static void pci_device_class_base_init(ObjectClass *klass, void *data)
+static void pci_device_class_base_init(ObjectClass *klass, const void *data)
{
if (!object_class_is_abstract(klass)) {
ObjectClass *conventional =
diff --git a/qom/object.c b/qom/object.c
index ec447f14a78..61ac8cd4842 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -55,7 +55,7 @@ struct TypeImpl
size_t instance_align;
void (*class_init)(ObjectClass *klass, void *data);
- void (*class_base_init)(ObjectClass *klass, void *data);
+ void (*class_base_init)(ObjectClass *klass, const void *data);
void *class_data;
diff --git a/rust/qemu-api/src/qom.rs b/rust/qemu-api/src/qom.rs
index f50ee371aac..f3d43e066ef 100644
--- a/rust/qemu-api/src/qom.rs
+++ b/rust/qemu-api/src/qom.rs
@@ -475,7 +475,7 @@ pub trait ObjectImpl: ObjectType + ClassInitImpl<Self::Class> {
/// the effects of copying the contents of the parent's class struct
/// to the descendants.
const CLASS_BASE_INIT: Option<
- unsafe extern "C" fn(klass: *mut ObjectClass, data: *mut c_void),
+ unsafe extern "C" fn(klass: *mut ObjectClass, data: *const c_void),
> = None;
const TYPE_INFO: TypeInfo = TypeInfo {
--
2.47.1
next prev parent reply other threads:[~2025-02-10 13:36 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 13:31 [PATCH v2 00/11] qom: Constify class_data Philippe Mathieu-Daudé
2025-02-10 13:31 ` [PATCH v2 01/11] target/i386: Constify X86CPUModel uses Philippe Mathieu-Daudé
2025-02-10 16:30 ` Richard Henderson
2025-02-10 13:31 ` [PATCH v2 02/11] target/sparc: Constify SPARCCPUClass::cpu_def Philippe Mathieu-Daudé
2025-02-10 16:30 ` Richard Henderson
2025-02-10 13:31 ` [PATCH v2 03/11] target/xtensa: Finalize config in xtensa_register_core() Philippe Mathieu-Daudé
2025-02-10 16:30 ` Richard Henderson
2025-02-10 17:02 ` Max Filippov
2025-02-10 13:31 ` [PATCH v2 04/11] target/riscv: Declare RISCVCPUClass::misa_mxl_max as RISCVMXL Philippe Mathieu-Daudé
2025-02-10 16:31 ` Richard Henderson
2025-02-10 13:31 ` [PATCH v2 05/11] target/riscv: Convert misa_mxl_max using GLib macros Philippe Mathieu-Daudé
2025-02-10 16:34 ` Richard Henderson
2025-02-10 13:31 ` [PATCH v2 06/11] hw: Declare various const data as 'const' Philippe Mathieu-Daudé
2025-02-10 16:35 ` Richard Henderson
2025-02-10 13:31 ` [PATCH v2 07/11] hw: Make class data 'const' Philippe Mathieu-Daudé
2025-02-10 16:36 ` Richard Henderson
2025-02-10 13:31 ` Philippe Mathieu-Daudé [this message]
2025-02-10 16:36 ` [PATCH v2 08/11] qom: Have class_base_init() take a const data argument Richard Henderson
2025-02-10 13:31 ` [PATCH v2 09/11] qom: Have class_init() " Philippe Mathieu-Daudé
2025-02-10 16:51 ` Richard Henderson
2025-02-10 17:22 ` Philippe Mathieu-Daudé
2025-02-10 13:31 ` [PATCH v2 10/11] qom: Constify TypeInfo::class_data Philippe Mathieu-Daudé
2025-02-10 16:54 ` Richard Henderson
2025-02-10 13:31 ` [PATCH v2 11/11] qom: Constify InterfaceInfo[] interfaces Philippe Mathieu-Daudé
2025-02-10 16:55 ` Richard Henderson
2025-02-10 13:46 ` [PATCH v2 00/11] qom: Constify class_data Philippe Mathieu-Daudé
2025-02-10 17:02 ` Richard Henderson
2025-02-10 17:21 ` Philippe Mathieu-Daudé
2025-03-06 13:16 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250210133134.90879-9-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).