summaryrefslogtreecommitdiffstats
path: root/daemon/guestfsd.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-06 12:55:26 +0100
committerRichard Jones <rjones@redhat.com>2009-04-06 12:55:26 +0100
commit8e570870f577ff0c3db074f88924633b559af5d4 (patch)
tree711af1263615c8cd977eceb0e4286425b53bd725 /daemon/guestfsd.c
parent1cf85b1e60e85c4940869c6291d75ac44a5bd190 (diff)
downloadlibguestfs-8e570870f577ff0c3db074f88924633b559af5d4.tar.gz
libguestfs-8e570870f577ff0c3db074f88924633b559af5d4.tar.xz
libguestfs-8e570870f577ff0c3db074f88924633b559af5d4.zip
Implement list-devices and list-partitions.
Diffstat (limited to 'daemon/guestfsd.c')
-rw-r--r--daemon/guestfsd.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 6730c1d2..a243c0be 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -272,6 +272,20 @@ count_strings (char **argv)
return argc;
}
+static int
+compare (const void *vp1, const void *vp2)
+{
+ char * const *p1 = (char * const *) vp1;
+ char * const *p2 = (char * const *) vp2;
+ return strcmp (*p1, *p2);
+}
+
+void
+sort_strings (char **argv, int len)
+{
+ qsort (argv, len, sizeof (char *), compare);
+}
+
void
free_strings (char **argv)
{
@@ -282,6 +296,16 @@ free_strings (char **argv)
free (argv);
}
+void
+free_stringslen (char **argv, int len)
+{
+ int i;
+
+ for (i = 0; i < len; ++i)
+ free (argv[i]);
+ free (argv);
+}
+
/* This is a more sane version of 'system(3)' for running external
* commands. It uses fork/execvp, so we don't need to worry about
* quoting of parameters, and it allows us to capture any error