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 33/41] migration: Commands are only used inside migration.c
Date: Wed, 26 Apr 2017 00:04:43 +0200	[thread overview]
Message-ID: <20170425220451.6028-34-quintela@redhat.com> (raw)
In-Reply-To: <20170425220451.6028-1-quintela@redhat.com>

So, move them there.  Notice that we export functions that send
commands, not the command themselves.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h | 15 --------------
 migration/migration.c         | 46 +++++++++++++++++++++++++++----------------
 2 files changed, 29 insertions(+), 32 deletions(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index ac6e545..9884be6 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -25,18 +25,6 @@
 /* for vl.c */
 extern int only_migratable;
 
-/* Messages sent on the return path from destination to source */
-enum mig_rp_message_type {
-    MIG_RP_MSG_INVALID = 0,  /* Must be 0 */
-    MIG_RP_MSG_SHUT,         /* sibling will not send any more RP messages */
-    MIG_RP_MSG_PONG,         /* Response to a PING; data (seq: be32 ) */
-
-    MIG_RP_MSG_REQ_PAGES_ID, /* data (start: be64, len: be32, id: string) */
-    MIG_RP_MSG_REQ_PAGES,    /* data (start: be64, len: be32) */
-
-    MIG_RP_MSG_MAX
-};
-
 typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head;
 
 /* State for the incoming migration */
@@ -181,9 +169,6 @@ int migrate_decompress_threads(void);
 bool migrate_use_events(void);
 
 /* Sending on the return path - generic and then for each message type */
-void migrate_send_rp_message(MigrationIncomingState *mis,
-                             enum mig_rp_message_type message_type,
-                             uint16_t len, void *data);
 void migrate_send_rp_shut(MigrationIncomingState *mis,
                           uint32_t value);
 void migrate_send_rp_pong(MigrationIncomingState *mis,
diff --git a/migration/migration.c b/migration/migration.c
index d2f3c5e..6e43ae3 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -85,6 +85,18 @@ static NotifierList migration_state_notifiers =
 
 static bool deferred_incoming;
 
+/* Messages sent on the return path from destination to source */
+enum mig_rp_message_type {
+    MIG_RP_MSG_INVALID = 0,  /* Must be 0 */
+    MIG_RP_MSG_SHUT,         /* sibling will not send any more RP messages */
+    MIG_RP_MSG_PONG,         /* Response to a PING; data (seq: be32 ) */
+
+    MIG_RP_MSG_REQ_PAGES_ID, /* data (start: be64, len: be32, id: string) */
+    MIG_RP_MSG_REQ_PAGES,    /* data (start: be64, len: be32) */
+
+    MIG_RP_MSG_MAX
+};
+
 /* When we add fault tolerance, we could have several
    migrations at once.  For now we don't need to add
    dynamic creation of migration */
@@ -281,6 +293,23 @@ static void deferred_incoming_migration(Error **errp)
     deferred_incoming = true;
 }
 
+/*
+ * Send a message on the return channel back to the source
+ * of the migration.
+ */
+static void migrate_send_rp_message(MigrationIncomingState *mis,
+                                    enum mig_rp_message_type message_type,
+                                    uint16_t len, void *data)
+{
+    trace_migrate_send_rp_message((int)message_type, len);
+    qemu_mutex_lock(&mis->rp_mutex);
+    qemu_put_be16(mis->to_src_file, (unsigned int)message_type);
+    qemu_put_be16(mis->to_src_file, len);
+    qemu_put_buffer(mis->to_src_file, data, len);
+    qemu_fflush(mis->to_src_file);
+    qemu_mutex_unlock(&mis->rp_mutex);
+}
+
 /* Request a range of pages from the source VM at the given
  * start address.
  *   rbname: Name of the RAMBlock to request the page in, if NULL it's the same
@@ -461,23 +490,6 @@ void migration_fd_process_incoming(QEMUFile *f)
 }
 
 /*
- * Send a message on the return channel back to the source
- * of the migration.
- */
-void migrate_send_rp_message(MigrationIncomingState *mis,
-                             enum mig_rp_message_type message_type,
-                             uint16_t len, void *data)
-{
-    trace_migrate_send_rp_message((int)message_type, len);
-    qemu_mutex_lock(&mis->rp_mutex);
-    qemu_put_be16(mis->to_src_file, (unsigned int)message_type);
-    qemu_put_be16(mis->to_src_file, len);
-    qemu_put_buffer(mis->to_src_file, data, len);
-    qemu_fflush(mis->to_src_file);
-    qemu_mutex_unlock(&mis->rp_mutex);
-}
-
-/*
  * Send a 'SHUT' message on the return channel with the given value
  * to indicate that we've finished with the RP.  Non-0 value indicates
  * error.
-- 
2.9.3

  parent reply	other threads:[~2017-04-25 22:06 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 ` [Qemu-devel] [PATCH 28/41] migration: Split registration functions from vmstate.h Juan Quintela
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 ` Juan Quintela [this message]
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-34-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.