generator: Simplify the handling of string parameters.

Previously we had lots of types like String, Device, StringList,
DeviceList, etc. where Device was just a String with magical
properties (but only inside the daemon), and DeviceList was just a
list of Device strings.

Replace these with some simple top-level types:

  String
  StringList

and move the magic into a subtype.

The change is mechanical, for example:

    old                     --->    new
  FileIn "filename"               String (FileIn, "filename")
  DeviceList "devices"            StringList (Device, "devices")

Handling BufferIn is sufficiently different from a plain String
throughout all the bindings that it still uses a top-level type.
(Compare with FileIn/FileOut where the only difference is in the
protocol, but the bindings can uniformly treat it as a plain String.)

There is no semantic change, and the generated files are identical
except for a minor change in the (deprecated) Perl
%guestfs_introspection table.
This commit is contained in:
Richard W.M. Jones
2017-04-21 12:59:07 +01:00
parent a76e9040b2
commit 30411ef623
32 changed files with 796 additions and 980 deletions

View File

@@ -44,7 +44,7 @@ data." };
let daemon_functions = [
{ defaults with
name = "hivex_open"; added = (1, 19, 35);
style = RErr, [Pathname "filename"], [OBool "verbose"; OBool "debug"; OBool "write"; OBool "unsafe"];
style = RErr, [String (Pathname, "filename")], [OBool "verbose"; OBool "debug"; OBool "write"; OBool "unsafe"];
optional = Some "hivex";
tests = [
InitScratchFS, Always, TestRun (
@@ -105,7 +105,7 @@ This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_get_child"; added = (1, 19, 35);
style = RInt64 "child", [Int64 "nodeh"; String "name"], [];
style = RInt64 "child", [Int64 "nodeh"; String (PlainString, "name")], [];
optional = Some "hivex";
shortdesc = "return the named child of node";
longdesc = "\
@@ -136,7 +136,7 @@ This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_get_value"; added = (1, 19, 35);
style = RInt64 "valueh", [Int64 "nodeh"; String "key"], [];
style = RInt64 "valueh", [Int64 "nodeh"; String (PlainString, "key")], [];
optional = Some "hivex";
shortdesc = "return the named value";
longdesc = "\
@@ -206,7 +206,7 @@ This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_add_child"; added = (1, 19, 35);
style = RInt64 "nodeh", [Int64 "parent"; String "name"], [];
style = RInt64 "nodeh", [Int64 "parent"; String (PlainString, "name")], [];
optional = Some "hivex";
shortdesc = "add a child node";
longdesc = "\
@@ -226,7 +226,7 @@ This is a wrapper around the L<hivex(3)> call of the same name." };
{ defaults with
name = "hivex_node_set_value"; added = (1, 19, 35);
style = RErr, [Int64 "nodeh"; String "key"; Int64 "t"; BufferIn "val"], [];
style = RErr, [Int64 "nodeh"; String (PlainString, "key"); Int64 "t"; BufferIn "val"], [];
optional = Some "hivex";
shortdesc = "set or replace a single value in a node";
longdesc = "\