[Libguestfs] [PATCH 1/2] generator: Simplify the handling of string parameters.

Pino Toscano ptoscano at redhat.com
Wed May 3 15:43:06 UTC 2017


On Friday, 21 April 2017 16:06:47 CEST Richard W.M. Jones wrote:
> 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.
> [...]

Sorry for the late reply.
It seems mostly good to me, I have just one note below:

> diff --git a/generator/XDR.ml b/generator/XDR.ml
> index 634a4f336..b0ca26558 100644
> --- a/generator/XDR.ml
> +++ b/generator/XDR.ml
>          pr "struct %s_args {\n" name;
>          List.iter (
>            function
> -          | Pathname n | Device n | Mountable n | Dev_or_Path n
> -          | Mountable_or_Path n | String n
> -          | Key n | GUID n ->
> +          | String (_, n) ->
>              pr "  string %s<>;\n" n
>            | OptString n -> pr "  guestfs_str *%s;\n" n
> -          | StringList n | DeviceList n | FilenameList n ->
> +          | StringList (_, n) ->
>              pr "  guestfs_str %s<>;\n" n
>            | Bool n -> pr "  bool %s;\n" n
>            | Int n -> pr "  int %s;\n" n
>            | Int64 n -> pr "  int64_t %s;\n" n
>            | BufferIn n ->
>              pr "  opaque %s<>;\n" n
> -          | FileIn _ | FileOut _ | Pointer _ -> assert false
> +          | Pointer _ -> assert false

There's a small behaviour change, as in String (FileIn|FileOut) will
not assert anymore here.  It does not seem a bit issue, since because
of the assert such types did not reach this code.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170503/e53f72d2/attachment.sig>


More information about the Libguestfs mailing list