On Tue, Jul 19, 2016 at 10:30:47AM -0400, John Ferlan wrote:
Move QEMU_DRIVE_HOST_PREFIX into the qemu_alias.c to disuade future
s/disuade/dissuade/
disuade is the Spanish spelling. I know that because I had to look it up
in the dictionary anyway.
callers from using it. Create qemuAliasDeviceDiskDriveSkipPrefix in
order to handle the current consumers that desire to check if an alias
has the drive- prefix and "get beyond it" in order to get the disk alias.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_alias.c | 17 +++++++++++++++++
src/qemu/qemu_alias.h | 4 ++--
src/qemu/qemu_domain.c | 3 +--
src/qemu/qemu_monitor_json.c | 6 ++----
src/qemu/qemu_monitor_text.c | 8 +++-----
src/qemu/qemu_process.c | 3 +--
6 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index 70cd9f1..d80537b 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -29,6 +29,8 @@
#include "virstring.h"
#include "network/bridge_driver.h"
+#define QEMU_DRIVE_HOST_PREFIX "drive-"
+
#define VIR_FROM_THIS VIR_FROM_QEMU
VIR_LOG_INIT("qemu.qemu_alias");
@@ -188,6 +190,21 @@ qemuAssignDeviceDiskDriveAlias(const char *srcalias)
}
+/* qemuAliasDeviceDiskDriveSkipPrefix:
+ * @dev_name: Pointer to a const char string
+ *
+ * If the QEMU_DRIVE_HOST_PREFIX exists in the input string, then
+ * increment the pointer and return it
+ */
+const char *
+qemuAliasDeviceDiskDriveSkipPrefix(const char *dev_name)
I think you can drop the Device without hurting readability.
Jan