mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-30 16:35:24 +00:00
hypervisor: domain_job: add JobData private callbacks into virDomainJobObj
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
42543a083a
commit
377924ea08
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user