[libvirt PATCH v2 16/81] qemu: Drop forward declarations in migration code

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

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>
Reviewed-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---

Notes:
    Version 2:
    - no change

 src/qemu/qemu_migration.c | 176 ++++++++++++++++----------------------
 1 file changed, 76 insertions(+), 100 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 06af16c0e7..b9a8326fbb 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -81,35 +81,97 @@ VIR_ENUM_IMPL(qemuMigrationJobPhase,
               "finish3",
 );
 
-static int
+
+static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT
 qemuMigrationJobStart(virQEMUDriver *driver,
                       virDomainObj *vm,
                       virDomainAsyncJob job,
                       unsigned long apiFlags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
+{
+    qemuDomainObjPrivate *priv = vm->privateData;
+    virDomainJobOperation op;
+    unsigned long long mask;
 
-static void
+    if (job == VIR_ASYNC_JOB_MIGRATION_IN) {
+        op = VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN;
+        mask = VIR_JOB_NONE;
+    } else {
+        op = VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT;
+        mask = VIR_JOB_DEFAULT_MASK |
+               JOB_MASK(VIR_JOB_SUSPEND) |
+               JOB_MASK(VIR_JOB_MIGRATION_OP);
+    }
+
+    if (qemuDomainObjBeginAsyncJob(driver, vm, job, op, apiFlags) < 0)
+        return -1;
+
+    qemuDomainJobSetStatsType(priv->job.current,
+                              QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION);
+
+    qemuDomainObjSetAsyncJobMask(vm, mask);
+    return 0;
+}
+
+
+static void ATTRIBUTE_NONNULL(1)
 qemuMigrationJobSetPhase(virDomainObj *vm,
                          qemuMigrationJobPhase phase)
-    ATTRIBUTE_NONNULL(1);
+{
+    qemuDomainObjPrivate *priv = vm->privateData;
 
-static void
+    if (phase < priv->job.phase) {
+        VIR_ERROR(_("migration protocol going backwards %s => %s"),
+                  qemuMigrationJobPhaseTypeToString(priv->job.phase),
+                  qemuMigrationJobPhaseTypeToString(phase));
+        return;
+    }
+
+    qemuDomainObjSetJobPhase(vm, phase);
+}
+
+
+static void ATTRIBUTE_NONNULL(1)
 qemuMigrationJobStartPhase(virDomainObj *vm,
                            qemuMigrationJobPhase phase)
-    ATTRIBUTE_NONNULL(1);
+{
+    qemuMigrationJobSetPhase(vm, phase);
+}
 
-static void
-qemuMigrationJobContinue(virDomainObj *obj)
-    ATTRIBUTE_NONNULL(1);
 
-static bool
+static void ATTRIBUTE_NONNULL(1)
+qemuMigrationJobContinue(virDomainObj *vm)
+{
+    qemuDomainObjReleaseAsyncJob(vm);
+}
+
+
+static bool ATTRIBUTE_NONNULL(1)
 qemuMigrationJobIsActive(virDomainObj *vm,
                          virDomainAsyncJob job)
-    ATTRIBUTE_NONNULL(1);
+{
+    qemuDomainObjPrivate *priv = vm->privateData;
+
+    if (priv->job.asyncJob != job) {
+        const char *msg;
+
+        if (job == VIR_ASYNC_JOB_MIGRATION_IN)
+            msg = _("domain '%s' is not processing incoming migration");
+        else
+            msg = _("domain '%s' is not being migrated");
+
+        virReportError(VIR_ERR_OPERATION_INVALID, msg, vm->def->name);
+        return false;
+    }
+    return true;
+}
+
+
+static void ATTRIBUTE_NONNULL(1)
+qemuMigrationJobFinish(virDomainObj *vm)
+{
+    qemuDomainObjEndAsyncJob(vm);
+}
 
-static void
-qemuMigrationJobFinish(virDomainObj *obj)
-    ATTRIBUTE_NONNULL(1);
 
 static void
 qemuMigrationSrcStoreDomainState(virDomainObj *vm)
@@ -6149,92 +6211,6 @@ qemuMigrationSrcCancel(virQEMUDriver *driver,
 }
 
 
-static int
-qemuMigrationJobStart(virQEMUDriver *driver,
-                      virDomainObj *vm,
-                      virDomainAsyncJob job,
-                      unsigned long apiFlags)
-{
-    qemuDomainObjPrivate *priv = vm->privateData;
-    virDomainJobOperation op;
-    unsigned long long mask;
-
-    if (job == VIR_ASYNC_JOB_MIGRATION_IN) {
-        op = VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN;
-        mask = VIR_JOB_NONE;
-    } else {
-        op = VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT;
-        mask = VIR_JOB_DEFAULT_MASK |
-               JOB_MASK(VIR_JOB_SUSPEND) |
-               JOB_MASK(VIR_JOB_MIGRATION_OP);
-    }
-
-    if (qemuDomainObjBeginAsyncJob(driver, vm, job, op, apiFlags) < 0)
-        return -1;
-
-    qemuDomainJobSetStatsType(priv->job.current,
-                              QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION);
-
-    qemuDomainObjSetAsyncJobMask(vm, mask);
-    return 0;
-}
-
-static void
-qemuMigrationJobSetPhase(virDomainObj *vm,
-                         qemuMigrationJobPhase phase)
-{
-    qemuDomainObjPrivate *priv = vm->privateData;
-
-    if (phase < priv->job.phase) {
-        VIR_ERROR(_("migration protocol going backwards %s => %s"),
-                  qemuMigrationJobPhaseTypeToString(priv->job.phase),
-                  qemuMigrationJobPhaseTypeToString(phase));
-        return;
-    }
-
-    qemuDomainObjSetJobPhase(vm, phase);
-}
-
-static void
-qemuMigrationJobStartPhase(virDomainObj *vm,
-                           qemuMigrationJobPhase phase)
-{
-    qemuMigrationJobSetPhase(vm, phase);
-}
-
-static void
-qemuMigrationJobContinue(virDomainObj *vm)
-{
-    qemuDomainObjReleaseAsyncJob(vm);
-}
-
-static bool
-qemuMigrationJobIsActive(virDomainObj *vm,
-                         virDomainAsyncJob job)
-{
-    qemuDomainObjPrivate *priv = vm->privateData;
-
-    if (priv->job.asyncJob != job) {
-        const char *msg;
-
-        if (job == VIR_ASYNC_JOB_MIGRATION_IN)
-            msg = _("domain '%s' is not processing incoming migration");
-        else
-            msg = _("domain '%s' is not being migrated");
-
-        virReportError(VIR_ERR_OPERATION_INVALID, msg, vm->def->name);
-        return false;
-    }
-    return true;
-}
-
-static void
-qemuMigrationJobFinish(virDomainObj *vm)
-{
-    qemuDomainObjEndAsyncJob(vm);
-}
-
-
 static void
 qemuMigrationDstErrorFree(void *data)
 {
-- 
2.35.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux