From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Juan Quintela" <quintela@redhat.com>
Subject: [PULL 01/71] migration: Make VMStateDescription.subsections const
Date: Sat, 30 Dec 2023 08:22:36 +1100 [thread overview]
Message-ID: <20231229212346.147149-2-richard.henderson@linaro.org> (raw)
In-Reply-To: <20231229212346.147149-1-richard.henderson@linaro.org>
Allow the array of pointers to itself be const.
Propagate this through the copies of this field.
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231221031652.119827-2-richard.henderson@linaro.org>
---
include/migration/vmstate.h | 2 +-
migration/savevm.c | 12 ++++++------
migration/vmstate.c | 14 ++++++++------
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 9821918631..294d2d8486 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -209,7 +209,7 @@ struct VMStateDescription {
bool (*dev_unplug_pending)(void *opaque);
const VMStateField *fields;
- const VMStateDescription **subsections;
+ const VMStateDescription * const *subsections;
};
extern const VMStateInfo vmstate_info_bool;
diff --git a/migration/savevm.c b/migration/savevm.c
index 1b9ab7b8ee..eab62330b6 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -551,11 +551,11 @@ static void dump_vmstate_vmsf(FILE *out_file, const VMStateField *field,
}
static void dump_vmstate_vmss(FILE *out_file,
- const VMStateDescription **subsection,
+ const VMStateDescription *subsection,
int indent)
{
- if (*subsection != NULL) {
- dump_vmstate_vmsd(out_file, *subsection, indent, true);
+ if (subsection != NULL) {
+ dump_vmstate_vmsd(out_file, subsection, indent, true);
}
}
@@ -597,7 +597,7 @@ static void dump_vmstate_vmsd(FILE *out_file,
fprintf(out_file, "\n%*s]", indent, "");
}
if (vmsd->subsections != NULL) {
- const VMStateDescription **subsection = vmsd->subsections;
+ const VMStateDescription * const *subsection = vmsd->subsections;
bool first;
fprintf(out_file, ",\n%*s\"Subsections\": [\n", indent, "");
@@ -606,7 +606,7 @@ static void dump_vmstate_vmsd(FILE *out_file,
if (!first) {
fprintf(out_file, ",\n");
}
- dump_vmstate_vmss(out_file, subsection, indent + 2);
+ dump_vmstate_vmss(out_file, *subsection, indent + 2);
subsection++;
first = false;
}
@@ -831,7 +831,7 @@ void unregister_savevm(VMStateIf *obj, const char *idstr, void *opaque)
static void vmstate_check(const VMStateDescription *vmsd)
{
const VMStateField *field = vmsd->fields;
- const VMStateDescription **subsection = vmsd->subsections;
+ const VMStateDescription * const *subsection = vmsd->subsections;
if (field) {
while (field->name) {
diff --git a/migration/vmstate.c b/migration/vmstate.c
index b7723a4187..ef26f26ccd 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -452,13 +452,15 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
}
static const VMStateDescription *
-vmstate_get_subsection(const VMStateDescription **sub, char *idstr)
+vmstate_get_subsection(const VMStateDescription * const *sub,
+ const char *idstr)
{
- while (sub && *sub) {
- if (strcmp(idstr, (*sub)->name) == 0) {
- return *sub;
+ if (sub) {
+ for (const VMStateDescription *s = *sub; s ; s = *++sub) {
+ if (strcmp(idstr, s->name) == 0) {
+ return s;
+ }
}
- sub++;
}
return NULL;
}
@@ -517,7 +519,7 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
void *opaque, JSONWriter *vmdesc)
{
- const VMStateDescription **sub = vmsd->subsections;
+ const VMStateDescription * const *sub = vmsd->subsections;
bool vmdesc_has_subsections = false;
int ret = 0;
--
2.34.1
next prev parent reply other threads:[~2023-12-29 21:24 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-29 21:22 [PULL 00/71] Constify VMState Richard Henderson
2023-12-29 21:22 ` Richard Henderson [this message]
2023-12-29 21:22 ` [PULL 02/71] target/arm: Constify VMState in machine.c Richard Henderson
2023-12-29 21:22 ` [PULL 03/71] target/arm: Constify hvf/hvf.c Richard Henderson
2023-12-29 21:22 ` [PULL 04/71] target/alpha: Constify VMState in machine.c Richard Henderson
2023-12-29 21:22 ` [PULL 05/71] target/avr: " Richard Henderson
2023-12-29 21:22 ` [PULL 06/71] target/cris: " Richard Henderson
2023-12-29 21:22 ` [PULL 07/71] target/hppa: " Richard Henderson
2023-12-29 21:22 ` [PULL 08/71] target/i386: " Richard Henderson
2023-12-29 21:22 ` [PULL 09/71] target/loongarch: " Richard Henderson
2023-12-29 21:22 ` [PULL 10/71] target/m68k: " Richard Henderson
2023-12-29 21:22 ` [PULL 11/71] target/microblaze: " Richard Henderson
2023-12-29 21:22 ` [PULL 12/71] target/mips: " Richard Henderson
2023-12-29 21:22 ` [PULL 13/71] target/openrisc: " Richard Henderson
2023-12-29 21:22 ` [PULL 14/71] target/ppc: " Richard Henderson
2023-12-29 21:22 ` [PULL 15/71] target/riscv: " Richard Henderson
2023-12-29 21:22 ` [PULL 16/71] target/s390x: " Richard Henderson
2023-12-29 21:22 ` [PULL 17/71] target/sparc: " Richard Henderson
2023-12-29 21:22 ` [PULL 18/71] hw/arm: Constify VMState Richard Henderson
2023-12-29 21:22 ` [PULL 19/71] hw/core: " Richard Henderson
2023-12-29 21:22 ` [PULL 20/71] hw/9pfs: " Richard Henderson
2023-12-29 21:22 ` [PULL 21/71] hw/acpi: " Richard Henderson
2023-12-29 21:22 ` [PULL 22/71] hw/adc: " Richard Henderson
2023-12-29 21:22 ` [PULL 23/71] hw/audio: " Richard Henderson
2023-12-29 21:22 ` [PULL 24/71] hw/block: " Richard Henderson
2023-12-29 21:23 ` [PULL 25/71] hw/char: " Richard Henderson
2023-12-29 21:23 ` [PULL 26/71] hw/display: " Richard Henderson
2023-12-29 21:23 ` [PULL 27/71] hw/dma: " Richard Henderson
2023-12-29 21:23 ` [PULL 28/71] hw/gpio: " Richard Henderson
2023-12-29 21:23 ` [PULL 29/71] hw/hyperv: " Richard Henderson
2023-12-29 21:23 ` [PULL 30/71] hw/i2c: " Richard Henderson
2023-12-29 21:23 ` [PULL 31/71] hw/i386: " Richard Henderson
2023-12-29 21:23 ` [PULL 32/71] hw/ide: " Richard Henderson
2023-12-29 21:23 ` [PULL 33/71] hw/input: " Richard Henderson
2023-12-29 21:23 ` [PULL 34/71] hw/intc: " Richard Henderson
2023-12-29 21:23 ` [PULL 35/71] hw/ipack: " Richard Henderson
2023-12-29 21:23 ` [PULL 36/71] hw/ipmi: " Richard Henderson
2023-12-29 21:23 ` [PULL 37/71] hw/isa: " Richard Henderson
2023-12-29 21:23 ` [PULL 38/71] hw/loongarch: " Richard Henderson
2023-12-29 21:23 ` [PULL 39/71] hw/m68k: " Richard Henderson
2023-12-29 21:23 ` [PULL 40/71] hw/misc: " Richard Henderson
2023-12-29 21:23 ` [PULL 41/71] hw/net: " Richard Henderson
2023-12-29 21:23 ` [PULL 42/71] hw/nvram: " Richard Henderson
2023-12-29 21:23 ` [PULL 43/71] hw/openrisc: " Richard Henderson
2023-12-29 21:23 ` [PULL 44/71] hw/pci: " Richard Henderson
2023-12-29 21:23 ` [PULL 45/71] hw/pci-bridge: " Richard Henderson
2023-12-29 21:23 ` [PULL 46/71] hw/pci-host: " Richard Henderson
2023-12-29 21:23 ` [PULL 47/71] hw/ppc: " Richard Henderson
2023-12-29 21:23 ` [PULL 48/71] hw/riscv: " Richard Henderson
2023-12-29 21:23 ` [PULL 49/71] hw/rtc: " Richard Henderson
2023-12-29 21:23 ` [PULL 50/71] hw/s390x: " Richard Henderson
2023-12-29 21:23 ` [PULL 51/71] hw/scsi: " Richard Henderson
2023-12-29 21:23 ` [PULL 52/71] hw/sd: " Richard Henderson
2023-12-29 21:23 ` [PULL 53/71] hw/sensor: " Richard Henderson
2023-12-29 21:23 ` [PULL 54/71] hw/sparc: " Richard Henderson
2023-12-29 21:23 ` [PULL 55/71] hw/ssi: " Richard Henderson
2023-12-29 21:23 ` [PULL 56/71] hw/timer: " Richard Henderson
2023-12-29 21:23 ` [PULL 57/71] hw/tpm: " Richard Henderson
2023-12-29 21:23 ` [PULL 58/71] hw/usb: " Richard Henderson
2023-12-29 21:23 ` [PULL 59/71] hw/vfio: " Richard Henderson
2023-12-29 21:23 ` [PULL 60/71] hw/virtio: " Richard Henderson
2023-12-29 21:23 ` [PULL 61/71] hw/watchdog: " Richard Henderson
2023-12-29 21:23 ` [PULL 62/71] hw/misc/macio: " Richard Henderson
2023-12-29 21:23 ` [PULL 63/71] audio: " Richard Henderson
2023-12-29 21:23 ` [PULL 64/71] backends: " Richard Henderson
2023-12-29 21:23 ` [PULL 65/71] cpu-target: " Richard Henderson
2023-12-29 21:23 ` [PULL 66/71] migration: " Richard Henderson
2023-12-29 21:23 ` [PULL 67/71] system: " Richard Henderson
2023-12-29 21:23 ` [PULL 68/71] replay: " Richard Henderson
2023-12-29 21:23 ` [PULL 69/71] util/fifo8: " Richard Henderson
2023-12-29 21:23 ` [PULL 70/71] tests/unit/test-vmstate: " Richard Henderson
2023-12-29 21:23 ` [PULL 71/71] docs: Constify VMstate in examples Richard Henderson
2024-01-04 19:54 ` [PULL 00/71] Constify VMState Peter Maydell
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=20231229212346.147149-2-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).