X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fgenerator.ml;h=416a66fd96b1c106e6c541d122c0cfe19ec4e6b2;hp=551b6bc61c109cfb2b765b592da41a167d439dd7;hb=4c50f4c38d9a50fbf983c79dd208d1b1598fef8a;hpb=dd12eaefb5879255be78f8233f7e503ffbf7c4f1 diff --git a/src/generator.ml b/src/generator.ml index 551b6bc..416a66f 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -2294,7 +2294,7 @@ How many blocks are zeroed isn't specified (but it's I enough to securely wipe the device). It should be sufficient to remove any partition tables, filesystem superblocks and so on. -See also: C."); +See also: C, C."); ("grub_install", (RErr, [Pathname "root"; Device "device"]), 86, [], (* Test disabled because grub-install incompatible with virtio-blk driver. @@ -4240,7 +4240,7 @@ example to duplicate a filesystem. If the destination is a device, it must be as large or larger than the source file or device, otherwise the copy will fail. -This command cannot do partial copies."); +This command cannot do partial copies (see C)."); ("filesize", (RInt64 "size", [Pathname "file"]), 218, [], [InitBasicFS, Always, TestOutputInt ( @@ -4333,6 +4333,28 @@ calls to associate logical volumes and volume groups. See also C."); + ("copy_size", (RErr, [Dev_or_Path "src"; Dev_or_Path "dest"; Int64 "size"]), 227, [], + [InitBasicFS, Always, TestOutputBuffer ( + [["write_file"; "/src"; "hello, world"; "0"]; + ["copy_size"; "/src"; "/dest"; "5"]; + ["read_file"; "/dest"]], "hello")], + "copy size bytes from source to destination using dd", + "\ +This command copies exactly C bytes from one source device +or file C to another destination device or file C. + +Note this will fail if the source is too short or if the destination +is not large enough."); + + ("zero_device", (RErr, [Device "device"]), 228, [DangerWillRobinson], + [InitBasicFSonLVM, Always, TestRun ( + [["zero_device"; "/dev/VG/LV"]])], + "write zeroes to an entire device", + "\ +This command writes zeroes over the entire C. Compare +with C which just zeroes the first few blocks of +a device."); + ] let all_functions = non_daemon_functions @ daemon_functions @@ -6132,7 +6154,7 @@ and generate_daemon_actions () = pr " ret->guestfs_int_lvm_%s_list_val = NULL;\n" typ; pr "\n"; pr " r = command (&out, &err,\n"; - pr " \"/sbin/lvm\", \"%ss\",\n" typ; + pr " \"lvm\", \"%ss\",\n" typ; pr " \"-o\", lvm_%s_cols, \"--unbuffered\", \"--noheadings\",\n" typ; pr " \"--nosuffix\", \"--separator\", \",\", \"--units\", \"b\", NULL);\n"; pr " if (r == -1) {\n"; @@ -6437,14 +6459,14 @@ int main (int argc, char *argv[]) exit (EXIT_FAILURE); } + /* Set a timeout in case qemu hangs during launch (RHBZ#505329). */ + alarm (600); + if (guestfs_launch (g) == -1) { printf (\"guestfs_launch FAILED\\n\"); exit (EXIT_FAILURE); } - /* Set a timeout in case qemu hangs during launch (RHBZ#505329). */ - alarm (600); - /* Cancel previous alarm. */ alarm (0); @@ -7381,6 +7403,8 @@ and generate_fish_cmds () = ) all_functions; pr " {\n"; pr " fprintf (stderr, _(\"%%s: unknown command\\n\"), cmd);\n"; + pr " if (command_num == 1)\n"; + pr " extended_help_message ();\n"; pr " return -1;\n"; pr " }\n"; pr " return 0;\n"; @@ -8314,7 +8338,7 @@ DESTROY (g) do_cleanups (); pr " if (%s == NULL)\n" n; pr " croak (\"%%s\", guestfs_last_error (g));\n"; - pr " RETVAL = newSVpv (%s, size);\n" n; + pr " RETVAL = newSVpvn (%s, size);\n" n; pr " free (%s);\n" n; pr " OUTPUT:\n"; pr " RETVAL\n" @@ -8347,7 +8371,7 @@ and generate_perl_struct_list_code typ cols name style n do_cleanups = pr " (void) hv_store (hv, \"%s\", %d, newSVpv (%s->val[i].%s, 32), 0);\n" name (String.length name) n name | name, FBuffer -> - pr " (void) hv_store (hv, \"%s\", %d, newSVpv (%s->val[i].%s, %s->val[i].%s_len), 0);\n" + pr " (void) hv_store (hv, \"%s\", %d, newSVpvn (%s->val[i].%s, %s->val[i].%s_len), 0);\n" name (String.length name) n name n name | name, (FBytes|FUInt64) -> pr " (void) hv_store (hv, \"%s\", %d, my_newSVull (%s->val[i].%s), 0);\n" @@ -8389,7 +8413,7 @@ and generate_perl_struct_code typ cols name style n do_cleanups = pr " PUSHs (sv_2mortal (newSVpv (%s->%s, 0)));\n" n name | name, FBuffer -> - pr " PUSHs (sv_2mortal (newSVpv (%s->%s, %s->%s_len)));\n" + pr " PUSHs (sv_2mortal (newSVpvn (%s->%s, %s->%s_len)));\n" n name n name | name, FUUID -> pr " PUSHs (sv_2mortal (newSVpv (%s->%s, 32)));\n"