summaryrefslogtreecommitdiffstats
path: root/src/guestfs.c
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2011-10-17 15:28:47 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-10-19 16:26:42 +0100
commitf1041e912b72116d66274d2f15e50ce34a9531fd (patch)
tree8b7d72acd49f65b37e9906dd3d602135d05fa8ee /src/guestfs.c
parent472f02d08b077a5c1ee233d9dcef92ac9b09d4ae (diff)
downloadlibguestfs-f1041e912b72116d66274d2f15e50ce34a9531fd.tar.gz
libguestfs-f1041e912b72116d66274d2f15e50ce34a9531fd.tar.xz
libguestfs-f1041e912b72116d66274d2f15e50ce34a9531fd.zip
launch: Store drive information in guestfs_h
This is a NFC on its own, but provides a place-holder for drive metadata which can be used after launch. Fixes by RWMJ: - Fix the tests: this requires a new internal function 'debug-drives' that dumps out the g->drives information so it can be checked in two of the tests. Previously these tests used 'debug-cmdline'. - Test file existence / use_cache_off in the add_drive_opts function, not when launching qemu in the child process. - Call free along error paths. - Add comments.
Diffstat (limited to 'src/guestfs.c')
-rw-r--r--src/guestfs.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/guestfs.c b/src/guestfs.c
index f7ad9674..170d0d32 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -206,6 +206,7 @@ guestfs_close (guestfs_h *g)
g->events = NULL;
guestfs___free_inspect_info (g);
+ guestfs___free_drives (&g->drives);
/* Close sockets. */
if (g->fd[0] >= 0)
@@ -994,3 +995,21 @@ guestfs___free_string_list (char **argv)
free (argv[i]);
free (argv);
}
+
+void
+guestfs___free_drives (struct drive **drives)
+{
+ struct drive *i = *drives;
+ *drives = NULL;
+
+ while (i != NULL) {
+ struct drive *next = i->next;
+
+ free (i->path);
+ free (i->format);
+ free (i->iface);
+ free (i);
+
+ i = next;
+ }
+}