[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 084/124] vmstate: Create VMSTATE_OPENCODED_UNSAFE
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 084/124] vmstate: Create VMSTATE_OPENCODED_UNSAFE |
Date: |
Mon, 21 Apr 2014 16:41:04 +0200 |
This is trick, to use devices that haven't been converted inside
vmstate state. It was already used on the "wild", so create a macro
and convert the users.
Signed-off-by: Juan Quintela <address@hidden>
---
hw/pci/msix.c | 10 +---------
hw/scsi/scsi-bus.c | 10 +---------
hw/usb/redirect.c | 30 +++---------------------------
include/migration/vmstate.h | 15 +++++++++++++++
4 files changed, 20 insertions(+), 45 deletions(-)
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 5c49bfc..93258f0 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -590,15 +590,7 @@ static VMStateInfo vmstate_info_msix = {
const VMStateDescription vmstate_msix = {
.name = "msix",
.fields = (VMStateField[]) {
- {
- .name = "msix",
- .version_id = 0,
- .field_exists = NULL,
- .size = 0, /* ouch */
- .info = &vmstate_info_msix,
- .flags = VMS_SINGLE,
- .offset = 0,
- },
+ VMSTATE_OPENCODED_UNSAFE("msix", vmstate_info_msix),
VMSTATE_END_OF_LIST()
}
};
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index a137c98..e11b16d 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -1934,15 +1934,7 @@ const VMStateDescription vmstate_scsi_device = {
VMSTATE_BOOL(sense_is_ua, SCSIDevice),
VMSTATE_UINT8_SUB_ARRAY(sense, SCSIDevice, 0, SCSI_SENSE_BUF_SIZE_OLD),
VMSTATE_UINT32(sense_len, SCSIDevice),
- {
- .name = "requests",
- .version_id = 0,
- .field_exists = NULL,
- .size = 0, /* ouch */
- .info = &vmstate_info_scsi_requests,
- .flags = VMS_SINGLE,
- .offset = 0,
- },
+ VMSTATE_OPENCODED_UNSAFE("requests", vmstate_info_scsi_requests),
VMSTATE_END_OF_LIST()
},
.subsections = (VMStateSubsection []) {
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 24e7e99..255a92b 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -2180,15 +2180,7 @@ static const VMStateDescription usbredir_ep_vmstate = {
VMSTATE_UINT8(interrupt_error, struct endp_data),
VMSTATE_UINT8(bufpq_prefilled, struct endp_data),
VMSTATE_UINT8(bufpq_dropping_packets, struct endp_data),
- {
- .name = "bufpq",
- .version_id = 0,
- .field_exists = NULL,
- .size = 0,
- .info = &usbredir_ep_bufpq_vmstate_info,
- .flags = VMS_SINGLE,
- .offset = 0,
- },
+ VMSTATE_OPENCODED_UNSAFE("bufpq", usbredir_ep_bufpq_vmstate_info),
VMSTATE_INT32(bufpq_target_size, struct endp_data),
VMSTATE_END_OF_LIST()
},
@@ -2248,15 +2240,7 @@ static const VMStateDescription
usbredir_ep_packet_id_queue_vmstate = {
.version_id = 1,
.minimum_version_id = 1,
.fields = (VMStateField[]) {
- {
- .name = "queue",
- .version_id = 0,
- .field_exists = NULL,
- .size = 0,
- .info = &usbredir_ep_packet_id_q_vmstate_info,
- .flags = VMS_SINGLE,
- .offset = 0,
- },
+ VMSTATE_OPENCODED_UNSAFE("queue",
usbredir_ep_packet_id_q_vmstate_info),
VMSTATE_END_OF_LIST()
}
};
@@ -2312,15 +2296,7 @@ static const VMStateDescription usbredir_vmstate = {
.fields = (VMStateField[]) {
VMSTATE_USB_DEVICE(dev, USBRedirDevice),
VMSTATE_TIMER(attach_timer, USBRedirDevice),
- {
- .name = "parser",
- .version_id = 0,
- .field_exists = NULL,
- .size = 0,
- .info = &usbredir_parser_vmstate_info,
- .flags = VMS_SINGLE,
- .offset = 0,
- },
+ VMSTATE_OPENCODED_UNSAFE("parser", usbredir_parser_vmstate_info),
VMSTATE_STRUCT_ARRAY(endpoint, USBRedirDevice, MAX_ENDPOINTS,
usbredir_ep_vmstate, struct endp_data),
VMSTATE_STRUCT(cancelled, USBRedirDevice,
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index a83aba9..5a8673c 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -218,6 +218,21 @@ extern const VMStateInfo vmstate_info_bitmap;
.offset = offsetof(_state, _field), \
}
+/*
+ * We have a field that is opencoded in old style, but we want to use
+ * it with VMSTATE. Well, just create a vmstate_info struct, and a
+ * name. VMSTATE don't know what is behind it, it is unsafe,
+ * anything can happens.
+ */
+
+#define VMSTATE_OPENCODED_UNSAFE(_name, _info) { \
+ .name = (_name), \
+ .info = &(_info), \
+ .size = 0, \
+ .flags = VMS_SINGLE, \
+ .offset = 0, \
+}
+
#define VMSTATE_2DARRAY(_field, _state, _n1, _n2, _test, _info, _type) { \
.name = (stringify(_field)), \
.field_exists = (_test), \
--
1.9.0
- [Qemu-devel] [PATCH 070/124] vmstate: Remove version parameter from VMSTATE_STATIC_BUFFER, (continued)
- [Qemu-devel] [PATCH 070/124] vmstate: Remove version parameter from VMSTATE_STATIC_BUFFER, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 076/124] vmstate: Remove unused version parameter from VMSTATE_STRUCT_VARRAY_UINT8, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 075/124] vmstate: Remove unused version parameter from VMSTATE_STRUCT_VARRAY_INT32, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 077/124] vmstate: Introduce VMSTATE_VARRAY_UINT32_TEST, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 078/124] vmstate: Remove version parameter from VMSTATE_VARRAY_UINT32, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 079/124] vmstate: Remove version parameter from VMSTATE_STRUCT_TEST, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 080/124] vmstate: Move all users of versioning to VMSTATE_STRUCT_TEST, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 081/124] vmstate: Remove version from all VMSTATE_STRUCT calls, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 082/124] vmstate: Create VMSTATE_VARRAY macro, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 083/124] vmstate: Create VMSTATE_POINTER_UNSAFE, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 084/124] vmstate: Create VMSTATE_OPENCODED_UNSAFE,
Juan Quintela <=
- [Qemu-devel] [PATCH 085/124] vmstate: Create VMSTATE_SYNTHETIC, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 086/124] vmstate: version_id is gone from fields, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 087/124] vmstate: Test for VMSTATE_SYNTHETIC, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 089/124] vmstate: Test for VMSTATE_UINT32_SUB_ARRAY, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 090/124] vmstate: Test for VMSTATE_BUFFER, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 088/124] vmstate: Test for VMSTATE_UINT8_SUB_ARRAY, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 091/124] vmstate: Test for VMSTATE_PARTIAL_BUFFER, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 093/124] vmstate: Test for VMSTATE_BUFFER_TEST, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 094/124] vmstate: Use VMSTATE_UINT8_2DARRAY instead of VMSTATE_BUFFER_TEST, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 092/124] vmstate: Test for VMSTATE_BUFFER_START_MIDDLE, Juan Quintela, 2014/04/21