From: Jim Meyering Date: Tue, 11 Aug 2009 10:16:51 +0000 (+0200) Subject: generator.ml: new type, "Pathname" X-Git-Tag: 1.0.67~21 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=79b5084f70cb67c37dd7cbe60821a78981fd8d59;p=libguestfs.git generator.ml: new type, "Pathname" * src/generator.ml: Emit NEED_ROOT and ABS_PATH into generated stubs.c, rather than requiring they be added manually at the start of each and every do_* function that operates on a "path" parameter. Update grammar: Pathname is just a String, with the above exception. Do not update augeas "path" parameters, since they are not file names, but rather ":"-separated search paths. Except aug_init, for which "path" *is* a file name. --- diff --git a/src/generator.ml b/src/generator.ml index e27d011..940d1a7 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -135,6 +135,7 @@ and args = argt list (* Function parameters, guestfs handle is implicit. *) and argt = | String of string (* const char *name, cannot be NULL *) | Device of string (* /dev device name, cannot be NULL *) + | Pathname of string (* file name, cannot be NULL *) | OptString of string (* const char *name, may be NULL *) | StringList of string(* list of strings (each string cannot be NULL) *) | Bool of string (* boolean *) @@ -534,7 +535,7 @@ Return the current qemu binary. This is always non-NULL. If it wasn't set already, then this will return the default qemu binary name."); - ("set_path", (RErr, [String "path"]), -1, [FishAlias "path"], + ("set_path", (RErr, [String "searchpath"]), -1, [FishAlias "path"], [], "set the search path", "\ @@ -832,7 +833,7 @@ underlying disk image. You should always call this if you have modified a disk image, before closing the handle."); - ("touch", (RErr, [String "path"]), 3, [], + ("touch", (RErr, [Pathname "path"]), 3, [], [InitBasicFS, Always, TestOutputTrue ( [["touch"; "/new"]; ["exists"; "/new"]])], @@ -842,7 +843,7 @@ Touch acts like the L command. It can be used to update the timestamps on a file, or, if the file does not exist, to create a new zero-length file."); - ("cat", (RString "content", [String "path"]), 4, [ProtocolLimitWarning], + ("cat", (RString "content", [Pathname "path"]), 4, [ProtocolLimitWarning], [InitSquashFS, Always, TestOutput ( [["cat"; "/known-2"]], "abcdef\n")], "list the contents of a file", @@ -990,7 +991,7 @@ of the L command. The \"full\" version includes all fields."); List all the logical volumes detected. This is the equivalent of the L command. The \"full\" version includes all fields."); - ("read_lines", (RStringList "lines", [String "path"]), 15, [], + ("read_lines", (RStringList "lines", [Pathname "path"]), 15, [], [InitSquashFS, Always, TestOutputList ( [["read_lines"; "/known-4"]], ["abc"; "def"; "ghi"]); InitSquashFS, Always, TestOutputList ( @@ -1093,20 +1094,20 @@ On success this returns a pair containing the number of nodes in the nodeset, and a boolean flag if a node was created."); - ("aug_get", (RString "val", [String "path"]), 19, [], + ("aug_get", (RString "val", [String "augpath"]), 19, [], [], (* XXX Augeas code needs tests. *) "look up the value of an Augeas path", "\ Look up the value associated with C. If C matches exactly one node, the C is returned."); - ("aug_set", (RErr, [String "path"; String "val"]), 20, [], + ("aug_set", (RErr, [String "augpath"; String "val"]), 20, [], [], (* XXX Augeas code needs tests. *) "set Augeas path to value", "\ Set the value associated with C to C."); - ("aug_insert", (RErr, [String "path"; String "label"; Bool "before"]), 21, [], + ("aug_insert", (RErr, [String "augpath"; String "label"; Bool "before"]), 21, [], [], (* XXX Augeas code needs tests. *) "insert a sibling Augeas node", "\ @@ -1118,7 +1119,7 @@ C must match exactly one existing node in the tree, and C