[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH libguestfs 2/4] launch: Make 'drive_name' into a common function.



From: "Richard W.M. Jones" <rjones redhat com>

This is just code motion.
---
 src/guestfs-internal.h |    1 +
 src/launch-appliance.c |    9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 7707165..f05cec2 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -446,6 +446,7 @@ extern int guestfs___is_dir_nocase (guestfs_h *g, const char *);
 extern char *guestfs___download_to_tmp (guestfs_h *g, struct inspect_fs *fs, const char *filename, const char *basename, uint64_t max_size);
 extern char *guestfs___case_sensitive_path_silently (guestfs_h *g, const char *);
 extern struct inspect_fs *guestfs___search_for_root (guestfs_h *g, const char *root);
+extern char *guestfs___drive_name (size_t index, char *ret);
 
 #if defined(HAVE_HIVEX)
 extern int guestfs___check_for_filesystem_on (guestfs_h *g, const char *device, int is_block, int is_partnum);
diff --git a/src/launch-appliance.c b/src/launch-appliance.c
index f10801c..efc1284 100644
--- a/src/launch-appliance.c
+++ b/src/launch-appliance.c
@@ -40,7 +40,6 @@ static int qemu_supports (guestfs_h *g, const char *option);
 static int qemu_supports_device (guestfs_h *g, const char *device_name);
 static int qemu_supports_virtio_scsi (guestfs_h *g);
 static char *qemu_drive_param (guestfs_h *g, const struct drive *drv, size_t index);
-static char *drive_name (size_t index, char *ret);
 
 /* Functions to build up the qemu command line.  These are only run
  * in the child process so no clean-up is required.
@@ -306,7 +305,7 @@ launch_appliance (guestfs_h *g, const char *arg)
 
       snprintf (appliance_root, sizeof appliance_root, "root=/dev/%cd",
                 virtio_scsi ? 's' : 'v');
-      drive_name (drv_index, &appliance_root[12]);
+      guestfs___drive_name (drv_index, &appliance_root[12]);
     }
 
     if (STRNEQ (QEMU_OPTIONS, "")) {
@@ -953,11 +952,11 @@ qemu_drive_param (guestfs_h *g, const struct drive *drv, size_t index)
 }
 
 /* https://rwmj.wordpress.com/2011/01/09/how-are-linux-drives-named-beyond-drive-26-devsdz/ */
-static char *
-drive_name (size_t index, char *ret)
+char *
+guestfs___drive_name (size_t index, char *ret)
 {
   if (index >= 26)
-    ret = drive_name (index/26 - 1, ret);
+    ret = guestfs___drive_name (index/26 - 1, ret);
   index %= 26;
   *ret++ = 'a' + index;
   *ret = '\0';
-- 
1.7.10.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]