To remove dependency of funcitons to access the `privateData` of
qemu-domain, we introduce this callback funciton so that funcitons
get exactly what they need.
Signed-off-by: Prathamesh Chavan <pc44800(a)gmail.com>
---
src/qemu/qemu_domain.c | 8 ++++++++
src/qemu/qemu_domainjob.c | 4 ++--
src/qemu/qemu_domainjob.h | 2 ++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d7a944a886..2e16c8e5fe 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -629,12 +629,20 @@ qemuDomainParseJobPrivate(xmlXPathContextPtr ctxt,
return 0;
}
+static virDomainXMLOptionPtr
+qemuGetDomainXMLOptionPtr(virDomainObjPtr vm)
+{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ return priv->driver->xmlopt;
+
+}
static qemuDomainObjPrivateJobCallbacks qemuPrivateJobCallbacks = {
.allocJobPrivate = qemuJobAllocPrivate,
.freeJobPrivate = qemuJobFreePrivate,
.resetJobPrivate = qemuJobResetPrivate,
.saveStatus = qemuDomainSaveStatus,
+ .getDomainXMLOptionPtr = qemuGetDomainXMLOptionPtr,
.formatJob = qemuDomainFormatJobPrivate,
.parseJob = qemuDomainParseJobPrivate,
.setJobInfoOperation = qemuDomainJobInfoSetOperation,
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 19c847dffc..3eff45fd17 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -765,7 +765,7 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
if (diskPriv->migrSource &&
qemuDomainObjPrivateXMLFormatNBDMigrationSource(&childBuf,
diskPriv->migrSource,
- priv->driver->xmlopt)
< 0)
+
priv->job.cb->getDomainXMLOptionPtr(vm)) < 0)
return -1;
virXMLFormatElement(buf, "disk", &attrBuf, &childBuf);
@@ -892,7 +892,7 @@ qemuDomainObjPrivateXMLParseJobNBD(virDomainObjPtr vm,
if (qemuDomainObjPrivateXMLParseJobNBDSource(nodes[i], ctxt,
disk,
- priv->driver->xmlopt)
< 0)
+
priv->job.cb->getDomainXMLOptionPtr(vm)) < 0)
return -1;
}
}
diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h
index 437a27f74a..220257775d 100644
--- a/src/qemu/qemu_domainjob.h
+++ b/src/qemu/qemu_domainjob.h
@@ -105,6 +105,7 @@ typedef void *(*qemuDomainObjPrivateJobAlloc)(void);
typedef void (*qemuDomainObjPrivateJobFree)(void *);
typedef void (*qemuDomainObjPrivateJobReset)(void *);
typedef void (*qemuSaveStatus)(virDomainObjPtr);
+typedef virDomainXMLOptionPtr (*qemuGetDomainXmlOptionPtr)(virDomainObjPtr);
typedef int (*qemuDomainObjPrivateJobFormat)(virBufferPtr,
qemuDomainJobObjPtr);
typedef int (*qemuDomainObjPrivateJobParse)(xmlXPathContextPtr,
@@ -121,6 +122,7 @@ struct _qemuDomainObjPrivateJobCallbacks {
qemuDomainObjPrivateJobFree freeJobPrivate;
qemuDomainObjPrivateJobReset resetJobPrivate;
qemuSaveStatus saveStatus;
+ qemuGetDomainXmlOptionPtr getDomainXMLOptionPtr;
qemuDomainObjPrivateJobFormat formatJob;
qemuDomainObjPrivateJobParse parseJob;
qemuDomainObjJobInfoSetOperation setJobInfoOperation;
--
2.25.1