- /* launch() expects guestfsd to start. However, virt-rescue doesn't
- * run guestfsd, so this will always fail with ECHILD when the
- * appliance exits unexpectedly.
+ guestfs_close (g);
+
+ exit (EXIT_SUCCESS);
+}
+
+static void suggest_filesystems (void);
+
+static int
+compare_keys_len (const void *p1, const void *p2)
+{
+ const char *key1 = * (char * const *) p1;
+ const char *key2 = * (char * const *) p2;
+ return strlen (key1) - strlen (key2);
+}
+
+static size_t
+count_strings (char *const *argv)
+{
+ size_t i;
+
+ for (i = 0; argv[i]; ++i)
+ ;
+ return i;
+}
+
+/* virt-rescue --suggest flag does a kind of inspection on the
+ * drives and suggests mount commands that you should use.
+ */
+static void
+do_suggestion (struct drv *drvs)
+{
+ char **roots;
+ size_t i, j;
+ char *type, *distro, *product_name;
+ int major, minor;
+ char **mps;
+
+ /* For inspection, force add_drives to add the drives read-only. */
+ read_only = 1;
+
+ /* Add drives. */
+ add_drives (drvs, 'a');
+
+ /* Free up data structures, no longer needed after this point. */
+ free_drives (drvs);
+
+ printf (_("Inspecting the virtual machine or disk image ...\n\n"));
+ fflush (stdout);
+
+ if (guestfs_launch (g) == -1)
+ exit (EXIT_FAILURE);
+
+ /* Don't use inspect_mount, since for virt-rescue we should allow
+ * arbitrary disks and disks with more than one OS on them. Let's
+ * do this using the basic API instead.