diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-07-23 18:56:20 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-07-23 20:17:24 +0100 |
commit | 3614d76b37ee8ef90f5a280e1bb51bccd87eaadb (patch) | |
tree | fcf80c1d1cee66100a7bb15c2dba319042bb0923 /src/launch.c | |
parent | a6366f5dae0e8332cfdad0894aa6e5c7fc3faa2c (diff) | |
download | libguestfs-3614d76b37ee8ef90f5a280e1bb51bccd87eaadb.tar.gz libguestfs-3614d76b37ee8ef90f5a280e1bb51bccd87eaadb.tar.xz libguestfs-3614d76b37ee8ef90f5a280e1bb51bccd87eaadb.zip |
tests: Move debug-drives testing API to launch.c and change the output.
It should work with any attach-method.
Diffstat (limited to 'src/launch.c')
-rw-r--r-- | src/launch.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/launch.c b/src/launch.c index 02441db1..387c91f0 100644 --- a/src/launch.c +++ b/src/launch.c @@ -289,6 +289,37 @@ guestfs__config (guestfs_h *g, return 0; } +/* Internal command to return the list of drives. */ +char ** +guestfs__debug_drives (guestfs_h *g) +{ + size_t i, count; + char **ret; + struct drive *drv; + + for (count = 0, drv = g->drives; drv; count++, drv = drv->next) + ; + + ret = safe_malloc (g, sizeof (char *) * (count + 1)); + + for (i = 0, drv = g->drives; drv; i++, drv = drv->next) { + ret[i] = safe_asprintf (g, "path=%s%s%s%s%s%s%s%s%s", + drv->path, + drv->readonly ? " readonly" : "", + drv->format ? " format=" : "", + drv->format ? : "", + drv->iface ? " iface=" : "", + drv->iface ? : "", + drv->name ? " name=" : "", + drv->name ? : "", + drv->use_cache_none ? " cache=none" : ""); + } + + ret[count] = NULL; + + return ret; /* caller frees */ +} + int guestfs__launch (guestfs_h *g) { |