X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fgenerator.ml;h=69370214f948f0fddc8eeef48737324c56a8f6f3;hp=08c28fc7c70785c0c204ae74faba38b45e91f6ae;hb=5da810b96072c0fd71d78713025a2e104295d0ff;hpb=9c5f05ec14655195fc94dc7c72d132087abe634b diff --git a/src/generator.ml b/src/generator.ml index 08c28fc..6937021 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -2968,7 +2968,7 @@ were rarely if ever used anyway. See also C and the L manpage."); - ("zfile", (RString "description", [String "method"; Pathname "path"]), 140, [DeprecatedBy "file"], + ("zfile", (RString "description", [String "meth"; Pathname "path"]), 140, [DeprecatedBy "file"], [], "determine file type inside a compressed file", "\ @@ -3560,6 +3560,15 @@ an external journal on the journal with UUID C. See also C."); + ("modprobe", (RErr, [String "modulename"]), 194, [], + [InitNone, Always, TestRun [["modprobe"; "fat"]]], + "load a kernel module", + "\ +This loads a kernel module in the appliance. + +The kernel module must have been whitelisted when libguestfs +was built (see C in the source)."); + ] let all_functions = non_daemon_functions @ daemon_functions @@ -3822,6 +3831,10 @@ let pod2text_memo : ((int * string * string), string list) Hashtbl.t = v with _ -> Hashtbl.create 13 +let pod2text_memo_updated () = + let chan = open_out pod2text_memo_filename in + output_value chan pod2text_memo; + close_out chan (* Useful functions. * Note we don't want to use any external OCaml libraries which @@ -4037,7 +4050,36 @@ let check_functions () = if n = "i" || n = "n" then failwithf "%s has a param/ret called 'i' or 'n', which will cause some conflicts in the generated code" name; if n = "argv" || n = "args" then - failwithf "%s has a param/ret called 'argv' or 'args', which will cause some conflicts in the generated code" name + failwithf "%s has a param/ret called 'argv' or 'args', which will cause some conflicts in the generated code" name; + + (* List Haskell, OCaml and C keywords here. + * http://www.haskell.org/haskellwiki/Keywords + * http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#operator-char + * http://en.wikipedia.org/wiki/C_syntax#Reserved_keywords + * Formatted via: cat c haskell ocaml|sort -u|grep -vE '_|^val$' \ + * |perl -pe 's/(.+)/"$1";/'|fmt -70 + * Omitting _-containing words, since they're handled above. + * Omitting the OCaml reserved word, "val", is ok, + * and saves us from renaming several parameters. + *) + let reserved = [ + "and"; "as"; "asr"; "assert"; "auto"; "begin"; "break"; "case"; + "char"; "class"; "const"; "constraint"; "continue"; "data"; + "default"; "deriving"; "do"; "done"; "double"; "downto"; "else"; + "end"; "enum"; "exception"; "extern"; "external"; "false"; "float"; + "for"; "forall"; "foreign"; "fun"; "function"; "functor"; "goto"; + "hiding"; "if"; "import"; "in"; "include"; "infix"; "infixl"; + "infixr"; "inherit"; "initializer"; "inline"; "instance"; "int"; + "land"; "lazy"; "let"; "long"; "lor"; "lsl"; "lsr"; "lxor"; + "match"; "mdo"; "method"; "mod"; "module"; "mutable"; "new"; + "newtype"; "object"; "of"; "open"; "or"; "private"; "qualified"; + "rec"; "register"; "restrict"; "return"; "short"; "sig"; "signed"; + "sizeof"; "static"; "struct"; "switch"; "then"; "to"; "true"; "try"; + "type"; "typedef"; "union"; "unsigned"; "virtual"; "void"; + "volatile"; "when"; "where"; "while"; + ] in + if List.mem n reserved then + failwithf "%s has param/ret using reserved word %s" name n; in (match fst style with @@ -4518,17 +4560,17 @@ and generate_client_actions () = #include \"guestfs_protocol.h\" #define error guestfs_error -#define perrorf guestfs_perrorf -#define safe_malloc guestfs_safe_malloc +//#define perrorf guestfs_perrorf +//#define safe_malloc guestfs_safe_malloc #define safe_realloc guestfs_safe_realloc -#define safe_strdup guestfs_safe_strdup +//#define safe_strdup guestfs_safe_strdup #define safe_memdup guestfs_safe_memdup /* Check the return message from a call for validity. */ static int check_reply_header (guestfs_h *g, const struct guestfs_message_header *hdr, - int proc_nr, int serial) + unsigned int proc_nr, unsigned int serial) { if (hdr->prog != GUESTFS_PROGRAM) { error (g, \"wrong program (%%d/%%d)\", hdr->prog, GUESTFS_PROGRAM); @@ -7972,9 +8014,7 @@ and pod2text ~width name longdesc = failwithf "pod2text: process signalled or stopped by signal %d" i ); Hashtbl.add pod2text_memo key lines; - let chan = open_out pod2text_memo_filename in - output_value chan pod2text_memo; - close_out chan; + pod2text_memo_updated (); lines (* Generate ruby bindings. *)