qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Amit Shah <amit.shah@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] [PULL 56/59] Add VMSTATE_STRUCT_VARRAY_KNOWN
Date: Fri, 8 Jan 2016 16:21:24 +0200	[thread overview]
Message-ID: <1452262668-31244-57-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1452262668-31244-1-git-send-email-mst@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

At the moment we have VMSTATE_STRUCT_ARRAY that requires
the field is declared as an array of fixed size.
We also have VMSTATE_STRUCT_VARRAY_UINT* that allows
a field declared as a pointer, but requires that the length
is a field member in the structure being loaded/saved.

VMSTATE_STRUCT_VARRAY_KNOWN is for arrays defined as pointers
yet we somehow know the length of.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
---
 include/migration/vmstate.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 7267e38..97d44d3 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -374,6 +374,19 @@ extern const VMStateInfo vmstate_info_bitmap;
     .offset       = vmstate_offset_array(_state, _field, _type, _num),\
 }
 
+/* a variable length array (i.e. _type *_field) but we know the
+ * length
+ */
+#define VMSTATE_STRUCT_VARRAY_KNOWN(_field, _state, _num, _version, _vmsd, _type) { \
+    .name       = (stringify(_field)),                               \
+    .num          = (_num),                                          \
+    .version_id = (_version),                                        \
+    .vmsd       = &(_vmsd),                                          \
+    .size       = sizeof(_type),                                     \
+    .flags      = VMS_STRUCT|VMS_ARRAY,                              \
+    .offset     = offsetof(_state, _field),                          \
+}
+
 #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
     .name       = (stringify(_field)),                               \
     .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
-- 
MST

  parent reply	other threads:[~2016-01-08 14:21 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 15:08 [Qemu-devel] [PULL 00/59] acpi dsdt rework, misc fixes Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 04/59] tests: acpi: print ASL diff in verbose mode Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 05/59] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 06/59] pc: acpi: memhp: move MHPD._STA method into SSDT Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 07/59] pc: acpi: memhp: move MHPD.MLCK mutex " Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 08/59] pc: acpi: memhp: move MHPD.MSCN method " Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 09/59] pc: acpi: memhp: move MHPD.MRST " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 10/59] pc: acpi: memhp: move MHPD.MPXM " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 11/59] pc: acpi: memhp: move MHPD.MOST " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 12/59] pc: acpi: memhp: move MHPD.MEJ0 " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 13/59] pc: acpi: memhp: move MHPD.MCRS " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 14/59] pc: acpi: memhp: move MHPD Device " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 15/59] pc: acpi: factor out memhp code from build_ssdt() into separate function Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 16/59] pc: acpi: memhp: move \_GPE._E03 into SSDT Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 17/59] pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 18/59] pc: acpi: drop unused CPU_STATUS_LEN from DSDT Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 19/59] pc: acpi: cpuhp: move CPEJ() method to SSDT Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 20/59] pc: acpi: cpuhp: move CPMA() method into SSDT Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 21/59] pc: acpi: cpuhp: move CPST() " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 22/59] pc: acpi: cpuhp: move PRSC() " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 23/59] pc: acpi: cpuhp: move \_GPE._E02() " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 24/59] pc: acpi: factor out cpu hotplug code from build_ssdt() into separate function Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 25/59] pc: acpi: move HPET from DSDT to SSDT Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 26/59] pc: acpi: move DBUG() " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 27/59] pc: acpi: move RTC device " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 28/59] pc: acpi: move KBD " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 29/59] pc: acpi: move MOU " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 30/59] pc: acpi: move FDC0 " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 31/59] pc: acpi: move LPT " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 32/59] pc: acpi: move COM devices " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 33/59] pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 34/59] pc: acpi: move remaining GPE handlers " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 35/59] pc: acpi: pci: move link devices " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 36/59] pc: acpi: piix4: move IQCR() " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 37/59] pc: acpi: piix4: move IQST() " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 38/59] pc: acpi: piix4: move PCI0._PRT() " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 39/59] pc: acpi: piix4: move remaining PCI hotplug bits " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 40/59] pc: acpi: piix4: acpi move PCI0 device to SSDT Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 41/59] pc: acpi: q35: move GSI links " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 42/59] pc: acpi: q35: move link devices " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 43/59] pc: acpi: q35: move IQCR() into SSDT Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 44/59] pc: acpi: q35: move IQST() " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 45/59] pc: acpi: q35: move ISA bridge " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 46/59] pc: acpi: q35: move _PRT() " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 47/59] pc: acpi: q35: move PRTA routing table " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 48/59] pc: acpi: q35: move PRTP " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 49/59] pc: acpi: q35: move _PIC() method " Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 50/59] pc: acpi: q35: move PCI0._OSC() " Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 51/59] pc: acpi: q35: move PCI0 device definition " Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 52/59] pc: acpi: q35: PCST, PCSB opregions and PCIB field " Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 53/59] pc: acpi: switch to AML API composed DSDT Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 54/59] pc: acpi: remove unused ASL templates and related blobs/utils Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 55/59] i386/pc: expose identifying the floppy controller Michael S. Tsirkin
2016-01-08 14:21 ` Michael S. Tsirkin [this message]
2016-01-08 14:21 ` [Qemu-devel] [PULL 57/59] migration/virtio: Remove simple .get/.put use Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 58/59] ivshmem: Store file descriptor for vhost-user negotiation Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 59/59] virtio: fix error message for number of queues Michael S. Tsirkin
2016-01-08 15:08 ` [Qemu-devel] [PULL 01/59] nvdimm: fix header pointer in nvdimm_build_nfit() Michael S. Tsirkin
2016-01-08 15:08 ` [Qemu-devel] [PULL 02/59] igd-passthrough: fix use of host_pci_config_read Michael S. Tsirkin
2016-01-08 15:08 ` [Qemu-devel] [PULL 03/59] hw/i386: fill in the CENTURY field of the FADT (FACP) ACPI table Michael S. Tsirkin
2016-01-08 16:21 ` [Qemu-devel] [PULL 00/59] acpi dsdt rework, misc fixes Peter Maydell
2016-01-08 17:34   ` [Qemu-devel] [PATCH] pc: acpi: fix build fail on w32 Igor Mammedov
2016-01-09 21:18     ` Michael S. Tsirkin

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=1452262668-31244-57-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=peter.maydell@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).