[Libguestfs] [PATCH v2 00/23] Reimplement many daemon APIs in OCaml.

Pino Toscano ptoscano at redhat.com
Thu Jul 27 16:15:28 UTC 2017


On Friday, 21 July 2017 22:36:04 CEST Richard W.M. Jones wrote:
> v1 -> v2:
> 
> - [lots of changes]

Thanks for them.

> Requested, but not done for various reasons:
> 
> - Removing GUESTFSD_EXT_CMD.  This is still being used by OpenSUSE, so
>   we'll have to think of a better mechanism for it.  Something like
>   ‘guestfsd --dump-commands’ may work better.

Note I was not suggesting to remove it unconditionally, but that the
C -> OCaml conversion would have lost some of them -- thus find a
solution to make the list of used tools still coherent (i.e for both
C and OCaml code), or remove it altogether.

This is now dealt by removing it.

> - Generating:
>     external available : unit -> bool = "guestfs_int_daemon_optgroup..."
>   etc.  It's hard to generate these functions and have them added to the
>   correct modules (since the OCaml modules are hand-written, and it's
>   awkward to include generated bits in them).

My suggestion was to create a single OptGroups module, with all the
foo_available functions.  Instead of all the functions, another option
could be like the following:

  type available_feature =
    | ACL
    | AUGEAS
    ...

  val available : available_feature -> bool

> Other notes:
> 
> - daemon must be linked to -ldl -lm because the OCaml runtime
>   (libasmrun.so) depends on both.

I don't understand, at least here it links with them:

  $ readelf -d /usr/lib64/ocaml/libasmrun_shared.so | grep NEEDED
  0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
  0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

So unless we use libdl and libm explicitly, we don't need to care about
which libraries are used by libasmrun.so.  Am I missing anything here?

> - Structs must be repeated in *.mli files because you can't use OCaml
>   ‘include’ to pick up single structs from another module.  However
>   the structs are still type checked by the compiler, so we cannot
>   write incorrect / untyped code this way.

Not even by referencing the module?  Ie. Structs.btrfsvolumeinfo
(or so), like done eg in builder/*_parser.mli?

-- 
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/20170727/91e911f6/attachment.sig>


More information about the Libguestfs mailing list