From: Richard Jones Date: Fri, 10 Apr 2009 09:26:10 +0000 (+0100) Subject: Just use plain lists for argument representation. X-Git-Tag: 0.8~13 X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=commitdiff_plain;h=469224a9eca9b575063e6a1ca1b1d97adb3448cb Just use plain lists for argument representation. --- diff --git a/src/generator.ml b/src/generator.ml index 54c691b..b0a7158 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -63,12 +63,7 @@ and ret = | RPVList of string | RVGList of string | RLVList of string -and args = - (* 0 arguments, 1 argument, etc. The guestfs_h param is implicit. *) - | P0 - | P1 of argt - | P2 of argt * argt - | P3 of argt * argt * argt +and args = argt list (* Function parameters, guestfs handle is implicit. *) and argt = | String of string (* const char *name, cannot be NULL *) | OptString of string (* const char *name, may be NULL *) @@ -90,7 +85,7 @@ type flags = *) let non_daemon_functions = [ - ("launch", (Err, P0), -1, [FishAlias "run"; FishAction "launch"], + ("launch", (Err, []), -1, [FishAlias "run"; FishAction "launch"], "launch the qemu subprocess", "\ Internally libguestfs is implemented by running a virtual machine @@ -99,7 +94,7 @@ using L. You should call this after configuring the handle (eg. adding drives) but before performing any actions."); - ("wait_ready", (Err, P0), -1, [NotInFish], + ("wait_ready", (Err, []), -1, [NotInFish], "wait until the qemu subprocess launches", "\ Internally libguestfs is implemented by running a virtual machine @@ -108,12 +103,12 @@ using L. You should call this after C to wait for the launch to complete."); - ("kill_subprocess", (Err, P0), -1, [], + ("kill_subprocess", (Err, []), -1, [], "kill the qemu subprocess", "\ This kills the qemu subprocess. You should never need to call this."); - ("add_drive", (Err, P1 (String "filename")), -1, [FishAlias "add"], + ("add_drive", (Err, [String "filename"]), -1, [FishAlias "add"], "add an image to examine or modify", "\ This function adds a virtual machine disk image C to the @@ -129,14 +124,14 @@ image). This is equivalent to the qemu parameter C<-drive file=filename>."); - ("add_cdrom", (Err, P1 (String "filename")), -1, [FishAlias "cdrom"], + ("add_cdrom", (Err, [String "filename"]), -1, [FishAlias "cdrom"], "add a CD-ROM disk image to examine", "\ This function adds a virtual CD-ROM disk image to the guest. This is equivalent to the qemu parameter C<-cdrom filename>."); - ("config", (Err, P2 (String "qemuparam", OptString "qemuvalue")), -1, [], + ("config", (Err, [String "qemuparam"; OptString "qemuvalue"]), -1, [], "add qemu parameters", "\ This can be used to add arbitrary qemu command line parameters @@ -148,7 +143,7 @@ The first character of C string must be a C<-> (dash). C can be NULL."); - ("set_path", (Err, P1 (String "path")), -1, [FishAlias "path"], + ("set_path", (Err, [String "path"]), -1, [FishAlias "path"], "set the search path", "\ Set the path that libguestfs searches for kernel and initrd.img. @@ -161,7 +156,7 @@ must make sure it remains valid for the lifetime of the handle. Setting C to C restores the default path."); - ("get_path", (RConstString "path", P0), -1, [], + ("get_path", (RConstString "path", []), -1, [], "get the search path", "\ Return the current search path. @@ -169,19 +164,19 @@ Return the current search path. This is always non-NULL. If it wasn't set already, then this will return the default path."); - ("set_autosync", (Err, P1 (Bool "autosync")), -1, [FishAlias "autosync"], + ("set_autosync", (Err, [Bool "autosync"]), -1, [FishAlias "autosync"], "set autosync mode", "\ If C is true, this enables autosync. Libguestfs will make a best effort attempt to run C when the handle is closed (also if the program exits without closing handles)."); - ("get_autosync", (RBool "autosync", P0), -1, [], + ("get_autosync", (RBool "autosync", []), -1, [], "get autosync mode", "\ Get the autosync flag."); - ("set_verbose", (Err, P1 (Bool "verbose")), -1, [FishAlias "verbose"], + ("set_verbose", (Err, [Bool "verbose"]), -1, [FishAlias "verbose"], "set verbose mode", "\ If C is true, this turns on verbose messages (to C). @@ -189,14 +184,14 @@ If C is true, this turns on verbose messages (to C). Verbose messages are disabled unless the environment variable C is defined and set to C<1>."); - ("get_verbose", (RBool "verbose", P0), -1, [], + ("get_verbose", (RBool "verbose", []), -1, [], "get verbose mode", "\ This returns the verbose messages flag.") ] let daemon_functions = [ - ("mount", (Err, P2 (String "device", String "mountpoint")), 1, [], + ("mount", (Err, [String "device"; String "mountpoint"]), 1, [], "mount a guest disk at a position in the filesystem", "\ Mount a guest disk at a position in the filesystem. Block devices @@ -216,7 +211,7 @@ on the underlying device. The filesystem options C and C are set with this call, in order to improve reliability."); - ("sync", (Err, P0), 2, [], + ("sync", (Err, []), 2, [], "sync disks, writes are flushed through to the disk image", "\ This syncs the disk, so that any writes are flushed through to the @@ -225,14 +220,14 @@ underlying disk image. You should always call this if you have modified a disk image, before closing the handle."); - ("touch", (Err, P1 (String "path")), 3, [], + ("touch", (Err, [String "path"]), 3, [], "update file timestamps or create a new file", "\ 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", P1 (String "path")), 4, [ProtocolLimitWarning], + ("cat", (RString "content", [String "path"]), 4, [ProtocolLimitWarning], "list the contents of a file", "\ Return the contents of the file named C. @@ -242,7 +237,7 @@ Note that this function cannot correctly handle binary files as end of string). For those you need to use the C function which has a more complex interface."); - ("ll", (RString "listing", P1 (String "directory")), 5, [], + ("ll", (RString "listing", [String "directory"]), 5, [], "list the files in a directory (long format)", "\ List the files in C (relative to the root directory, @@ -251,7 +246,7 @@ there is no cwd) in the format of 'ls -la'. This command is mostly useful for interactive sessions. It is I intended that you try to parse the output string."); - ("ls", (RStringList "listing", P1 (String "directory")), 6, [], + ("ls", (RStringList "listing", [String "directory"]), 6, [], "list the files in a directory", "\ List the files in C (relative to the root directory, @@ -261,14 +256,14 @@ hidden files are shown. This command is mostly useful for interactive sessions. Programs should probably use C instead."); - ("list_devices", (RStringList "devices", P0), 7, [], + ("list_devices", (RStringList "devices", []), 7, [], "list the block devices", "\ List all the block devices. The full block device names are returned, eg. C"); - ("list_partitions", (RStringList "partitions", P0), 8, [], + ("list_partitions", (RStringList "partitions", []), 8, [], "list the partitions", "\ List all the partitions detected on all block devices. @@ -278,7 +273,7 @@ The full partition device names are returned, eg. C This does not return logical volumes. For that you will need to call C."); - ("pvs", (RStringList "physvols", P0), 9, [], + ("pvs", (RStringList "physvols", []), 9, [], "list the LVM physical volumes (PVs)", "\ List all the physical volumes detected. This is the equivalent @@ -289,7 +284,7 @@ PVs (eg. C). See also C."); - ("vgs", (RStringList "volgroups", P0), 10, [], + ("vgs", (RStringList "volgroups", []), 10, [], "list the LVM volume groups (VGs)", "\ List all the volumes groups detected. This is the equivalent @@ -300,7 +295,7 @@ detected (eg. C). See also C."); - ("lvs", (RStringList "logvols", P0), 11, [], + ("lvs", (RStringList "logvols", []), 11, [], "list the LVM logical volumes (LVs)", "\ List all the logical volumes detected. This is the equivalent @@ -311,25 +306,25 @@ This returns a list of the logical volume device names See also C."); - ("pvs_full", (RPVList "physvols", P0), 12, [], + ("pvs_full", (RPVList "physvols", []), 12, [], "list the LVM physical volumes (PVs)", "\ List all the physical volumes detected. This is the equivalent of the L command. The \"full\" version includes all fields."); - ("vgs_full", (RVGList "volgroups", P0), 13, [], + ("vgs_full", (RVGList "volgroups", []), 13, [], "list the LVM volume groups (VGs)", "\ List all the volumes groups detected. This is the equivalent of the L command. The \"full\" version includes all fields."); - ("lvs_full", (RLVList "logvols", P0), 14, [], + ("lvs_full", (RLVList "logvols", []), 14, [], "list the LVM logical volumes (LVs)", "\ List all the logical volumes detected. This is the equivalent of the L command. The \"full\" version includes all fields."); - ("read_lines", (RStringList "lines", P1 (String "path")), 15, [], + ("read_lines", (RStringList "lines", [String "path"]), 15, [], "read file as lines", "\ Return the contents of the file named C. @@ -342,7 +337,7 @@ Note that this function cannot correctly handle binary files as end of line). For those you need to use the C function which has a more complex interface."); - ("aug_init", (Err, P2 (String "root", Int "flags")), 16, [], + ("aug_init", (Err, [String "root"; Int "flags"]), 16, [], "create a new Augeas handle", "\ Create a new Augeas handle for editing configuration files. @@ -392,7 +387,7 @@ To close the handle, you can call C. To find out more about Augeas, see L."); - ("aug_close", (Err, P0), 26, [], + ("aug_close", (Err, []), 26, [], "close the current Augeas handle", "\ Close the current Augeas handle and free up any resources @@ -400,7 +395,7 @@ used by it. After calling this, you have to call C again before you can use any other Augeas functions."); - ("aug_defvar", (RInt "nrnodes", P2 (String "name", OptString "expr")), 17, [], + ("aug_defvar", (RInt "nrnodes", [String "name"; OptString "expr"]), 17, [], "define an Augeas variable", "\ Defines an Augeas variable C whose value is the result @@ -410,7 +405,7 @@ undefined. On success this returns the number of nodes in C, or C<0> if C evaluates to something which is not a nodeset."); - ("aug_defnode", (RIntBool ("nrnodes", "created"), P3 (String "name", String "expr", String "val")), 18, [], + ("aug_defnode", (RIntBool ("nrnodes", "created"), [String "name"; String "expr"; String "val"]), 18, [], "define an Augeas node", "\ Defines a variable C whose value is the result of @@ -424,18 +419,18 @@ 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", P1 (String "path")), 19, [], + ("aug_get", (RString "val", [String "path"]), 19, [], "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", (Err, P2 (String "path", String "val")), 20, [], + ("aug_set", (Err, [String "path"; String "val"]), 20, [], "set Augeas path to value", "\ Set the value associated with C to C."); - ("aug_insert", (Err, P3 (String "path", String "label", Bool "before")), 21, [], + ("aug_insert", (Err, [String "path"; String "label"; Bool "before"]), 21, [], "insert a sibling Augeas node", "\ Create a new sibling C