The function qemuGetMemoryBackingPath() does not need the @def any more
and priv->memoryBackingDir can be used instead of constructing the path
by calling qemuGetMemoryBackingDomainPath().
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_command.c | 4 ++--
src/qemu/qemu_domain.c | 8 +-------
src/qemu/qemu_domain.h | 1 -
src/qemu/qemu_process.c | 9 +++------
4 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f36b02b76b35..167ee8240b22 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3222,7 +3222,7 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
} else {
/* We can have both pagesize and mem source. If that's the case,
* prefer hugepages as those are more specific. */
- if (qemuGetMemoryBackingPath(priv, def, mem->info.alias, &memPath)
< 0)
+ if (qemuGetMemoryBackingPath(priv, mem->info.alias, &memPath) < 0)
return -1;
}
@@ -7116,7 +7116,7 @@ qemuBuildMemPathStr(const virDomainDef *def,
return -1;
prealloc = true;
} else if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
- if (qemuGetMemoryBackingPath(priv, def, "ram", &mem_path) < 0)
+ if (qemuGetMemoryBackingPath(priv, "ram", &mem_path) < 0)
return -1;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b05b1c9647a8..3e80313ab748 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1762,7 +1762,6 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *priv,
/**
* qemuGetMemoryBackingPath:
* @priv: domain private data
- * @def: domain definition
* @alias: memory object alias
* @memPath: constructed path
*
@@ -1773,12 +1772,9 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *priv,
*/
int
qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv,
- const virDomainDef *def,
const char *alias,
char **memPath)
{
- g_autofree char *domainPath = NULL;
-
if (!alias) {
/* This should never happen (TM) */
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1786,10 +1782,8 @@ qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv,
return -1;
}
- if (qemuGetMemoryBackingDomainPath(priv, def, &domainPath) < 0)
- return -1;
+ *memPath = g_strdup_printf("%s/%s", priv->memoryBackingDir, alias);
- *memPath = g_strdup_printf("%s/%s", domainPath, alias);
return 0;
}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 8f41c4af81c0..dcff4272b869 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -944,7 +944,6 @@ int qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *priv,
char **path);
int qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv,
- const virDomainDef *def,
const char *alias,
char **memPath);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1d3a905dd854..dd3afbeb39ac 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4094,12 +4094,9 @@ qemuProcessBuildDestroyMemoryPaths(virQEMUDriver *driver,
}
if (!build || shouldBuildMB) {
- g_autofree char *path = NULL;
- if (qemuGetMemoryBackingDomainPath(QEMU_DOMAIN_PRIVATE(vm), vm->def,
&path) < 0)
- return -1;
-
if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm,
- path, build) < 0)
+
QEMU_DOMAIN_PRIVATE(vm)->memoryBackingDir,
+ build) < 0)
return -1;
}
@@ -4113,7 +4110,7 @@ qemuProcessDestroyMemoryBackingPath(virDomainObj *vm,
{
g_autofree char *path = NULL;
- if (qemuGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm), vm->def, mem->info.alias,
&path) < 0)
+ if (qemuGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm), mem->info.alias, &path)
< 0)
return -1;
if (unlink(path) < 0 &&
--
2.46.1