+static int run_pvresize (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ const char *device;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ device = argv[0];
+ r = guestfs_pvresize (g, device);
+ return r;
+}
+
+static int run_sfdisk_N (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ const char *device;
+ int n;
+ int cyls;
+ int heads;
+ int sectors;
+ const char *line;
+ if (argc != 6) {
+ fprintf (stderr, "%s should have 6 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ device = argv[0];
+ n = atoi (argv[1]);
+ cyls = atoi (argv[2]);
+ heads = atoi (argv[3]);
+ sectors = atoi (argv[4]);
+ line = argv[5];
+ r = guestfs_sfdisk_N (g, device, n, cyls, heads, sectors, line);
+ return r;
+}
+
+static int run_sfdisk_l (const char *cmd, int argc, char *argv[])
+{
+ char *r;
+ const char *device;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ device = argv[0];
+ r = guestfs_sfdisk_l (g, device);
+ if (r == NULL) return -1;
+ printf ("%s\n", r);
+ free (r);
+ return 0;
+}
+
+static int run_sfdisk_kernel_geometry (const char *cmd, int argc, char *argv[])
+{
+ char *r;
+ const char *device;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ device = argv[0];
+ r = guestfs_sfdisk_kernel_geometry (g, device);
+ if (r == NULL) return -1;
+ printf ("%s\n", r);
+ free (r);
+ return 0;
+}
+
+static int run_sfdisk_disk_geometry (const char *cmd, int argc, char *argv[])
+{
+ char *r;
+ const char *device;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ device = argv[0];
+ r = guestfs_sfdisk_disk_geometry (g, device);
+ if (r == NULL) return -1;
+ printf ("%s\n", r);
+ free (r);
+ return 0;
+}
+
+static int run_vg_activate_all (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ int activate;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ activate = is_true (argv[0]) ? 1 : 0;
+ r = guestfs_vg_activate_all (g, activate);
+ return r;
+}
+
+static int run_vg_activate (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ int activate;
+ char **volgroups;
+ if (argc != 2) {
+ fprintf (stderr, "%s should have 2 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ activate = is_true (argv[0]) ? 1 : 0;
+ volgroups = parse_string_list (argv[1]);
+ r = guestfs_vg_activate (g, activate, volgroups);
+ return r;
+}
+
+static int run_lvresize (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ const char *device;
+ int mbytes;
+ if (argc != 2) {
+ fprintf (stderr, "%s should have 2 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ device = argv[0];
+ mbytes = atoi (argv[1]);
+ r = guestfs_lvresize (g, device, mbytes);
+ return r;
+}
+
+static int run_resize2fs (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ const char *device;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ device = argv[0];
+ r = guestfs_resize2fs (g, device);
+ return r;
+}
+
+static int run_find (const char *cmd, int argc, char *argv[])
+{
+ char **r;
+ const char *directory;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ directory = argv[0];
+ r = guestfs_find (g, directory);
+ if (r == NULL) return -1;
+ print_strings (r);
+ free_strings (r);
+ return 0;
+}
+
+static int run_e2fsck_f (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ const char *device;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ device = argv[0];
+ r = guestfs_e2fsck_f (g, device);
+ return r;
+}
+
+static int run_sleep (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ int secs;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ secs = atoi (argv[0]);
+ r = guestfs_sleep (g, secs);
+ return r;
+}
+
+static int run_ntfs_3g_probe (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ int rw;
+ const char *device;
+ if (argc != 2) {
+ fprintf (stderr, "%s should have 2 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ rw = is_true (argv[0]) ? 1 : 0;
+ device = argv[1];
+ r = guestfs_ntfs_3g_probe (g, rw, device);
+ if (r == -1) return -1;
+ printf ("%d\n", r);
+ return 0;
+}
+
+static int run_sh (const char *cmd, int argc, char *argv[])
+{
+ char *r;
+ const char *command;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ command = argv[0];
+ r = guestfs_sh (g, command);
+ if (r == NULL) return -1;
+ printf ("%s\n", r);
+ free (r);
+ return 0;
+}
+
+static int run_sh_lines (const char *cmd, int argc, char *argv[])
+{
+ char **r;
+ const char *command;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ command = argv[0];
+ r = guestfs_sh_lines (g, command);
+ if (r == NULL) return -1;
+ print_strings (r);
+ free_strings (r);
+ return 0;
+}
+
+static int run_glob_expand (const char *cmd, int argc, char *argv[])
+{
+ char **r;
+ const char *pattern;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ pattern = argv[0];
+ r = guestfs_glob_expand (g, pattern);
+ if (r == NULL) return -1;
+ print_strings (r);
+ free_strings (r);
+ return 0;
+}
+
+static int run_scrub_device (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ const char *device;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ device = argv[0];
+ r = guestfs_scrub_device (g, device);
+ return r;
+}
+
+static int run_scrub_file (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ const char *file;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ file = argv[0];
+ r = guestfs_scrub_file (g, file);
+ return r;
+}
+
+static int run_scrub_freespace (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ const char *dir;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ dir = argv[0];
+ r = guestfs_scrub_freespace (g, dir);
+ return r;
+}
+
+static int run_mkdtemp (const char *cmd, int argc, char *argv[])
+{
+ char *r;
+ const char *template;
+ if (argc != 1) {
+ fprintf (stderr, "%s should have 1 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ template = argv[0];
+ r = guestfs_mkdtemp (g, template);
+ if (r == NULL) return -1;
+ printf ("%s\n", r);
+ free (r);
+ return 0;
+}
+