This patch moves qemuDomainObjInitJob() as virDomainObjInitJob()
into hypervisor in order to be used by other drivers as well.

Signed-off-by: Kristina Hanicova <khani...@redhat.com>
---
 src/hypervisor/domain_job.c | 25 +++++++++++++++++++++++++
 src/hypervisor/domain_job.h |  4 ++++
 src/libvirt_private.syms    |  1 +
 src/qemu/qemu_domain.c      |  2 +-
 src/qemu/qemu_domainjob.c   | 26 --------------------------
 src/qemu/qemu_domainjob.h   |  4 ----
 6 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/src/hypervisor/domain_job.c b/src/hypervisor/domain_job.c
index 6a0fbd42b3..1ee70ea11e 100644
--- a/src/hypervisor/domain_job.c
+++ b/src/hypervisor/domain_job.c
@@ -112,3 +112,28 @@ virDomainJobStatusToType(virDomainJobStatus status)
 
     return VIR_DOMAIN_JOB_NONE;
 }
+
+int
+virDomainObjInitJob(virDomainJobObj *job,
+                    virDomainObjPrivateJobCallbacks *cb)
+{
+    memset(job, 0, sizeof(*job));
+    job->cb = cb;
+
+    if (virCondInit(&job->cond) < 0)
+        return -1;
+
+    if (virCondInit(&job->asyncCond) < 0) {
+        virCondDestroy(&job->cond);
+        return -1;
+    }
+
+    if (job->cb &&
+        !(job->privateData = job->cb->allocJobPrivate())) {
+        virCondDestroy(&job->cond);
+        virCondDestroy(&job->asyncCond);
+        return -1;
+    }
+
+    return 0;
+}
diff --git a/src/hypervisor/domain_job.h b/src/hypervisor/domain_job.h
index 9c203189a6..7c65c4f8cd 100644
--- a/src/hypervisor/domain_job.h
+++ b/src/hypervisor/domain_job.h
@@ -204,3 +204,7 @@ struct _virDomainObjPrivateJobCallbacks {
    virDomainObjPrivateJobFormat formatJobPrivate;
    virDomainObjPrivateJobParse parseJobPrivate;
 };
+
+
+int virDomainObjInitJob(virDomainJobObj *job,
+                        virDomainObjPrivateJobCallbacks *cb);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index f4732f1742..58c05a532c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1590,6 +1590,7 @@ virDomainJobDataInit;
 virDomainJobStatusToType;
 virDomainJobTypeFromString;
 virDomainJobTypeToString;
+virDomainObjInitJob;
 
 
 # hypervisor/virclosecallbacks.h
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 2d7f6d761d..7df8041adf 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1755,7 +1755,7 @@ qemuDomainObjPrivateAlloc(void *opaque)
 {
     g_autoptr(qemuDomainObjPrivate) priv = g_new0(qemuDomainObjPrivate, 1);
 
-    if (qemuDomainObjInitJob(&priv->job, &qemuPrivateJobCallbacks) < 0) {
+    if (virDomainObjInitJob(&priv->job, &qemuPrivateJobCallbacks) < 0) {
         virReportSystemError(errno, "%s",
                              _("Unable to init qemu driver mutexes"));
         return NULL;
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 82189393a2..74ea975e44 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -150,32 +150,6 @@ qemuDomainEventEmitJobCompleted(virQEMUDriver *driver,
 }
 
 
-int
-qemuDomainObjInitJob(virDomainJobObj *job,
-                     virDomainObjPrivateJobCallbacks *cb)
-{
-    memset(job, 0, sizeof(*job));
-    job->cb = cb;
-
-    if (virCondInit(&job->cond) < 0)
-        return -1;
-
-    if (virCondInit(&job->asyncCond) < 0) {
-        virCondDestroy(&job->cond);
-        return -1;
-    }
-
-    if (job->cb &&
-        !(job->privateData = job->cb->allocJobPrivate())) {
-        virCondDestroy(&job->cond);
-        virCondDestroy(&job->asyncCond);
-        return -1;
-    }
-
-    return 0;
-}
-
-
 static void
 qemuDomainObjResetJob(virDomainJobObj *job)
 {
diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h
index b39b04edcb..36747154c6 100644
--- a/src/qemu/qemu_domainjob.h
+++ b/src/qemu/qemu_domainjob.h
@@ -138,10 +138,6 @@ bool qemuDomainTrackJob(virDomainJob job);
 void qemuDomainObjClearJob(virDomainJobObj *job);
 G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virDomainJobObj, qemuDomainObjClearJob);
 
-int
-qemuDomainObjInitJob(virDomainJobObj *job,
-                     virDomainObjPrivateJobCallbacks *cb);
-
 int
 qemuDomainObjPrivateXMLFormatJob(virBuffer *buf,
                                  virDomainObj *vm);
-- 
2.35.3

Reply via email to