X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=fish%2Fcmds.c;h=334d7154493718b36594eaf463929fa48f049448;hb=460d139e6a52da67a4f1947035b1978610349f78;hp=8e8e08accc5f55e1fead4712a3ec67afe437ec14;hpb=b6adf09c4d2cc3f1d0285950c151b1fd7688ec67;p=libguestfs.git diff --git a/fish/cmds.c b/fish/cmds.c index 8e8e08a..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"); @@ -556,6 +557,9 @@ void display_command (const char *cmd) 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); } @@ -2716,6 +2720,24 @@ static int run_sleep (const char *cmd, int argc, char *argv[]) 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) @@ -3108,6 +3130,9 @@ int run_action (const char *cmd, int argc, char *argv[]) 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;