Displaying 20 results from an estimated 41 matches for "camllocal4".
Did you mean:
camllocal1
2019 Apr 23
0
[PATCH nbdkit v2 1/2] ocaml: Change pread method to avoid leaking heap memory.
...ions(-)
diff --git a/plugins/ocaml/ocaml.c b/plugins/ocaml/ocaml.c
index d854f48..39704e2 100644
--- a/plugins/ocaml/ocaml.c
+++ b/plugins/ocaml/ocaml.c
@@ -439,15 +439,16 @@ pread_wrapper (void *h, void *buf, uint32_t count, uint64_t offset,
uint32_t flags)
{
CAMLparam0 ();
- CAMLlocal4 (rv, strv, offsetv, flagsv);
+ CAMLlocal4 (rv, countv, offsetv, flagsv);
+ mlsize_t len;
caml_leave_blocking_section ();
- strv = caml_alloc_string (count);
+ countv = caml_copy_int32 (count);
offsetv = caml_copy_int64 (offset);
flagsv = Val_flags (flags);
- value args[] = { *(v...
2014 Jan 21
2
Re: [PATCH] builder: proper consider subkeys in index files
...o Toscano wrote:
> > + sv = caml_copy_string (fields->subkey ? fields->subkey : "");
> >
> > Store_field (v, 1, sv);
>
> Heh, sure would be nice if this was an option type :-)
>
> I believe the following should work:
>
> (1) Change CAMLlocal4 (..) at the top of the function to:
>
> CAMLlocal5 (rv, v, sv, sv2, fv);
>
> (2) Then the new code is:
>
> if (fields->subkey) { /* Some subkey */
> sv2 = caml_copy_string (fields->subkey);
> sv = caml_alloc (1, 0);
> Store_fi...
2014 Jan 21
3
[PATCH] builder: proper consider subkeys in index files
The index files already allowed the 'key[subkey]=...' syntax for keys,
but considering such string as whole key. Proper split the parsing and
the handling of the subkeys, so they can be searched a bit easier.
This causes no actual behaviour changes, it is just internal
micro-refactoring.
---
builder/index-parser-c.c | 8 +++++---
builder/index-scan.l | 9 ++++++++-
2014 Jan 21
0
Re: [PATCH] builder: proper consider subkeys in index files
On Tue, Jan 21, 2014 at 05:18:27PM +0100, Pino Toscano wrote:
> + sv = caml_copy_string (fields->subkey ? fields->subkey : "");
> Store_field (v, 1, sv);
Heh, sure would be nice if this was an option type :-)
I believe the following should work:
(1) Change CAMLlocal4 (..) at the top of the function to:
CAMLlocal5 (rv, v, sv, sv2, fv);
(2) Then the new code is:
if (fields->subkey) { /* Some subkey */
sv2 = caml_copy_string (fields->subkey);
sv = caml_alloc (1, 0);
Store_field (sv, 0, sv2);
} else...
2019 May 16
0
[nbdkit PATCH v2 08/24] ocaml: Implement .cache script callback
...rmat_exception (Extract_exception (rv)));
+ caml_enter_blocking_section ();
+ CAMLreturnT (int, -1);
+ }
+
+ caml_enter_blocking_section ();
+ CAMLreturnT (int, Int_val (rv));
+}
+
+static int
+cache_wrapper (void *h, uint32_t count, uint64_t offset, uint32_t flags)
+{
+ CAMLparam0 ();
+ CAMLlocal4 (rv, countv, offsetv, flagsv);
+
+ caml_leave_blocking_section ();
+
+ countv = caml_copy_int32 (count);
+ offsetv = caml_copy_int32 (offset);
+ flagsv = Val_flags (flags);
+
+ value args[] = { *(value *) h, countv, offsetv, flagsv };
+ rv = caml_callbackN_exn (cache_fn, sizeof args / sizeof...
2019 Apr 23
4
[PATCH nbdkit v2 0/2] Be careful not to leak server heap memory to the client.
Version 1 was here:
https://www.redhat.com/archives/libguestfs/2019-April/msg00144.html
Version 2 makes a couple of much larger changes:
The OCaml patch changes the API of the pread method so it matches what
other language bindings are already doing, ie. get the language plugin
to return a newly allocated buffer, check it is long enough, copy out
the data.
The server patch implements a
2014 Jan 21
0
[PATCH] builder: proper consider subkeys in index files
...anged, 46 insertions(+), 24 deletions(-)
diff --git a/builder/index-parser-c.c b/builder/index-parser-c.c
index 17e680b..fbbebff 100644
--- a/builder/index-parser-c.c
+++ b/builder/index-parser-c.c
@@ -49,7 +49,7 @@ value
virt_builder_parse_index (value filenamev)
{
CAMLparam1 (filenamev);
- CAMLlocal4 (rv, v, sv, fv);
+ CAMLlocal5 (rv, v, sv, sv2, fv);
struct section *sections;
size_t i, nr_sections;
@@ -83,11 +83,18 @@ virt_builder_parse_index (value filenamev)
for (j = 0, fields = sections->fields; fields != NULL;
j++, fields = fields->next) {
- v = caml_al...
2017 Jul 14
0
[PATCH 04/27] daemon: Reimplement ‘vfs_type’ API in OCaml.
...+++ 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) {
+ case MOUNTABLE_DEVICE:
+ typev = Val_int (0); /* MountableDevice */
+ break;
+ case MOUNTABLE_PATH:
+ typev = Val_int (1); /* MountablePath */
+ break;
+ case MOUNTABLE_BTRFSVOL:
+ volumev = caml_copy_string (mount...
2015 Oct 06
6
[PATCH 0/4] ocaml: Allow Guestfs.t handle to be garbage collected.
Allow Guestfs.t handle to be garbage collected, and add a
regression test.
2018 Aug 20
0
[PATCH 4/4] mltools: JSON: unify JSON_parser type with JSON.json_t.
...0
+#define JSON_INT_TAG 1
+#define JSON_FLOAT_TAG 2
+#define JSON_BOOL_TAG 3
+#define JSON_LIST_TAG 4
+#define JSON_DICT_TAG 5
value virt_builder_json_parser_tree_parse (value stringv);
@@ -36,60 +41,87 @@ static value
convert_json_t (json_t *val, int level)
{
CAMLparam0 ();
- CAMLlocal4 (rv, lv, v, sv);
+ CAMLlocal5 (rv, v, tv, sv, consv);
if (level > 20)
caml_invalid_argument ("too many levels of object/array nesting");
if (json_is_object (val)) {
- const size_t len = json_object_size (val);
- size_t i;
const char *key;
json_t *jvalue;...
2018 Aug 22
3
[PATCH v2 0/2] mltools: JSON: unify JSON & JSON parser.
v2:
- Added back the null value.
- Reran the tests.
Rich.
2015 Aug 12
0
[PATCH 2/2] builder: support Simple Streams v1.0 as index metadata
...<stdio.h>
+#include <string.h>
+
+#define Val_none (Val_int (0))
+
+extern value virt_builder_yajl_is_available (value unit);
+extern value virt_builder_yajl_tree_parse (value stringv);
+
+#if HAVE_YAJL
+static value
+convert_yajl_value (yajl_val val, int level)
+{
+ CAMLparam0 ();
+ CAMLlocal4 (rv, lv, v, sv);
+
+ if (level > 20)
+ caml_invalid_argument ("too many levels of object/array nesting");
+
+ if (YAJL_IS_OBJECT (val)) {
+ size_t len = YAJL_GET_OBJECT(val)->len;
+ size_t i;
+ rv = caml_alloc (1, 3);
+ lv = caml_alloc_tuple (len);
+ for (i = 0;...
2018 Feb 12
0
[PATCH v2 1/1] Switch from YAJL to Jansson
...c >= 6 */
-#pragma GCC diagnostic ignored "-Wnull-dereference"
-#endif
-
#define Val_none (Val_int (0))
value virt_builder_yajl_tree_parse (value stringv);
static value
-convert_yajl_value (yajl_val val, int level)
+convert_json_t (json_t *val, int level)
{
CAMLparam0 ();
CAMLlocal4 (rv, lv, v, sv);
@@ -48,46 +41,51 @@ convert_yajl_value (yajl_val val, int level)
if (level > 20)
caml_invalid_argument ("too many levels of object/array nesting");
- if (YAJL_IS_OBJECT (val)) {
- const size_t len = YAJL_GET_OBJECT(val)->len;
+ if (json_is_object (val...
2017 Nov 23
0
[PATCH 1/1] Switch from YAJL to Jansson
...c >= 6 */
-#pragma GCC diagnostic ignored "-Wnull-dereference"
-#endif
-
#define Val_none (Val_int (0))
value virt_builder_yajl_tree_parse (value stringv);
static value
-convert_yajl_value (yajl_val val, int level)
+convert_json_t (json_t *val, int level)
{
CAMLparam0 ();
CAMLlocal4 (rv, lv, v, sv);
@@ -48,46 +41,51 @@ convert_yajl_value (yajl_val val, int level)
if (level > 20)
caml_invalid_argument ("too many levels of object/array nesting");
- if (YAJL_IS_OBJECT (val)) {
- const size_t len = YAJL_GET_OBJECT(val)->len;
+ if (json_is_object (val...
2018 Feb 12
2
[PATCH v2 0/1] RFC: switch from YAJL to Jansson
Hi,
recently, there was a discussion in the development list of libvirt on
switching to a different JSON library than YAJL [1]. Since we use YAJL,
and the points there IMHO apply to libguestfs as well, I decided to give
a try in switching to Jansson [2].
The result IMHO is nice, with the additional APIs of Jansson that
simplify some of our code. Unlike with YAJL, I did not set a minimum
2015 Aug 12
4
[PATCH 0/2 v2] RFC: builder: support for Simple Streams metadata
Hi,
this series adds a basic support for Simple Streams v1.0 metadata
files. This makes it possible to create a repository .conf files with
[cirros]
uri=http://download.cirros-cloud.net
format=simplestreams
to read the latest version of each CirrOS image.
TODO items:
- check the pasted metadata: listing and creating images works,
so most of the current metadata is correct
- possibly wait
2017 Nov 23
4
[PATCH 0/1] RFC: switch from YAJL to Jansson
Hi,
recently, there was a discussion in the development list of libvirt on
switching to a different JSON library than YAJL [1]. Since we use YAJL,
and the points there IMHO apply to libguestfs as well, I decided to give
a try in switching to Jansson [2].
The result IMHO is nice, with the additional APIs of Jansson that
simplify some of our code. Unlike with YAJL, I did not set a minimum
2017 Jul 21
0
[PATCH v2 01/23] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...me);
+}
+
+/* NB: This is a "noalloc" call. */
+value
+guestfs_int_daemon_get_verbose_flag (value unitv)
+{
+ return Val_bool (verbose);
+}
+
+/* Implement String (Mountable, _) parameter. */
+value
+guestfs_int_daemon_copy_mountable (const mountable_t *mountable)
+{
+ CAMLparam0 ();
+ CAMLlocal4 (r, typev, devicev, volumev);
+
+ switch (mountable->type) {
+ case MOUNTABLE_DEVICE:
+ typev = Val_int (0); /* MountableDevice */
+ break;
+ case MOUNTABLE_PATH:
+ typev = Val_int (1); /* MountablePath */
+ break;
+ case MOUNTABLE_BTRFSVOL:
+ volumev = caml_copy_string (mount...
2015 Sep 07
5
[PATCH 0/4 v3] builder: support for Simple Streams metadata
Hi,
this series adds a basic support for Simple Streams v1.0 metadata
files. This makes it possible to create a repository .conf files with
[cirros]
uri=http://download.cirros-cloud.net
format=simplestreams
to read the latest version of each CirrOS image.
Thanks,
Pino Toscano (4):
builder: add non-int revisions
builder: add simple libyajl binding
build: expose HAVE_YAJL to automake
2018 Aug 20
6
[PATCH 0/4] mltools: JSON unification
An evolution of:
https://www.redhat.com/archives/libguestfs/2018-August/msg00155.html