From f4f3e6de4af28a8c56b33429aa31b4ae9b3bc70e Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 21 Jul 2020 16:27:52 +0200 Subject: [PATCH] qemuDomainNamespaceTeardownInput: Deduplicate code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can use qemuDomainSetupInput() to obtain the path that we need to unlink() from within domain's namespace. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- src/qemu/qemu_namespace.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 41fbede737..797722b714 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -1359,16 +1359,6 @@ qemuNamespaceUnlinkPaths(virDomainObjPtr vm, } -static int -qemuNamespaceUnlinkPath(virDomainObjPtr vm, - const char *path) -{ - const char *paths[] = { path, NULL }; - - return qemuNamespaceUnlinkPaths(vm, paths); -} - - int qemuDomainNamespaceSetupDisk(virDomainObjPtr vm, virStorageSourcePtr src) @@ -1604,15 +1594,15 @@ int qemuDomainNamespaceTeardownInput(virDomainObjPtr vm, virDomainInputDefPtr input) { - const char *path = NULL; + VIR_AUTOSTRINGLIST paths = NULL; if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) return 0; - if (!(path = virDomainInputDefGetPath(input))) - return 0; + if (qemuDomainSetupInput(input, &paths) < 0) + return -1; - if (path && qemuNamespaceUnlinkPath(vm, path) < 0) + if (qemuNamespaceUnlinkPaths(vm, (const char **) paths) < 0) return -1; return 0;