On Tue, Feb 16, 2016 at 19:44:11 -0500, John Ferlan wrote:
Move function to qemu_alias.c, rename it to
qemuDomainDeviceDriveAlias
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_alias.c | 16 ++++++++++++++++
src/qemu/qemu_alias.h | 4 ++++
src/qemu/qemu_command.c | 15 ---------------
src/qemu/qemu_command.h | 3 ---
src/qemu/qemu_hotplug.c | 6 +++---
5 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index efd9222..26d158b 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -32,6 +32,22 @@
VIR_LOG_INIT("qemu.qemu_alias");
+char *
+qemuDomainDeviceDriveAlias(virDomainDiskDefPtr disk,
+ virQEMUCapsPtr qemuCaps)
+{
+ char *ret;
+
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+ ignore_value(virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX,
+ disk->info.alias));
+ } else {
+ ignore_value(VIR_STRDUP(ret, disk->info.alias));
+ }
+ return ret;
+}
+
+
int
qemuDomainDeviceAliasIndex(const virDomainDeviceInfo *info,
const char *prefix)
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index a2eaa27..ece3b6a 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -27,9 +27,13 @@
# include "domain_conf.h"
# include "qemu_capabilities.h"
+# include "qemu_command.h"
So this is for QEMU_DRIVE_HOST_PREFIX. Shouldn't that macro be moved
too? Or perhaps this function stay where it was? At very least, it's
necessary in the code, not in the header to declare this function.
# include "qemu_domain.h"
# include "qemu_domain_address.h"
+char *qemuDomainDeviceDriveAlias(virDomainDiskDefPtr disk,
+ virQEMUCapsPtr qemuCaps);
+
int qemuAssignDeviceChrAlias(virDomainDefPtr def,
virDomainChrDefPtr chr,
ssize_t idx);
Peter