printf ("%-20s %s\n", "mount-vfs", "mount a guest disk with mount options and vfstype");
printf ("%-20s %s\n", "mounts", "show mounted filesystems");
printf ("%-20s %s\n", "mv", "move a file");
+ printf ("%-20s %s\n", "ntfs-3g-probe", "probe NTFS volume");
printf ("%-20s %s\n", "ping-daemon", "ping the guest daemon");
printf ("%-20s %s\n", "pvcreate", "create an LVM physical volume");
printf ("%-20s %s\n", "pvremove", "remove an LVM physical volume");
printf ("%-20s %s\n", "sfdisk-disk-geometry", "display the disk geometry from the partition table");
printf ("%-20s %s\n", "sfdisk-kernel-geometry", "display the kernel geometry");
printf ("%-20s %s\n", "sfdisk-l", "display the partition table");
+ printf ("%-20s %s\n", "sleep", "sleep for some seconds");
printf ("%-20s %s\n", "stat", "get file information");
printf ("%-20s %s\n", "statvfs", "get file system statistics");
printf ("%-20s %s\n", "strings", "print the printable strings in a file");
if (strcasecmp (cmd, "e2fsck_f") == 0 || strcasecmp (cmd, "e2fsck-f") == 0)
pod2text ("e2fsck-f - check an ext2/ext3 filesystem", " e2fsck-f <device>\n\nThis runs C<e2fsck -p -f device>, ie. runs the ext2/ext3\nfilesystem checker on C<device>, noninteractively (C<-p>),\neven if the filesystem appears to be clean (C<-f>).\n\nThis command is only needed because of C<resize2fs>\n(q.v.). Normally you should use C<fsck>.");
else
+ if (strcasecmp (cmd, "sleep") == 0)
+ pod2text ("sleep - sleep for some seconds", " sleep <secs>\n\nSleep for C<secs> seconds.");
+ else
+ if (strcasecmp (cmd, "ntfs_3g_probe") == 0 || strcasecmp (cmd, "ntfs-3g-probe") == 0)
+ pod2text ("ntfs-3g-probe - probe NTFS volume", " ntfs-3g-probe <rw> <device>\n\nThis command runs the L<ntfs-3g.probe(8)> command which probes\nan NTFS C<device> for mountability. (Not all NTFS volumes can\nbe mounted read-write, and some cannot be mounted at all).\n\nC<rw> is a boolean flag. Set it to true if you want to test\nif the volume can be mounted read-write. Set it to false if\nyou want to test if the volume can be mounted read-only.\n\nThe return value is an integer which C<0> if the operation\nwould succeed, or some non-zero value documented in the\nL<ntfs-3g.probe(8)> manual page.");
+ else
display_builtin_command (cmd);
}
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;
+}
+
int run_action (const char *cmd, int argc, char *argv[])
{
if (strcasecmp (cmd, "launch") == 0 || strcasecmp (cmd, "run") == 0)
if (strcasecmp (cmd, "e2fsck_f") == 0 || strcasecmp (cmd, "e2fsck-f") == 0)
return run_e2fsck_f (cmd, argc, argv);
else
+ if (strcasecmp (cmd, "sleep") == 0)
+ return run_sleep (cmd, argc, argv);
+ else
+ if (strcasecmp (cmd, "ntfs_3g_probe") == 0 || strcasecmp (cmd, "ntfs-3g-probe") == 0)
+ return run_ntfs_3g_probe (cmd, argc, argv);
+ else
{
fprintf (stderr, "%s: unknown command\n", cmd);
return -1;