[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 23/27] libxl: ocaml: add VM lifecycle operations



> From: Ian Campbell
> Sent: 11 November 2013 3:58 PM
> To: Rob Hoes
> Cc: xen-devel@xxxxxxxxxxxxx; Ian Jackson; Dave Scott
> Subject: Re: [PATCH v4 23/27] libxl: ocaml: add VM lifecycle operations
> 
> (adding Dave Scott...)
> On Mon, 2013-11-11 at 15:54 +0000, Rob Hoes wrote:
> > > On Wed, 2013-11-06 at 17:50 +0000, Rob Hoes wrote:
> > > > +       if (async != Val_none) {
> > > > +               ao_how->callback = async_callback;
> > > > +               ao_how->u.for_callback = (void *) Some_val(async);
> > > > +               CAMLreturnT(libxl_asyncop_how *, ao_how);
> > > > +       }
> > > > +       else
> > > > +               CAMLreturnT(libxl_asyncop_how *, NULL);
> > >
> > > This doesn't appear to be in my caml headers on Debian Wheezy (3.12.1-
> 4).
> > > A random hit on google
> > > http://docs.camlcity.org/docs/godisrc/oasis-ocaml-
> > > fd-1.1.1.tar.gz/ocaml-fd-1.1.1/lib/fd_stubs.c suggests this was new
> > > in 3.09.4 so why don't I have it?
> >
> > That's very odd... I am just doing what is advised on
> > http://caml.inria.fr/pub/docs/manual-ocaml-312/manual032.html#toc14,
> > which is the official documentation for OCaml 3.12.
> 
> In the source .dsc it is in byterun/memory.h but this doesn't seem to be
> installed. Perhaps because I'm not using hte bytecode version but the
> native code one?

As far as I can see, the code is in Wheezy's ocaml-nox_3.12.1-4_amd64.deb, in 
the file /usr/lib/ocaml/caml/memory.h. Have you got that package?

> >
> > > We would really like to keep this stuff working with some of the
> > > more common distro's stable versions of ocaml, so if this is really
> > > missing then perhaps a compat version would be needed?
> >
> > I'll see if I can find out more...
> >
> > > WTF is it doing anyway? Something to do with this C struct pointer
> > > containing a Value?
> >
> > The docs say:
> > "The macros CAMLreturn, CAMLreturn0, and CAMLreturnT are used to
> > replace the C keyword return. Every occurence of return x must be
> > replaced by CAMLreturn (x) if x has type value, or CAMLreturnT (t, x)
> > (where t is the type of x); every occurence of return without argument
> > must be replaced by CAMLreturn0. If your C function is a procedure
> > (i.e. if it returns void), you must insert CAMLreturn0 at the end (to
> > replace Câs implicit return)."
> 
> There are quite a number of bare returns in the bindings. I guess all cases
> which have no CAMLlocal etc?

That is fine in functions that do not allocate any OCaml values. It does look 
though, that there are still some functions that use OCaml values in them, that 
do not have CAMLlocal/param/return. This is not necessarily a problem, but it 
may be better to add those macros, just to be absolutely sure. I'll see if a 
follow-up patch is desirable.

Cheers,
Rob
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.