qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 049/124] vmstate: Remove version from VMSTATE_BUFFER


From: Juan Quintela
Subject: [Qemu-devel] [PATCH 049/124] vmstate: Remove version from VMSTATE_BUFFER_UNSAFE
Date: Mon, 21 Apr 2014 16:40:29 +0200

All users used 0 anyways.  Rename VMSTATE_BUFFER_UNSAFE_INFO to
VMSTATE_BUFFER_UNSAFE_TEST to be consistent with rest of fields.

Signed-off-by: Juan Quintela <address@hidden>
---
 hw/display/g364fb.c         |  4 ++--
 hw/net/smc91c111.c          |  2 +-
 hw/pci/pci.c                | 10 ++++++----
 hw/scsi/esp-pci.c           |  2 +-
 hw/scsi/lsi53c895a.c        |  4 ++--
 include/hw/pci/shpc.h       |  2 +-
 include/migration/vmstate.h | 18 +++++++++---------
 7 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
index 46f7b41..9f6717e 100644
--- a/hw/display/g364fb.c
+++ b/hw/display/g364fb.c
@@ -462,8 +462,8 @@ static const VMStateDescription vmstate_g364fb = {
     .post_load = g364fb_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_VBUFFER_UINT32(vram, G364State, 1, NULL, 0, vram_size),
-        VMSTATE_BUFFER_UNSAFE(color_palette, G364State, 0, 256 * 3),
-        VMSTATE_BUFFER_UNSAFE(cursor_palette, G364State, 0, 9),
+        VMSTATE_BUFFER_UNSAFE(color_palette, G364State, 256 * 3),
+        VMSTATE_BUFFER_UNSAFE(cursor_palette, G364State, 9),
         VMSTATE_UINT16_ARRAY(cursor, G364State, 512),
         VMSTATE_UINT32(cursor_position, G364State),
         VMSTATE_UINT32(ctla, G364State),
diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c
index d1dca8f..e74142e 100644
--- a/hw/net/smc91c111.c
+++ b/hw/net/smc91c111.c
@@ -72,7 +72,7 @@ static const VMStateDescription vmstate_smc91c111 = {
         VMSTATE_INT32_ARRAY(rx_fifo, smc91c111_state, NUM_PACKETS),
         VMSTATE_INT32(tx_fifo_done_len, smc91c111_state),
         VMSTATE_INT32_ARRAY(tx_fifo_done, smc91c111_state, NUM_PACKETS),
-        VMSTATE_BUFFER_UNSAFE(data, smc91c111_state, 0, NUM_PACKETS * 2048),
+        VMSTATE_BUFFER_UNSAFE(data, smc91c111_state, NUM_PACKETS * 2048),
         VMSTATE_UINT8(int_level, smc91c111_state),
         VMSTATE_UINT8(int_mask, smc91c111_state),
         VMSTATE_END_OF_LIST()
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 2ba6b30..828df53 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -474,10 +474,11 @@ const VMStateDescription vmstate_pci_device = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice),
-        VMSTATE_BUFFER_UNSAFE_INFO(config, PCIDevice, 0,
+        VMSTATE_BUFFER_UNSAFE_TEST(config, PCIDevice, NULL,
                                    vmstate_info_pci_config,
                                    PCI_CONFIG_SPACE_SIZE),
-        VMSTATE_BUFFER_UNSAFE_INFO(irq_state, PCIDevice, 2,
+        VMSTATE_BUFFER_UNSAFE_TEST(irq_state, PCIDevice,
+                                   vmstate_2_plus,
                                   vmstate_info_pci_irq_state,
                                   PCI_NUM_PINS * sizeof(int32_t)),
         VMSTATE_END_OF_LIST()
@@ -490,10 +491,11 @@ const VMStateDescription vmstate_pcie_device = {
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice),
-        VMSTATE_BUFFER_UNSAFE_INFO(config, PCIDevice, 0,
+        VMSTATE_BUFFER_UNSAFE_TEST(config, PCIDevice, NULL,
                                    vmstate_info_pci_config,
                                    PCIE_CONFIG_SPACE_SIZE),
-        VMSTATE_BUFFER_UNSAFE_INFO(irq_state, PCIDevice, 2,
+        VMSTATE_BUFFER_UNSAFE_TEST(irq_state, PCIDevice,
+                                   vmstate_2_plus,
                                   vmstate_info_pci_irq_state,
                                   PCI_NUM_PINS * sizeof(int32_t)),
         VMSTATE_END_OF_LIST()
diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index 9971bbf..e592d81 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -312,7 +312,7 @@ static const VMStateDescription vmstate_esp_pci_scsi = {
     .minimum_version_id = 0,
     .fields = (VMStateField[]) {
         VMSTATE_PCI_DEVICE(parent_obj, PCIESPState),
-        VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)),
+        VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 8 * sizeof(uint32_t)),
         VMSTATE_STRUCT(esp, PCIESPState, 0, vmstate_esp, ESPState),
         VMSTATE_END_OF_LIST()
     }
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 786d848..4f9bf29 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2064,10 +2064,10 @@ static const VMStateDescription vmstate_lsi_scsi = {
         VMSTATE_UINT32(ia, LSIState),
         VMSTATE_UINT32(sbc, LSIState),
         VMSTATE_UINT32(csbc, LSIState),
-        VMSTATE_BUFFER_UNSAFE(scratch, LSIState, 0, 18 * sizeof(uint32_t)),
+        VMSTATE_BUFFER_UNSAFE(scratch, LSIState, 18 * sizeof(uint32_t)),
         VMSTATE_UINT8(sbr, LSIState),

-        VMSTATE_BUFFER_UNSAFE(script_ram, LSIState, 0, 2048 * 
sizeof(uint32_t)),
+        VMSTATE_BUFFER_UNSAFE(script_ram, LSIState, 2048 * sizeof(uint32_t)),
         VMSTATE_END_OF_LIST()
     }
 };
diff --git a/include/hw/pci/shpc.h b/include/hw/pci/shpc.h
index eef1a1a..5925100 100644
--- a/include/hw/pci/shpc.h
+++ b/include/hw/pci/shpc.h
@@ -51,6 +51,6 @@ void shpc_device_hot_unplug_cb(HotplugHandler *hotplug_dev, 
DeviceState *dev,

 extern VMStateInfo shpc_vmstate_info;
 #define SHPC_VMSTATE(_field, _type) \
-    VMSTATE_BUFFER_UNSAFE_INFO(_field, _type, 0, shpc_vmstate_info, 0)
+    VMSTATE_BUFFER_UNSAFE_TEST(_field, _type, 0, shpc_vmstate_info, 0)

 #endif
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index c22f5db..a715904 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -464,13 +464,13 @@ extern const VMStateInfo vmstate_info_bitmap;
     .start        = (_start),                                        \
 }

-#define VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, _info, _size) { \
-    .name       = (stringify(_field)),                               \
-    .version_id = (_version),                                        \
-    .size       = (_size),                                           \
-    .info       = &(_info),                                          \
-    .flags      = VMS_BUFFER,                                        \
-    .offset     = offsetof(_state, _field),                          \
+#define VMSTATE_BUFFER_UNSAFE_TEST(_field, _state, _test, _info, _size) { \
+    .name         = (stringify(_field)),                             \
+    .field_exists = (_test),                                         \
+    .size         = (_size),                                         \
+    .info         = &(_info),                                        \
+    .flags        = VMS_BUFFER,                                      \
+    .offset       = offsetof(_state, _field),                        \
 }

 #define VMSTATE_BUFFER_POINTER_UNSAFE(_field, _state, _version, _size) { \
@@ -675,8 +675,8 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_BUFFER_TEST(_f, _s, _test)                            \
     VMSTATE_STATIC_BUFFER(_f, _s, 0, _test, 0, sizeof(typeof_field(_s, _f)))

-#define VMSTATE_BUFFER_UNSAFE(_field, _state, _version, _size)        \
-    VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, vmstate_info_buffer, 
_size)
+#define VMSTATE_BUFFER_UNSAFE(_field, _state,  _size)                 \
+    VMSTATE_BUFFER_UNSAFE_TEST(_field, _state, NULL, vmstate_info_buffer, 
_size)

 #define VMSTATE_UNUSED(_size)                                         \
     VMSTATE_UNUSED_TEST(NULL, _size)
-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]