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, 7 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5d24439a6ff6..3e98d6707bc6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3421,7 +3421,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;
}
@@ -7315,7 +7315,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 fd7c7fd56218..daec89fca1db 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -13210,8 +13210,7 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *priv,
/**
* qemuGetMemoryBackingPath:
- * @driver: the qemu driver
- * @def: domain definition
+ * @priv: domain private data
* @alias: memory object alias
* @memPath: constructed path
*
@@ -13222,7 +13221,6 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *priv,
*/
int
qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv,
- const virDomainDef *def,
const char *alias,
char **memPath)
{
@@ -13235,9 +13233,7 @@ 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 b0fcbdd4673b..93d72c095160 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1177,6 +1177,5 @@ 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.0