We need this callback structure for qemu driver only, but it makes more sense to include it in the virDomainJobObj in case of other future additions than as a parameter of a beginJob functions. Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> --- src/ch/ch_domain.c | 2 +- src/hypervisor/domain_job.c | 4 +++- src/hypervisor/domain_job.h | 5 ++++- src/libxl/libxl_domain.c | 2 +- src/lxc/lxc_domain.c | 2 +- src/qemu/qemu_domain.c | 3 ++- src/qemu/qemu_domainjob.c | 2 +- 7 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c index 817b1176d5..89b494b388 100644 --- a/src/ch/ch_domain.c +++ b/src/ch/ch_domain.c @@ -117,7 +117,7 @@ virCHDomainObjPrivateAlloc(void *opaque) priv = g_new0(virCHDomainObjPrivate, 1); - if (virDomainObjInitJob(&priv->job, NULL) < 0) { + if (virDomainObjInitJob(&priv->job, NULL, NULL) < 0) { g_free(priv); return NULL; } diff --git a/src/hypervisor/domain_job.c b/src/hypervisor/domain_job.c index 0afed46418..77110d2a23 100644 --- a/src/hypervisor/domain_job.c +++ b/src/hypervisor/domain_job.c @@ -116,10 +116,12 @@ virDomainJobStatusToType(virDomainJobStatus status) int virDomainObjInitJob(virDomainJobObj *job, - virDomainObjPrivateJobCallbacks *cb) + virDomainObjPrivateJobCallbacks *cb, + virDomainJobDataPrivateDataCallbacks *jobDataPrivateCb) { memset(job, 0, sizeof(*job)); job->cb = cb; + job->jobDataPrivateCb = jobDataPrivateCb; if (virCondInit(&job->cond) < 0) return -1; diff --git a/src/hypervisor/domain_job.h b/src/hypervisor/domain_job.h index 7f35d5ee85..334b59c465 100644 --- a/src/hypervisor/domain_job.h +++ b/src/hypervisor/domain_job.h @@ -185,6 +185,8 @@ struct _virDomainJobObj { void *privateData; /* job specific collection of data */ virDomainObjPrivateJobCallbacks *cb; + virDomainJobDataPrivateDataCallbacks *jobDataPrivateCb; /* callbacks for privateData of + virDomainJobData, can be NULL */ }; @@ -210,7 +212,8 @@ struct _virDomainObjPrivateJobCallbacks { int virDomainObjInitJob(virDomainJobObj *job, - virDomainObjPrivateJobCallbacks *cb); + virDomainObjPrivateJobCallbacks *cb, + virDomainJobDataPrivateDataCallbacks *jobDataPrivateCb); void virDomainObjResetJob(virDomainJobObj *job); diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 9a23598512..52e0aa1e60 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -161,7 +161,7 @@ libxlDomainObjPrivateAlloc(void *opaque G_GNUC_UNUSED) return NULL; } - if (virDomainObjInitJob(&priv->job, NULL) < 0) { + if (virDomainObjInitJob(&priv->job, NULL, NULL) < 0) { virChrdevFree(priv->devs); g_free(priv); return NULL; diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index 654c35c640..61e59ec726 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -120,7 +120,7 @@ virLXCDomainObjPrivateAlloc(void *opaque) { virLXCDomainObjPrivate *priv = g_new0(virLXCDomainObjPrivate, 1); - if (virDomainObjInitJob(&priv->job, NULL) < 0) { + if (virDomainObjInitJob(&priv->job, NULL, NULL) < 0) { g_free(priv); return NULL; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 93fd11a3c9..abd76dbd66 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1760,7 +1760,8 @@ qemuDomainObjPrivateAlloc(void *opaque) g_autoptr(qemuDomainObjPrivate) priv = g_new0(qemuDomainObjPrivate, 1); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(opaque); - if (virDomainObjInitJob(&priv->job, &qemuPrivateJobCallbacks) < 0) { + if (virDomainObjInitJob(&priv->job, &qemuPrivateJobCallbacks, + &qemuJobDataPrivateDataCallbacks) < 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 1b85e3bb2d..66a91a3e4f 100644 --- a/src/qemu/qemu_domainjob.c +++ b/src/qemu/qemu_domainjob.c @@ -817,7 +817,7 @@ qemuDomainObjBeginJobInternal(virDomainObj *obj, virDomainAsyncJobTypeToString(asyncJob), obj, obj->def->name); virDomainObjResetAsyncJob(&priv->job); - priv->job.current = virDomainJobDataInit(&qemuJobDataPrivateDataCallbacks); + priv->job.current = virDomainJobDataInit(priv->job.jobDataPrivateCb); priv->job.current->status = VIR_DOMAIN_JOB_STATUS_ACTIVE; priv->job.asyncJob = asyncJob; priv->job.asyncOwner = virThreadSelfID(); -- 2.37.1