search for: generate_daemon_caml_stub

Displaying 20 results from an estimated 38 matches for "generate_daemon_caml_stub".

2018 May 03
1
[PATCH] daemon: fix memory allocation and leaks in OCaml stubs
...outines. --- generator/daemon.ml | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/generator/daemon.ml b/generator/daemon.ml index 559ed6898..265f0a475 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -605,16 +605,18 @@ let generate_daemon_caml_stubs () = (* Implement code for returning structs and struct lists. *) let emit_return_struct typ = let struc = Structs.lookup_struct typ in + let uc_typ = String.uppercase_ascii typ in pr "/* Implement RStruct (%S, _). */\n" typ; pr "static guestfs_int_%s *\n&quo...
2019 May 29
0
[PATCH 3/3] daemon: implement OptString for OCaml APIs
...e C glue for OptString parameters. --- generator/daemon.ml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/generator/daemon.ml b/generator/daemon.ml index a4e136aaa..c2b7c79a2 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -600,6 +600,22 @@ let generate_daemon_caml_stubs () = #include \"actions.h\" #include \"daemon-c.h\" +static CAMLprim value +Val_optstring (const char *s) +{ + CAMLparam0 (); + CAMLlocal2 (optv, v); + + if (s) { /* Return Some val */ + v = caml_copy_string (s); + optv = caml_alloc (1, 0); + Field (optv, 0) =...
2019 Sep 05
2
[PATCH 0/1] Build fix for future OCaml 4.09
This is a simple fix for building also with the upcoming OCaml 4.09, which has a slight API change in the C library. This does not cover embedded copies such as ocaml-augeas, and ocaml-libvirt, which are being fixed separately, and will then be synchronized. Pino Toscano (1): ocaml: make const the return value of caml_named_value() common/mlpcre/pcre-c.c | 2 +- common/mltools/uri-c.c |
2019 Sep 05
1
[PATCH] ocaml: Change calls to caml_named_value() to cope with const value* return.
...e"); - caml_raise (*visit_failure_exn); + caml_raise (*caml_named_value ("Visit.Failure")); } free (dir); diff --git a/generator/daemon.ml b/generator/daemon.ml index a4e136aaa..b67c4d20b 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -746,7 +746,7 @@ let generate_daemon_caml_stubs () = let nr_args = List.length args_do_function in pr "{\n"; - pr " static value *cb = NULL;\n"; + pr " static const value *cb = NULL;\n"; pr " CAMLparam0 ();\n"; pr " CAMLlocal2 (v, retv);\n"; pr...
2019 May 29
4
[PATCH 0/3] Simple augeas-related changes
- bump the augeas requirement to 1.2.0, and drop an old hack - add a small helper in the generator Pino Toscano (3): build: raise augeas requirement to 1.2.0 appliance: remove custom Shadow augeas lens daemon: implement OptString for OCaml APIs appliance/Makefile.am | 6 +-- appliance/guestfs_shadow.aug | 72 ------------------------------------ daemon/augeas.c | 21
2019 Sep 05
0
[PATCH 1/1] ocaml: make const the return value of caml_named_value()
..._h *) (intptr_t) Int64_val (gv); struct visitor_function_wrapper_args args; /* The dir string could move around when we call the diff --git a/generator/daemon.ml b/generator/daemon.ml index a4e136aaa..b67c4d20b 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -746,7 +746,7 @@ let generate_daemon_caml_stubs () = let nr_args = List.length args_do_function in pr "{\n"; - pr " static value *cb = NULL;\n"; + pr " static const value *cb = NULL;\n"; pr " CAMLparam0 ();\n"; pr " CAMLlocal2 (v, retv);\n"; pr...
2020 Mar 30
0
[PATCH 1/7] New APIs: cryptsetup-open and cryptsetup-close.
...f the LUKS mapping +device (ie. F</dev/mapper/mapname>) and I<not> the name +of the underlying block device." }; + ] diff --git a/generator/daemon.ml b/generator/daemon.ml index 9edef462c..b1047427b 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -776,7 +776,8 @@ let generate_daemon_caml_stubs () = pr "Val_bool (%s)" n; | OInt _ -> assert false | OInt64 _ -> assert false - | OString _ -> assert false + | OString _ -> + pr "caml_copy_string (%s)" n | OStringList _ -> ass...
2020 Sep 07
0
[PATCH v2 1/7] New APIs: cryptsetup-open and cryptsetup-close.
...f the LUKS mapping +device (ie. F</dev/mapper/mapname>) and I<not> the name +of the underlying block device." }; + ] diff --git a/generator/daemon.ml b/generator/daemon.ml index 9edef462c..b1047427b 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -776,7 +776,8 @@ let generate_daemon_caml_stubs () = pr "Val_bool (%s)" n; | OInt _ -> assert false | OInt64 _ -> assert false - | OString _ -> assert false + | OString _ -> + pr "caml_copy_string (%s)" n | OStringList _ -> ass...
2017 Jul 14
0
[PATCH 02/27] daemon: Allow parts of the daemon and APIs to be written in OCaml.
..._function + ) (actions |> impl_ocaml_functions |> sort) + ) + else + pr "let init_callbacks () = ()\n" + +(* Generate stubs for the functions implemented in OCaml. + * Basically we implement the do_<name> function here, and + * have it call out to OCaml code. + *) +let generate_daemon_caml_stubs () = + generate_header CStyle GPLv2plus; + + pr "\ +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> +#include <inttypes.h> +#include <errno.h> + +#include <caml/alloc.h> +#include <c...
2017 Jul 14
0
[PATCH 04/27] daemon: Reimplement ‘vfs_type’ API in OCaml.
...= [ InitScratchFS, Always, TestResultString ( [["vfs_type"; "/dev/sdb1"]], "ext2"), [] diff --git a/generator/daemon.ml b/generator/daemon.ml index ac410b733..121634806 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -524,6 +524,35 @@ let generate_daemon_caml_stubs () = */ extern void ocaml_exn_to_reply_with_error (const char *func, value exn); +/* Implement String (Mountable, _) parameter. */ +static value +copy_mountable (const mountable_t *mountable) +{ + CAMLparam0 (); + CAMLlocal4 (r, typev, devicev, volumev); + + switch (mountable->type) { +...
2017 Jun 03
3
[PATCH 0/3]: daemon: Reimplement ‘file’ API in OCaml.
This patch series is just FYI at the moment. However it does pass the tests. The daemon is a self-contained program. We don't need to write it all in C. Writing parts of it in OCaml would make it simpler and less error-prone. In particular if the daemon was written in a more sane programming language then we could move the inspection code to run entirely inside the appliance, which would
2017 Jul 21
0
[PATCH v2 01/23] daemon: Allow parts of the daemon and APIs to be written in OCaml.
..._function + ) (actions |> impl_ocaml_functions |> sort) + ) + else + pr "let init_callbacks () = ()\n" + +(* Generate stubs for the functions implemented in OCaml. + * Basically we implement the do_<name> function here, and + * have it call out to OCaml code. + *) +let generate_daemon_caml_stubs () = + generate_header CStyle GPLv2plus; + + pr "\ +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> +#include <inttypes.h> +#include <errno.h> + +#include <caml/alloc.h> +#include <c...
2020 Mar 09
4
[PATCH v3 0/3] Switch augeas APIs to OCaml
This reimplements the augeas APIs using ocaml-augeas (dropping all the C code). The behaviour seems unchanged, although I may have not tested all the various corner cases. Changes from v2: - dropped patch #1, as it was applied already (was a real bugfix) - rebased on master Pino Toscano (3): Revert "Revert "daemon: implement OptString for OCaml APIs"" daemon: move augeas
2020 Jan 09
5
[PATCH v2 0/4] Switch augeas APIs to OCaml
This reimplements the augeas APIs using ocaml-augeas (dropping all the C code). The behaviour seems unchanged, although I may have not tested all the various corner cases. Pino Toscano (4): daemon: fix/enhance error reporting of Augeas exceptions Revert "Revert "daemon: implement OptString for OCaml APIs"" daemon: move augeas APIs to OCaml daemon: drop usage of C
2020 Sep 07
9
[PATCH v2 0/7] Windows BitLocker support.
Original version linked from here: https://bugzilla.redhat.com/show_bug.cgi?id=1808977#c8 There is no change in the code in this series, but feedback from the original series was we shouldn't lose the error message in patch 7. When I tested this just now in fact we don't lose the error if debugging is enabled, but I have updated the commit message to note what the error message is in the
2020 Mar 30
9
[PATCH 0/7] Support Windows BitLocker (RHBZ#1808977).
These commits, along with the associated changes to common: https://www.redhat.com/archives/libguestfs/2020-March/msg00286.html support the transparent decryption and inspection of Windows guests encrypted with BitLocker encryption. To do the BitLocker decryption requires cryptsetup 2.3.0 (although cryptsetup 2.3 is not required for existing LUKS use). It also requires a new-ish Linux kernel, I
2020 Sep 17
13
[PATCH v3 0/8] Windows BitLocker support.
As discussed in the emails today, this is the third version addressing most points from the v1/v2 review. You will need to pair this with the changes in libguestfs-common from this series: https://www.redhat.com/archives/libguestfs/2020-September/msg00050.html Rich.
2019 May 30
5
[PATCH 0/5] RFC: switch augeas APIs to OCaml
This synchronizes the embedded ocaml-augeas copy, and reimplements the augeas APIs using it (dropping all the C code). The behaviour seems unchanged, although I may have not tested all the various corner cases. Pino Toscano (5): common/mlaugeas: Synchronize with latest ocaml-augeas daemon: fix/enhance error reporting of Augeas exceptions Revert "Revert "daemon: implement
2018 Apr 09
0
[PATCH 3/3] daemon: autogenerate most of OCaml interfaces
...t to OCaml code. diff --git a/generator/daemon.mli b/generator/daemon.mli index 40bf31302..f0268ba99 100644 --- a/generator/daemon.mli +++ b/generator/daemon.mli @@ -21,6 +21,7 @@ val generate_daemon_stubs_h : unit -> unit val generate_daemon_stubs : Types.action list -> unit -> unit val generate_daemon_caml_stubs : unit -> unit val generate_daemon_caml_callbacks_ml : unit -> unit +val generate_daemon_caml_interface : string -> unit -> unit val generate_daemon_dispatch : unit -> unit val generate_daemon_lvm_tokenization : unit -> unit val generate_daemon_names : unit -> unit diff --...
2018 Apr 10
0
[PATCH v2 5/5] daemon: autogenerate OCaml interfaces
...t to OCaml code. diff --git a/generator/daemon.mli b/generator/daemon.mli index 40bf31302..f0268ba99 100644 --- a/generator/daemon.mli +++ b/generator/daemon.mli @@ -21,6 +21,7 @@ val generate_daemon_stubs_h : unit -> unit val generate_daemon_stubs : Types.action list -> unit -> unit val generate_daemon_caml_stubs : unit -> unit val generate_daemon_caml_callbacks_ml : unit -> unit +val generate_daemon_caml_interface : string -> unit -> unit val generate_daemon_dispatch : unit -> unit val generate_daemon_lvm_tokenization : unit -> unit val generate_daemon_names : unit -> unit diff --...