On Wed, Jul 19, 2017 at 03:13:47PM +0200, Pino Toscano wrote:
On Friday, 14 July 2017 15:39:10 CEST Richard W.M. Jones wrote:
> .gitignore | 6 +-
> Makefile.am | 2 +-
> common/mlutils/Makefile.am | 4 -
> daemon/Makefile.am | 103 +++++++++++++++++++++++--
> daemon/chroot.ml | 85 +++++++++++++++++++++
> daemon/chroot.mli | 35 +++++++++
> daemon/daemon-c.c | 35 +++++++++
> daemon/daemon.ml | 39 ++++++++++
> daemon/guestfsd.c | 50 ++++++++++++
> daemon/sysroot-c.c | 37 +++++++++
> daemon/sysroot.ml | 19 +++++
> daemon/sysroot.mli | 22 ++++++
> daemon/utils.ml | 156 +++++++++++++++++++++++++++++++++++++
> daemon/utils.mli | 65 ++++++++++++++++
TBH I'd just have a single "Daemon" module for the OCaml helpers for
the daemon, instead of different modules, wirh a single -c.c file for
all the C implementations. The Sysroot submodule could be implemented
like the various submodules in Unix_utils.
Do you mean Daemon.Chroot, Daemon.Sysroot etc?
> +val f : t -> ('a -> 'b) -> 'a ->
'b
> +(** Run a function in the chroot, returning the result or re-raising
> + any exception thrown. *)
After reading patch #11, IMHO there should be a variant that takes a
generic (unit -> unit) function (called 'fn', maybe?), and have 'f'
use it:
let f t fun arg =
f (fun () -> fun arg)
I'm a bit confused, do you have a compilable example?
> +/* Convert an OCaml exception to a reply_with_error_errno call
> + * as best we can.
> + */
> +extern void ocaml_exn_to_reply_with_error (const char *func, value exn);
> +
> +void
> +ocaml_exn_to_reply_with_error (const char *func, value exn)
> +{
Shouldn't this use CAMLparam1 + CAMLreturn?
It doesn't allocate on the OCaml heap so it should be safe.
> +let udev_settle ?filename () =
Ditto.
‘Ditto’ means bind the C udev_settle_* functions?
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html