[PATCH 2/5] qemu: move macros QEMU_X into hypervisor as VIR_X

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

 



It makes sense to have these in the same file as the definitions
of enums.

Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
 src/hypervisor/domain_job.h | 12 ++++++++++++
 src/qemu/qemu_backup.c      |  2 +-
 src/qemu/qemu_domainjob.c   |  4 ++--
 src/qemu/qemu_domainjob.h   | 11 -----------
 src/qemu/qemu_migration.c   |  2 +-
 src/qemu/qemu_process.c     |  4 ++--
 src/qemu/qemu_snapshot.c    |  4 ++--
 7 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/hypervisor/domain_job.h b/src/hypervisor/domain_job.h
index b9d1107580..4f165f730d 100644
--- a/src/hypervisor/domain_job.h
+++ b/src/hypervisor/domain_job.h
@@ -8,6 +8,18 @@
 #include "internal.h"
 #include "virenum.h"
 
+#define JOB_MASK(job)                  (job == 0 ? 0 : 1 << (job - 1))
+#define VIR_JOB_DEFAULT_MASK \
+    (JOB_MASK(VIR_JOB_QUERY) | \
+     JOB_MASK(VIR_JOB_DESTROY) | \
+     JOB_MASK(VIR_JOB_ABORT))
+
+/* Jobs which have to be tracked in domain state XML. */
+#define VIR_DOMAIN_TRACK_JOBS \
+    (JOB_MASK(VIR_JOB_DESTROY) | \
+     JOB_MASK(VIR_JOB_ASYNC))
+
+
 /* Only 1 job is allowed at any time
  * A job includes *all* monitor commands, even those just querying
  * information, not merely actions */
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index 5d24155628..427c090dd8 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -795,7 +795,7 @@ qemuBackupBegin(virDomainObj *vm,
                                    VIR_DOMAIN_JOB_OPERATION_BACKUP, flags) < 0)
         return -1;
 
-    qemuDomainObjSetAsyncJobMask(vm, (QEMU_JOB_DEFAULT_MASK |
+    qemuDomainObjSetAsyncJobMask(vm, (VIR_JOB_DEFAULT_MASK |
                                       JOB_MASK(VIR_JOB_SUSPEND) |
                                       JOB_MASK(VIR_JOB_MODIFY)));
     qemuDomainJobSetStatsType(priv->job.current,
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 71876fe6a3..ab542865ca 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -204,7 +204,7 @@ qemuDomainObjResetAsyncJob(qemuDomainJobObj *job)
     g_clear_pointer(&job->asyncOwnerAPI, g_free);
     job->asyncStarted = 0;
     job->phase = 0;
-    job->mask = QEMU_JOB_DEFAULT_MASK;
+    job->mask = VIR_JOB_DEFAULT_MASK;
     job->abortJob = false;
     VIR_FREE(job->error);
     g_clear_pointer(&job->current, virDomainJobDataFree);
@@ -256,7 +256,7 @@ qemuDomainObjClearJob(qemuDomainJobObj *job)
 bool
 qemuDomainTrackJob(virDomainJob job)
 {
-    return (QEMU_DOMAIN_TRACK_JOBS & JOB_MASK(job)) != 0;
+    return (VIR_DOMAIN_TRACK_JOBS & JOB_MASK(job)) != 0;
 }
 
 
diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h
index 6520b42c80..faf47105a3 100644
--- a/src/qemu/qemu_domainjob.h
+++ b/src/qemu/qemu_domainjob.h
@@ -22,17 +22,6 @@
 #include "qemu_monitor.h"
 #include "domain_job.h"
 
-#define JOB_MASK(job)                  (job == 0 ? 0 : 1 << (job - 1))
-#define QEMU_JOB_DEFAULT_MASK \
-    (JOB_MASK(VIR_JOB_QUERY) | \
-     JOB_MASK(VIR_JOB_DESTROY) | \
-     JOB_MASK(VIR_JOB_ABORT))
-
-/* Jobs which have to be tracked in domain state XML. */
-#define QEMU_DOMAIN_TRACK_JOBS \
-    (JOB_MASK(VIR_JOB_DESTROY) | \
-     JOB_MASK(VIR_JOB_ASYNC))
-
 
 typedef enum {
     QEMU_DOMAIN_JOB_STATS_TYPE_NONE = 0,
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 43ffe2357a..b591514533 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -6105,7 +6105,7 @@ qemuMigrationJobStart(virQEMUDriver *driver,
         mask = VIR_JOB_NONE;
     } else {
         op = VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT;
-        mask = QEMU_JOB_DEFAULT_MASK |
+        mask = VIR_JOB_DEFAULT_MASK |
                JOB_MASK(VIR_JOB_SUSPEND) |
                JOB_MASK(VIR_JOB_MIGRATION_OP);
     }
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 189e4671d1..bf514bc963 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3657,7 +3657,7 @@ qemuProcessRecoverJob(virQEMUDriver *driver,
         priv->job.asyncOwnerAPI = g_strdup(virThreadJobGet());
         priv->job.asyncStarted = now;
 
-        qemuDomainObjSetAsyncJobMask(vm, (QEMU_JOB_DEFAULT_MASK |
+        qemuDomainObjSetAsyncJobMask(vm, (VIR_JOB_DEFAULT_MASK |
                                           JOB_MASK(VIR_JOB_SUSPEND) |
                                           JOB_MASK(VIR_JOB_MODIFY)));
 
@@ -3682,7 +3682,7 @@ qemuProcessRecoverJob(virQEMUDriver *driver,
         return -1;
 
     /* In case any special handling is added for job type that has been ignored
-     * before, QEMU_DOMAIN_TRACK_JOBS (from qemu_domain.h) needs to be updated
+     * before, VIR_DOMAIN_TRACK_JOBS (from qemu_domain.h) needs to be updated
      * for the job to be properly tracked in domain state XML.
      */
     switch (job->active) {
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 185fcb04a2..4a05cddc54 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -1433,7 +1433,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
                                   QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP);
 
         /* allow the migration job to be cancelled or the domain to be paused */
-        qemuDomainObjSetAsyncJobMask(vm, (QEMU_JOB_DEFAULT_MASK |
+        qemuDomainObjSetAsyncJobMask(vm, (VIR_JOB_DEFAULT_MASK |
                                           JOB_MASK(VIR_JOB_SUSPEND) |
                                           JOB_MASK(VIR_JOB_MIGRATION_OP)));
 
@@ -1466,7 +1466,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
             memory_unlink = true;
 
         /* forbid any further manipulation */
-        qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_DEFAULT_MASK);
+        qemuDomainObjSetAsyncJobMask(vm, VIR_JOB_DEFAULT_MASK);
     }
 
     /* the domain is now paused if a memory snapshot was requested */
-- 
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