All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: dgilbert@redhat.com, lvivier@redhat.com, peterx@redhat.com
Subject: [Qemu-devel] [PATCH 28/41] migration: Split registration functions from vmstate.h
Date: Wed, 26 Apr 2017 00:04:38 +0200	[thread overview]
Message-ID: <20170425220451.6028-29-quintela@redhat.com> (raw)
In-Reply-To: <20170425220451.6028-1-quintela@redhat.com>

They are indpendent, and nowadays almost every device register things
with qdev->vmsd.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/net/vmxnet3.c             |  1 +
 hw/ppc/spapr.c               |  1 +
 hw/s390x/s390-skeys.c        |  1 +
 hw/s390x/s390-virtio-ccw.c   |  1 +
 include/migration/register.h | 64 ++++++++++++++++++++++++++++++++++++++++++++
 include/migration/vmstate.h  | 45 -------------------------------
 migration/block.c            |  1 +
 migration/ram.c              |  1 +
 migration/savevm.c           |  1 +
 slirp/slirp.c                |  1 +
 10 files changed, 72 insertions(+), 45 deletions(-)
 create mode 100644 include/migration/register.h

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 8b1fab2..21ac646 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -26,6 +26,7 @@
 #include "qemu/bswap.h"
 #include "hw/pci/msix.h"
 #include "hw/pci/msi.h"
+#include "migration/register.h"
 
 #include "vmxnet3.h"
 #include "vmxnet_debug.h"
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 35db949..4c4701e 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -39,6 +39,7 @@
 #include "sysemu/hw_accel.h"
 #include "kvm_ppc.h"
 #include "migration/migration.h"
+#include "migration/register.h"
 #include "mmu-hash64.h"
 #include "qom/cpu.h"
 
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index 619152c..58f084a 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -15,6 +15,7 @@
 #include "hw/s390x/storage-keys.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
+#include "migration/register.h"
 
 #define S390_SKEYS_BUFFER_SIZE 131072  /* Room for 128k storage keys */
 #define S390_SKEYS_SAVE_FLAG_EOS 0x01
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 04bd0eb..22716e1 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -28,6 +28,7 @@
 #include "ipl.h"
 #include "hw/s390x/s390-virtio-ccw.h"
 #include "hw/s390x/css-bridge.h"
+#include "migration/register.h"
 
 static const char *const reset_dev_types[] = {
     TYPE_VIRTUAL_CSS_BRIDGE,
diff --git a/include/migration/register.h b/include/migration/register.h
new file mode 100644
index 0000000..844afaf
--- /dev/null
+++ b/include/migration/register.h
@@ -0,0 +1,64 @@
+/*
+ * QEMU migration vmstate registration
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef MIGRATION_REGISTER_H
+#define MIGRATION_REGISTER_H
+
+typedef void SaveStateHandler(QEMUFile *f, void *opaque);
+typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
+
+typedef struct SaveVMHandlers {
+    /* This runs inside the iothread lock.  */
+    SaveStateHandler *save_state;
+
+    void (*cleanup)(void *opaque);
+    int (*save_live_complete_postcopy)(QEMUFile *f, void *opaque);
+    int (*save_live_complete_precopy)(QEMUFile *f, void *opaque);
+
+    /* This runs both outside and inside the iothread lock.  */
+    bool (*is_active)(void *opaque);
+
+    /* This runs outside the iothread lock in the migration case, and
+     * within the lock in the savevm case.  The callback had better only
+     * use data that is local to the migration thread or protected
+     * by other locks.
+     */
+    int (*save_live_iterate)(QEMUFile *f, void *opaque);
+
+    /* This runs outside the iothread lock!  */
+    int (*save_live_setup)(QEMUFile *f, void *opaque);
+    void (*save_live_pending)(QEMUFile *f, void *opaque,
+                              uint64_t threshold_size,
+                              uint64_t *non_postcopiable_pending,
+                              uint64_t *postcopiable_pending);
+    LoadStateHandler *load_state;
+} SaveVMHandlers;
+
+int register_savevm(DeviceState *dev,
+                    const char *idstr,
+                    int instance_id,
+                    int version_id,
+                    SaveStateHandler *save_state,
+                    LoadStateHandler *load_state,
+                    void *opaque);
+
+int register_savevm_live(DeviceState *dev,
+                         const char *idstr,
+                         int instance_id,
+                         int version_id,
+                         SaveVMHandlers *ops,
+                         void *opaque);
+
+void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque);
+
+#endif
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 655558d..6b7031f 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -29,53 +29,8 @@
 
 #include "migration/qjson.h"
 
-typedef void SaveStateHandler(QEMUFile *f, void *opaque);
 typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 
-typedef struct SaveVMHandlers {
-    /* This runs inside the iothread lock.  */
-    SaveStateHandler *save_state;
-
-    void (*cleanup)(void *opaque);
-    int (*save_live_complete_postcopy)(QEMUFile *f, void *opaque);
-    int (*save_live_complete_precopy)(QEMUFile *f, void *opaque);
-
-    /* This runs both outside and inside the iothread lock.  */
-    bool (*is_active)(void *opaque);
-
-    /* This runs outside the iothread lock in the migration case, and
-     * within the lock in the savevm case.  The callback had better only
-     * use data that is local to the migration thread or protected
-     * by other locks.
-     */
-    int (*save_live_iterate)(QEMUFile *f, void *opaque);
-
-    /* This runs outside the iothread lock!  */
-    int (*save_live_setup)(QEMUFile *f, void *opaque);
-    void (*save_live_pending)(QEMUFile *f, void *opaque,
-                              uint64_t threshold_size,
-                              uint64_t *non_postcopiable_pending,
-                              uint64_t *postcopiable_pending);
-    LoadStateHandler *load_state;
-} SaveVMHandlers;
-
-int register_savevm(DeviceState *dev,
-                    const char *idstr,
-                    int instance_id,
-                    int version_id,
-                    SaveStateHandler *save_state,
-                    LoadStateHandler *load_state,
-                    void *opaque);
-
-int register_savevm_live(DeviceState *dev,
-                         const char *idstr,
-                         int instance_id,
-                         int version_id,
-                         SaveVMHandlers *ops,
-                         void *opaque);
-
-void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque);
-
 typedef struct VMStateInfo VMStateInfo;
 typedef struct VMStateDescription VMStateDescription;
 typedef struct VMStateField VMStateField;
diff --git a/migration/block.c b/migration/block.c
index d19dc15..307f136 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -26,6 +26,7 @@
 #include "block.h"
 #include "migration/misc.h"
 #include "migration/migration.h"
+#include "migration/register.h"
 #include "sysemu/blockdev.h"
 #include "qemu-file.h"
 #include "migration/vmstate.h"
diff --git a/migration/ram.c b/migration/ram.c
index 89637eb..b6cef70 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -38,6 +38,7 @@
 #include "xbzrle.h"
 #include "ram.h"
 #include "migration/migration.h"
+#include "migration/register.h"
 #include "migration/misc.h"
 #include "qemu-file.h"
 #include "migration/vmstate.h"
diff --git a/migration/savevm.c b/migration/savevm.c
index 6aeebb8..1caf8ee 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -38,6 +38,7 @@
 #include "migration/migration.h"
 #include "migration/snapshot.h"
 #include "migration/misc.h"
+#include "migration/register.h"
 #include "ram.h"
 #include "qemu-file-channel.h"
 #include "qemu-file.h"
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 9a50918..8f59a26 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -25,6 +25,7 @@
 #include "qemu-common.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
+#include "migration/register.h"
 #include "sysemu/char.h"
 #include "slirp.h"
 #include "hw/hw.h"
-- 
2.9.3

  parent reply	other threads:[~2017-04-25 22:05 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h Juan Quintela
2017-04-27 11:58   ` Dr. David Alan Gilbert
2017-05-10  9:55   ` Peter Xu
2017-04-25 22:04 ` [Qemu-devel] [PATCH 02/41] migration: Split migration/channel.c for channel operations Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 03/41] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 04/41] migration: Export qemu-file-channel.c functions in its own file Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 05/41] migration: Remove migration.h from colo.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 06/41] migration: Move colo.h to migration/ Juan Quintela
2017-05-04 19:02   ` Dr. David Alan Gilbert
2017-04-25 22:04 ` [Qemu-devel] [PATCH 07/41] migration: Move failover.h to migration/colo-failover.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 08/41] migration: Move page_cache.c to migration/ Juan Quintela
2017-05-04 19:03   ` Dr. David Alan Gilbert
2017-04-25 22:04 ` [Qemu-devel] [PATCH 09/41] migration: Move qjson.h " Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 10/41] migration: Move postcopy-ram.h " Juan Quintela
2017-04-27 12:09   ` Dr. David Alan Gilbert
2017-04-25 22:04 ` [Qemu-devel] [PATCH 11/41] migration: Split vmstate-types.c from vmstate.c Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 12/41] migration: Remove qemu-file.h from vmstate.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 13/41] migration: Remove vmstate.h from migration.h Juan Quintela
2017-05-13 20:47   ` Philippe Mathieu-Daudé
2017-04-25 22:04 ` [Qemu-devel] [PATCH 14/41] migration: migration.h was not needed Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 15/41] migration: Create include for migration snapshots Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 16/41] migration: Rename {save, load}_vmstate to {save, load}_snapshot Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 17/41] migration: Create savevm.h for functions exported from savevm.c Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 18/41] migration: Split qemu-file.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 19/41] migration: Remove unneeded includes of migration/vmstate.h Juan Quintela
2017-05-13 20:46   ` Philippe Mathieu-Daudé
2017-04-25 22:04 ` [Qemu-devel] [PATCH 20/41] migration: Export exec.c functions in its own file Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 21/41] migration: Export fd.c " Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 22/41] migration: Export socket.c " Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 23/41] migration: Export tls.c " Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 24/41] migration: Export ram.c " Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 25/41] migration: Export rdma.c " Juan Quintela
2017-04-27 11:52   ` Dr. David Alan Gilbert
2017-04-25 22:04 ` [Qemu-devel] [PATCH 26/41] migration: Move include/migration/block.h into migration/ Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 27/41] migration: Move self_announce_delay() to misc.h Juan Quintela
2017-04-25 22:04 ` Juan Quintela [this message]
2017-04-25 22:04 ` [Qemu-devel] [PATCH 29/41] migration: loadvm_free_handlers is only used in migration/ Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 30/41] migration: Move dump_vmsate_json_to_file() to misc.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ram.c Juan Quintela
2017-04-28 17:15   ` Dr. David Alan Gilbert
2017-04-25 22:04 ` [Qemu-devel] [PATCH 32/41] migration: Move constants to savevm.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 33/41] migration: Commands are only used inside migration.c Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 34/41] migration: ram_control_* are implemented in qemu_file Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 35/41] migration: create global_state.c Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 36/41] migration: Move more exported functions to migration/misc.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 37/41] migration: Move last funtions to misc.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 38/41] migration: Move migration.h to migration/ Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 39/41] exec: Create include for target_page_size() Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 40/41] migration: Make savevm.c target independent Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 41/41] migration: Remove unneeded includes Juan Quintela
2017-04-27 12:02 ` [Qemu-devel] [PATCH 00/41] Migration cleanup Dr. David Alan Gilbert
2017-04-27 15:02   ` Juan Quintela

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=20170425220451.6028-29-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.