A function that creates a chardev source with the appropriate
socket path set.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_domain.c | 13 +++++++++++++
src/qemu/qemu_domain.h | 4 ++++
2 files changed, 17 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index cb6aaecdee..5f467760c3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11450,3 +11450,16 @@ qemuDomainGetVHostUserFSSocketPath(qemuDomainObjPrivate *priv,
return g_strdup(fs->sock);
return virFileBuildPath(priv->libDir, fs->info.alias, "-fs.sock");
}
+
+
+virDomainChrSourceDef *
+qemuDomainGetVHostUserChrSourceDef(qemuDomainObjPrivate *priv,
+ const virDomainFSDef *fs)
+{
+ virDomainChrSourceDef *src = virDomainChrSourceDefNew(priv->driver->xmlopt);
+
+ src->type = VIR_DOMAIN_CHR_TYPE_UNIX;
+ src->data.nix.path = qemuDomainGetVHostUserFSSocketPath(priv, fs);
+
+ return src;
+}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index aad076dd4c..59cb703c16 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1047,3 +1047,7 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfig *cfg,
char *
qemuDomainGetVHostUserFSSocketPath(qemuDomainObjPrivate *priv,
const virDomainFSDef *fs);
+
+virDomainChrSourceDef *
+qemuDomainGetVHostUserChrSourceDef(qemuDomainObjPrivate *priv,
+ const virDomainFSDef *fs);
--
2.31.1