[PATCH 41/43] virDomainJobObj: Use 'unsigned int' instead of 'unsigned long' for 'apiFlags' field

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

 



The callers store only an 'unsigned int' in the field. Convert it to the
proper type including parser/formatter.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/virdomainjob.c          | 4 ++--
 src/conf/virdomainjob.h          | 4 ++--
 src/qemu/qemu_domainjob.c        | 7 +++----
 src/qemu/qemu_migration.c        | 2 +-
 src/qemu/qemu_migration_params.c | 8 ++++----
 src/qemu/qemu_migration_params.h | 4 ++--
 src/qemu/qemu_process.c          | 2 +-
 src/qemu/qemu_process.h          | 2 +-
 8 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/src/conf/virdomainjob.c b/src/conf/virdomainjob.c
index ca0215bc23..256b665a42 100644
--- a/src/conf/virdomainjob.c
+++ b/src/conf/virdomainjob.c
@@ -431,7 +431,7 @@ virDomainObjBeginJobInternal(virDomainObj *obj,

     VIR_WARN("Cannot start job (%s, %s, %s) in API %s for domain %s; "
              "current job is (%s, %s, %s) "
-             "owned by (%llu %s, %llu %s, %llu %s (flags=0x%lx)) "
+             "owned by (%llu %s, %llu %s, %llu %s (flags=0x%x)) "
              "for (%llus, %llus, %llus)",
              virDomainJobTypeToString(job),
              virDomainAgentJobTypeToString(agentJob),
@@ -550,7 +550,7 @@ virDomainObjBeginAgentJob(virDomainObj *obj,
 int virDomainObjBeginAsyncJob(virDomainObj *obj,
                               virDomainAsyncJob asyncJob,
                               virDomainJobOperation operation,
-                              unsigned long apiFlags)
+                              unsigned int apiFlags)
 {
     if (virDomainObjBeginJobInternal(obj, obj->job, VIR_JOB_ASYNC,
                                      VIR_AGENT_JOB_NONE,
diff --git a/src/conf/virdomainjob.h b/src/conf/virdomainjob.h
index c101334596..b1ac36a2fa 100644
--- a/src/conf/virdomainjob.h
+++ b/src/conf/virdomainjob.h
@@ -182,7 +182,7 @@ struct _virDomainJobObj {
     virDomainJobData *completed;     /* statistics data of a recently completed job */
     bool abortJob;                      /* abort of the job requested */
     char *error;                        /* job event completion error */
-    unsigned long apiFlags; /* flags passed to the API which started the async job */
+    unsigned int apiFlags; /* flags passed to the API which started the async job */

     void *privateData;                  /* job specific collection of data */
     virDomainObjPrivateJobCallbacks *cb;
@@ -255,7 +255,7 @@ int virDomainObjBeginAgentJob(virDomainObj *obj,
 int virDomainObjBeginAsyncJob(virDomainObj *obj,
                               virDomainAsyncJob asyncJob,
                               virDomainJobOperation operation,
-                              unsigned long apiFlags)
+                              unsigned int apiFlags)
     G_GNUC_WARN_UNUSED_RESULT;
 int virDomainObjBeginNestedJob(virDomainObj *obj,
                                virDomainAsyncJob asyncJob)
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index a170fdd97d..4d320f075e 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -692,7 +692,7 @@ qemuDomainObjPrivateXMLFormatJob(virBuffer *buf,
     }

     if (vm->job->asyncJob != VIR_ASYNC_JOB_NONE) {
-        virBufferAsprintf(&attrBuf, " flags='0x%lx'", vm->job->apiFlags);
+        virBufferAsprintf(&attrBuf, " flags='0x%x'", vm->job->apiFlags);
         virBufferAsprintf(&attrBuf, " asyncStarted='%llu'", vm->job->asyncStarted);
     }

@@ -758,10 +758,9 @@ qemuDomainObjPrivateXMLParseJob(virDomainObj *vm,
         }
     }

-    if (virXPathULongHex("string(@flags)", ctxt, &vm->job->apiFlags) == -2) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid job flags"));
+    if (virXMLPropUInt(ctxt->node, "flags", 16, VIR_XML_PROP_NONE,
+                       &vm->job->apiFlags) < 0)
         return -1;
-    }

     if (vm->job->cb &&
         vm->job->cb->parseJobPrivate(ctxt, job, vm) < 0)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 33105cf07b..53c655fb93 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -101,7 +101,7 @@ qemuMigrationJobIsAllowed(virDomainObj *vm)
 static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT
 qemuMigrationJobStart(virDomainObj *vm,
                       virDomainAsyncJob job,
-                      unsigned long apiFlags)
+                      unsigned int apiFlags)
 {
     virDomainJobOperation op;
     unsigned long long mask;
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 7a023b36c8..bee0af9fca 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -919,7 +919,7 @@ int
 qemuMigrationParamsApply(virDomainObj *vm,
                          int asyncJob,
                          qemuMigrationParams *migParams,
-                         unsigned long apiFlags)
+                         unsigned int apiFlags)
 {
     bool postcopyResume = !!(apiFlags & VIR_MIGRATE_POSTCOPY_RESUME);
     int ret = -1;
@@ -1117,7 +1117,7 @@ static void
 qemuMigrationParamsResetTLS(virDomainObj *vm,
                             int asyncJob,
                             qemuMigrationParams *origParams,
-                            unsigned long apiFlags)
+                            unsigned int apiFlags)
 {
     g_autofree char *tlsAlias = NULL;
     g_autofree char *secAlias = NULL;
@@ -1280,7 +1280,7 @@ void
 qemuMigrationParamsReset(virDomainObj *vm,
                          int asyncJob,
                          qemuMigrationParams *origParams,
-                         unsigned long apiFlags)
+                         unsigned int apiFlags)
 {
     virErrorPtr err;
     g_autoptr(virBitmap) clearCaps = NULL;
@@ -1288,7 +1288,7 @@ qemuMigrationParamsReset(virDomainObj *vm,

     virErrorPreserveLast(&err);

-    VIR_DEBUG("Resetting migration parameters %p, flags 0x%lx",
+    VIR_DEBUG("Resetting migration parameters %p, flags 0x%x",
               origParams, apiFlags);

     if (!virDomainObjIsActive(vm) || !origParams)
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index c58a933ab6..5612a4d283 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -98,7 +98,7 @@ int
 qemuMigrationParamsApply(virDomainObj *vm,
                          int asyncJob,
                          qemuMigrationParams *migParams,
-                         unsigned long apiFlags);
+                         unsigned int apiFlags);

 int
 qemuMigrationParamsEnableTLS(virQEMUDriver *driver,
@@ -145,7 +145,7 @@ void
 qemuMigrationParamsReset(virDomainObj *vm,
                          int asyncJob,
                          qemuMigrationParams *origParams,
-                         unsigned long apiFlags);
+                         unsigned int apiFlags);

 void
 qemuMigrationParamsFormat(virBuffer *buf,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f405326312..48b3e07f09 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4689,7 +4689,7 @@ qemuProcessIncomingDefNew(virQEMUCaps *qemuCaps,
 int
 qemuProcessBeginJob(virDomainObj *vm,
                     virDomainJobOperation operation,
-                    unsigned long apiFlags)
+                    unsigned int apiFlags)
 {
     if (virDomainObjBeginAsyncJob(vm, VIR_ASYNC_JOB_START,
                                    operation, apiFlags) < 0)
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 4dfb2485c0..d1f58ee258 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -65,7 +65,7 @@ void qemuProcessIncomingDefFree(qemuProcessIncomingDef *inc);

 int qemuProcessBeginJob(virDomainObj *vm,
                         virDomainJobOperation operation,
-                        unsigned long apiFlags);
+                        unsigned int apiFlags);
 void qemuProcessEndJob(virDomainObj *vm);

 typedef enum {
-- 
2.37.3




[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