[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/27] vmstate: Test for VMSTATE_UINT8_TEST
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 14/27] vmstate: Test for VMSTATE_UINT8_TEST |
Date: |
Mon, 16 Jun 2014 11:58:10 +0200 |
Remove VMSTATE_UINT8_V, we are removing versioning.
Move all users to VMSTATE_UINT8_TEST.
Signed-off-by: Juan Quintela <address@hidden>
---
hw/char/serial.c | 2 +-
hw/ide/core.c | 2 +-
hw/net/ne2000.c | 2 +-
hw/timer/ds1338.c | 2 +-
hw/timer/hpet.c | 2 +-
include/migration/vmstate.h | 9 +++------
target-i386/machine.c | 10 +++++-----
tests/test-vmstate.c | 7 ++++++-
8 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index d17da16..4ec0164 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -612,7 +612,7 @@ const VMStateDescription vmstate_serial = {
VMSTATE_UINT8(lsr, SerialState),
VMSTATE_UINT8(msr, SerialState),
VMSTATE_UINT8(scr, SerialState),
- VMSTATE_UINT8_V(fcr_vmstate, SerialState, 3),
+ VMSTATE_UINT8_TEST(fcr_vmstate, SerialState, vmstate_3_plus),
VMSTATE_END_OF_LIST()
}
};
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 1cac5f5..2441e33 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2404,7 +2404,7 @@ const VMStateDescription vmstate_ide_drive = {
VMSTATE_UINT8(lba48, IDEState),
VMSTATE_UINT8(sense_key, IDEState),
VMSTATE_UINT8(asc, IDEState),
- VMSTATE_UINT8_V(cdrom_changed, IDEState, 3),
+ VMSTATE_UINT8_TEST(cdrom_changed, IDEState, vmstate_3_plus),
VMSTATE_END_OF_LIST()
},
.subsections = (VMStateSubsection []) {
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
index d558b8c..84745d64 100644
--- a/hw/net/ne2000.c
+++ b/hw/net/ne2000.c
@@ -617,7 +617,7 @@ const VMStateDescription vmstate_ne2000 = {
.minimum_version_id = 0,
.post_load = ne2000_post_load,
.fields = (VMStateField[]) {
- VMSTATE_UINT8_V(rxcr, NE2000State, 2),
+ VMSTATE_UINT8_TEST(rxcr, NE2000State, vmstate_2_plus),
VMSTATE_UINT8(cmd, NE2000State),
VMSTATE_UINT32(start, NE2000State),
VMSTATE_UINT32(stop, NE2000State),
diff --git a/hw/timer/ds1338.c b/hw/timer/ds1338.c
index ec6dbee..78b8e7b 100644
--- a/hw/timer/ds1338.c
+++ b/hw/timer/ds1338.c
@@ -43,7 +43,7 @@ static const VMStateDescription vmstate_ds1338 = {
.fields = (VMStateField[]) {
VMSTATE_I2C_SLAVE(parent_obj, DS1338State),
VMSTATE_INT64(offset, DS1338State),
- VMSTATE_UINT8_V(wday_offset, DS1338State, 2),
+ VMSTATE_UINT8_TEST(wday_offset, DS1338State, vmstate_2_plus),
VMSTATE_UINT8_ARRAY(nvram, DS1338State, NVRAM_SIZE),
VMSTATE_INT32(ptr, DS1338State),
VMSTATE_BOOL(addr_byte, DS1338State),
diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index e160e8f..f5da662 100644
--- a/hw/timer/hpet.c
+++ b/hw/timer/hpet.c
@@ -315,7 +315,7 @@ static const VMStateDescription vmstate_hpet = {
VMSTATE_UINT64(config, HPETState),
VMSTATE_UINT64(isr, HPETState),
VMSTATE_UINT64(hpet_counter, HPETState),
- VMSTATE_UINT8_V(num_timers, HPETState, 2),
+ VMSTATE_UINT8_TEST(num_timers, HPETState, vmstate_2_plus),
VMSTATE_VALIDATE("num_timers in range", hpet_validate_num_timers),
VMSTATE_STRUCT_VARRAY_UINT8(timer, HPETState, num_timers, 0,
vmstate_hpet_timer, HPETTimer),
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index f37d033..b66e540 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -547,8 +547,8 @@ extern const VMStateInfo vmstate_info_bitmap;
#define VMSTATE_INT64_TEST(_f, _s, _t) \
VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_int64, int64_t)
-#define VMSTATE_UINT8_V(_f, _s, _v) \
- VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint8, uint8_t)
+#define VMSTATE_UINT8_TEST(_f, _s, _t) \
+ VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
#define VMSTATE_UINT16_V(_f, _s, _v) \
VMSTATE_SINGLE(_f, _s, _v, vmstate_info_uint16, uint16_t)
#define VMSTATE_UINT32_V(_f, _s, _v) \
@@ -569,7 +569,7 @@ extern const VMStateInfo vmstate_info_bitmap;
VMSTATE_INT64_TEST(_f, _s, NULL)
#define VMSTATE_UINT8(_f, _s) \
- VMSTATE_UINT8_V(_f, _s, 0)
+ VMSTATE_UINT8_TEST(_f, _s, NULL)
#define VMSTATE_UINT16(_f, _s) \
VMSTATE_UINT16_V(_f, _s, 0)
#define VMSTATE_UINT32(_f, _s) \
@@ -604,9 +604,6 @@ extern const VMStateInfo vmstate_info_bitmap;
#define VMSTATE_INT32_POSITIVE_LE(_f, _s) \
VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
-#define VMSTATE_UINT8_TEST(_f, _s, _t) \
- VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
-
#define VMSTATE_UINT16_TEST(_f, _s, _t) \
VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 7e80b52..8f52c0e 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -673,7 +673,7 @@ const VMStateDescription vmstate_x86_cpu = {
VMSTATE_UINT16_V(env.intercept_dr_read, X86CPU, 5),
VMSTATE_UINT16_V(env.intercept_dr_write, X86CPU, 5),
VMSTATE_UINT32_V(env.intercept_exceptions, X86CPU, 5),
- VMSTATE_UINT8_V(env.v_tpr, X86CPU, 5),
+ VMSTATE_UINT8_TEST(env.v_tpr, X86CPU, vmstate_5_plus),
/* MTRRs */
VMSTATE_UINT64_ARRAY_V(env.mtrr_fixed, X86CPU, 11, 8),
VMSTATE_UINT64_V(env.mtrr_deftype, X86CPU, 8),
@@ -683,10 +683,10 @@ const VMStateDescription vmstate_x86_cpu = {
VMSTATE_UINT32_V(env.mp_state, X86CPU, 9),
VMSTATE_UINT64_V(env.tsc, X86CPU, 9),
VMSTATE_INT32_TEST(env.exception_injected, X86CPU, vmstate_11_plus),
- VMSTATE_UINT8_V(env.soft_interrupt, X86CPU, 11),
- VMSTATE_UINT8_V(env.nmi_injected, X86CPU, 11),
- VMSTATE_UINT8_V(env.nmi_pending, X86CPU, 11),
- VMSTATE_UINT8_V(env.has_error_code, X86CPU, 11),
+ VMSTATE_UINT8_TEST(env.soft_interrupt, X86CPU, vmstate_11_plus),
+ VMSTATE_UINT8_TEST(env.nmi_injected, X86CPU, vmstate_11_plus),
+ VMSTATE_UINT8_TEST(env.nmi_pending, X86CPU, vmstate_11_plus),
+ VMSTATE_UINT8_TEST(env.has_error_code, X86CPU, vmstate_11_plus),
VMSTATE_UINT32_V(env.sipi_vector, X86CPU, 11),
/* MCE */
VMSTATE_UINT64_V(env.mcg_cap, X86CPU, 10),
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index 1302aee..8678df4 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -150,7 +150,7 @@ static int load_vmstate(const VMStateDescription *desc,
typedef struct TestSimple {
bool b_1, b_2;
- uint8_t u8_1;
+ uint8_t u8_1, u8_2;
uint16_t u16_1;
uint32_t u32_1;
uint64_t u64_1;
@@ -166,6 +166,7 @@ TestSimple obj_simple = {
.b_1 = true,
.b_2 = false,
.u8_1 = 130,
+ .u8_2 = 222,
.u16_1 = 512,
.u32_1 = 70000,
.u64_1 = 12121212,
@@ -297,6 +298,8 @@ static const VMStateDescription vmstate_simple_test = {
VMSTATE_INT32_TEST(i32_2, TestSimple, test_false),
VMSTATE_INT64_TEST(i64_1, TestSimple, test_true),
VMSTATE_INT64_TEST(i64_2, TestSimple, test_false),
+ VMSTATE_UINT8_TEST(u8_1, TestSimple, test_true),
+ VMSTATE_UINT8_TEST(u8_2, TestSimple, test_false),
VMSTATE_END_OF_LIST()
}
};
@@ -307,6 +310,7 @@ uint8_t wire_simple_test[] = {
/* i16_1 */ 0x02, 0x00,
/* i32_1 */ 0x00, 0x01, 0x11, 0x70,
/* i64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0x7c,
+ /* u8_1 */ 0x82,
QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
};
@@ -328,6 +332,7 @@ static void test_simple_test(void)
FIELD_EQUAL(i16_1);
FIELD_EQUAL(i32_1);
FIELD_EQUAL(i64_1);
+ FIELD_EQUAL(u8_1);
}
#undef FIELD_EQUAL
--
1.9.3
- [Qemu-devel] [PATCH 04/27] vmstate: Port versioned tests to new format, (continued)
- [Qemu-devel] [PATCH 04/27] vmstate: Port versioned tests to new format, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 06/27] vmstate: Remove VMSTATE_UINTL_EQUAL_V, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 05/27] vmstate: Create test functions for versions until 15, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 07/27] vmstate: Change VMSTATE_INTTL_V to VMSTATE_INTTL_TEST, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 08/27] vmstate: Remove unused VMSTATE_UINTTL_ARRAY_V, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 10/27] vmstate: Test for VMSTATE_INT8_TEST, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 11/27] vmstate: Test for VMSTATE_INT16_TEST, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 09/27] vmstate: Test for VMSTATE_BOOL_TEST, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 13/27] vmstate: test for VMSTATE_INT64_TEST, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 12/27] vmstate: Test for VMSTATE_INT32_TEST, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 14/27] vmstate: Test for VMSTATE_UINT8_TEST,
Juan Quintela <=
- [Qemu-devel] [PATCH 16/27] vmstate: Test for VMSTATE_UINT32_TEST, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 15/27] vmstate: Test for VMSTATE_UINT16_TEST, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 17/27] vmstate: Test for VMSTATE_UINT64_TEST, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 18/27] vmstate: Test for VMSTATE_FLOAT64, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 19/27] vmstate: Test for VMSTATE_UNUSED, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 21/27] vmstate: Test for VMSTATE_UINT8_EQUAL, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 22/27] vmstate: Test for VMSTATE_UINT16_EQUAL, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 20/27] vmstate: Test for VMSTATE_BITMAP, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 23/27] vmstate: Test for VMSTATE_UINT32_EQUAL, Juan Quintela, 2014/06/16
- [Qemu-devel] [PATCH 24/27] vmstate: Test for VMSTATE_UINT64_EQUAL, Juan Quintela, 2014/06/16