On Tue, Feb 07, 2017 at 04:14:18PM +0100, Cédric Bosdonnat wrote:
src/osinfo.c has generic code to read the libosinfo DB. Add a
wrapper
around it to expose it in mllib for use in ocaml code.
There are at least 3 changes in this code that I can spot:
- A code refactoring that moves some functions from osinfo.c -> osinfo-iso.c.
- Something to do with read_osinfo_db_callback which I didn't
fully understand.
- OCaml bindings.
These need to be separate commits, I'm not smart enough to review
all three mixed together.
+static int
+read_osinfo_db_callback_wrapper (guestfs_h *g, const char *path, void *opaque)
+{
+ CAMLparam0 ();
+ CAMLlocal2 (pathv, v);
+ struct callback_wrapper_args *args = opaque;
+
+ assert (path != NULL);
+ assert (args != NULL);
+
+ pathv = caml_copy_string (path);
+
+ v = caml_callback_exn (*args->fvp, pathv);
+
+ if (Is_exception_result (v)) {
+ *args->exnp = Extract_exception (v);
+ return -1;
You copied buggy code from the OCaml wrapper for visit.c. This code
will crash whenever an exception is thrown. Check the latest version
of that wrapper for how to fix.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v