Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
hw/nvram/fw_cfg.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index aa24050493..d02e5802cd 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -565,27 +565,28 @@ static void fw_cfg_reset(DeviceState *d)
Or we broke compatibility in the state, or we can't use struct tm
*/
-static int get_uint32_as_uint16(QEMUFile *f, void *pv, size_t size,
- const VMStateField *field)
+static bool get_uint32_as_uint16(QEMUFile *f, void *pv, size_t size,
+ const VMStateField *field, Error **errp)
{
uint32_t *v = pv;
*v = qemu_get_be16(f);
- return 0;
+ return true;
}
-static int put_unused(QEMUFile *f, void *pv, size_t size,
- const VMStateField *field, JSONWriter *vmdesc)
+static bool put_unused(QEMUFile *f, void *pv, size_t size,
+ const VMStateField *field, JSONWriter *vmdesc,
+ Error **errp)
{
- fprintf(stderr, "uint32_as_uint16 is only used for backward compatibility.\n");
- fprintf(stderr, "This functions shouldn't be called.\n");
-
- return 0;
+ error_setg(errp,
+ "uint32_as_uint16 is only used for backward compatibility. "
+ "This function shouldn't be called.");
+ return false;
}
static const VMStateInfo vmstate_hack_uint32_as_uint16 = {
.name = "int32_as_uint16",
- .get = get_uint32_as_uint16,
- .put = put_unused,
+ .load = get_uint32_as_uint16,
+ .save = put_unused,
};
#define VMSTATE_UINT16_HACK(_f, _s, _t) \
@@ -631,7 +632,8 @@ static void fw_cfg_update_mr(FWCfgState *s, uint16_t key, size_t size)
memory_region_ram_resize(mr, size, &error_abort);
}
-static int fw_cfg_acpi_mr_restore_post_load(void *opaque, int version_id)
+static bool fw_cfg_acpi_mr_restore_post_load(void *opaque, int version_id,
+ Error **errp)
{
FWCfgState *s = opaque;
int i, index;
@@ -650,7 +652,7 @@ static int fw_cfg_acpi_mr_restore_post_load(void *opaque, int version_id)
}
}
- return 0;
+ return true;
}
static const VMStateDescription vmstate_fw_cfg_dma = {
@@ -667,7 +669,7 @@ static const VMStateDescription vmstate_fw_cfg_acpi_mr = {
.version_id = 1,
.minimum_version_id = 1,
.needed = fw_cfg_acpi_mr_restore,
- .post_load = fw_cfg_acpi_mr_restore_post_load,
+ .post_load_errp = fw_cfg_acpi_mr_restore_post_load,
.fields = (const VMStateField[]) {
VMSTATE_UINT64(table_mr_size, FWCfgState),
VMSTATE_UINT64(linker_mr_size, FWCfgState),
--
2.48.1