X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Fgenerator.ml;h=37ff0d41f098d1c0c4aff4b0c97e4b4959c93632;hb=72324580801f2c0e2b702b430b90eb141618c7f4;hp=1e6d3c0da853b753968e3dbeef00b126dfeb27b1;hpb=a84f1360499309e2d2ecb661adc6917539b5eef4;p=libguestfs.git diff --git a/src/generator.ml b/src/generator.ml index 1e6d3c0..37ff0d4 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -181,7 +181,6 @@ type flags = | ProtocolLimitWarning (* display warning about protocol size limits *) | DangerWillRobinson (* flags particularly dangerous commands *) | FishAlias of string (* provide an alias for this cmd in guestfish *) - | FishAction of string (* call this function in guestfish *) | FishOutput of fish_output_t (* how to display output in guestfish *) | NotInFish (* do not export via guestfish *) | NotInDocs (* do not add this function to documentation *) @@ -447,7 +446,7 @@ You probably don't want to call this function.")] *) let non_daemon_functions = test_functions @ [ - ("launch", (RErr, []), -1, [FishAlias "run"; FishAction "launch"], + ("launch", (RErr, []), -1, [FishAlias "run"], [], "launch the qemu subprocess", "\ @@ -3287,7 +3286,20 @@ for full details."); ("read_file", (RBufferOut "content", [Pathname "path"]), 150, [ProtocolLimitWarning], [InitISOFS, Always, TestOutputBuffer ( - [["read_file"; "/known-4"]], "abc\ndef\nghi")], + [["read_file"; "/known-4"]], "abc\ndef\nghi"); + (* Test various near large, large and too large files (RHBZ#589039). *) + InitBasicFS, Always, TestLastFail ( + [["touch"; "/a"]; + ["truncate_size"; "/a"; "4194303"]; (* GUESTFS_MESSAGE_MAX - 1 *) + ["read_file"; "/a"]]); + InitBasicFS, Always, TestLastFail ( + [["touch"; "/a"]; + ["truncate_size"; "/a"; "4194304"]; (* GUESTFS_MESSAGE_MAX *) + ["read_file"; "/a"]]); + InitBasicFS, Always, TestLastFail ( + [["touch"; "/a"]; + ["truncate_size"; "/a"; "41943040"]; (* GUESTFS_MESSAGE_MAX * 10 *) + ["read_file"; "/a"]])], "read a file", "\ This calls returns the contents of the file C as a @@ -4240,7 +4252,9 @@ content of the file is C octets of C, where C must be a number in the range C<[0..255]>. To fill a file with zero bytes (sparsely), it is -much more efficient to use C."); +much more efficient to use C. +To create a file with a pattern of repeating bytes +use C."); ("available", (RErr, [StringList "groups"]), 216, [], [InitNone, Always, TestRun [["available"; ""]]], @@ -4600,6 +4614,17 @@ filename is not printable, coreutils uses a special backslash syntax. For more information, see the GNU coreutils info file."); + ("fill_pattern", (RErr, [String "pattern"; Int "len"; Pathname "path"]), 245, [], + [InitBasicFS, Always, TestOutputBuffer ( + [["fill_pattern"; "abcdefghijklmnopqrstuvwxyz"; "28"; "/test"]; + ["read_file"; "/test"]], "abcdefghijklmnopqrstuvwxyzab")], + "fill a file with a repeating pattern of bytes", + "\ +This function is like C except that it creates +a new file of length C containing the repeating pattern +of bytes in C. The pattern is truncated if necessary +to ensure the length of the file is exactly C bytes."); + ] let all_functions = non_daemon_functions @ daemon_functions @@ -4611,6 +4636,16 @@ let all_functions_sorted = List.sort (fun (n1,_,_,_,_,_,_) (n2,_,_,_,_,_,_) -> compare n1 n2) all_functions +(* This is used to generate the src/MAX_PROC_NR file which + * contains the maximum procedure number, a surrogate for the + * ABI version number. See src/Makefile.am for the details. + *) +let max_proc_nr = + let proc_nrs = List.map ( + fun (_, _, proc_nr, _, _, _, _) -> proc_nr + ) daemon_functions in + List.fold_left max 0 proc_nrs + (* Field types for structures. *) type field = | FChar (* C 'char' (really, a 7 bit byte). *) @@ -7562,10 +7597,7 @@ and generate_fish_cmds () = ) (snd style); (* Call C API function. *) - let fn = - try find_map (function FishAction n -> Some n | _ -> None) flags - with Not_found -> sprintf "guestfs_%s" name in - pr " r = %s " fn; + pr " r = guestfs_%s " name; generate_c_call_args ~handle:"g" style; pr ";\n"; @@ -8784,6 +8816,12 @@ package Sys::Guestfs; use strict; use warnings; +# This version number changes whenever a new function +# is added to the libguestfs API. It is not directly +# related to the libguestfs version number. +use vars qw($VERSION); +$VERSION = '0.%d'; + require XSLoader; XSLoader::load ('Sys::Guestfs'); @@ -8802,7 +8840,7 @@ sub new { return $self; } -"; +" max_proc_nr; (* Actions. We only need to print documentation for these as * they are pulled in from the XS code automatically. @@ -11616,17 +11654,7 @@ let inspect ?connect ?xml names = parse_operatingsystems xml " -(* This is used to generate the src/MAX_PROC_NR file which - * contains the maximum procedure number, a surrogate for the - * ABI version number. See src/Makefile.am for the details. - *) and generate_max_proc_nr () = - let proc_nrs = List.map ( - fun (_, _, proc_nr, _, _, _, _) -> proc_nr - ) daemon_functions in - - let max_proc_nr = List.fold_left max 0 proc_nrs in - pr "%d\n" max_proc_nr let output_to filename k =