X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=fish%2Fcmds.c;h=334d7154493718b36594eaf463929fa48f049448;hb=3c5b447efd42b03c24104bdc1f3260e879bb1d25;hp=bb982d4621e8efe6753e98ba0567d388e1332725;hpb=d1a1ab972bb22f4c38a21fcc73f81650aaa03b4e;p=libguestfs.git diff --git a/fish/cmds.c b/fish/cmds.c index bb982d4..334d715 100644 --- a/fish/cmds.c +++ b/fish/cmds.c @@ -114,6 +114,7 @@ void list_commands (void) 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"); @@ -137,6 +138,7 @@ void list_commands (void) 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"); @@ -552,6 +554,12 @@ void display_command (const char *cmd) if (strcasecmp (cmd, "e2fsck_f") == 0 || strcasecmp (cmd, "e2fsck-f") == 0) pod2text ("e2fsck-f - check an ext2/ext3 filesystem", " e2fsck-f \n\nThis runs C, ie. runs the ext2/ext3\nfilesystem checker on C, noninteractively (C<-p>),\neven if the filesystem appears to be clean (C<-f>).\n\nThis command is only needed because of C\n(q.v.). Normally you should use C."); else + if (strcasecmp (cmd, "sleep") == 0) + pod2text ("sleep - sleep for some seconds", " sleep \n\nSleep for C 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 \n\nThis command runs the L command which probes\nan NTFS C for mountability. (Not all NTFS volumes can\nbe mounted read-write, and some cannot be mounted at all).\n\nC 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 manual page."); + else display_builtin_command (cmd); } @@ -2698,6 +2706,38 @@ static int run_e2fsck_f (const char *cmd, int argc, char *argv[]) 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) @@ -3087,6 +3127,12 @@ int run_action (const char *cmd, int argc, char *argv[]) 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;