X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fgenerator.ml;h=a995b4c9caa188b2d3b408b064e03fe2956b5186;hp=31ef3130f1831285cc6b2f59f1ea4165e7e4c883;hb=287f8957fea3efe411c7ac55595d5d6c7b613e4e;hpb=bece54704bb081339a87233bbc5401f2892467be diff --git a/src/generator.ml b/src/generator.ml index 31ef313..a995b4c 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 *) @@ -2464,12 +2463,41 @@ the list of printable strings found."); "print the printable strings in a file", "\ This is like the C command, but allows you to -specify the encoding. +specify the encoding of strings that are looked for in +the source file C. -See the L manpage for the full list of encodings. +Allowed encodings are: -Commonly useful encodings are C (lower case L) which will -show strings inside Windows/x86 files. +=over 4 + +=item s + +Single 7-bit-byte characters like ASCII and the ASCII-compatible +parts of ISO-8859-X (this is what C uses). + +=item S + +Single 8-bit-byte characters. + +=item b + +16-bit big endian strings such as those encoded in +UTF-16BE or UCS-2BE. + +=item l (lower case letter L) + +16-bit little endian such as UTF-16LE and UCS-2LE. +This is useful for examining binaries in Windows guests. + +=item B + +32-bit big endian such as UCS-4BE. + +=item L + +32-bit little endian such as UCS-4LE. + +=back The returned strings are transcoded to UTF-8."); @@ -4253,7 +4281,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"; ""]]], @@ -4613,6 +4643,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 @@ -4624,6 +4665,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). *) @@ -7575,10 +7626,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"; @@ -8797,6 +8845,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'); @@ -8815,7 +8869,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. @@ -11629,17 +11683,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 =