search for: yajl_val

Displaying 20 results from an estimated 45 matches for "yajl_val".

2017 Jan 03
0
[PATCH 1/5] builder: extract Yajl helper functions to yajl.ml
...ri = uri; proxy = proxy } = diff --git a/builder/yajl.ml b/builder/yajl.ml index 00e4dac4b..e53706abc 100644 --- a/builder/yajl.ml +++ b/builder/yajl.ml @@ -16,6 +16,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) +open Common_gettext.Gettext +open Common_utils + type yajl_val = | Yajl_null | Yajl_string of string @@ -26,3 +29,55 @@ type yajl_val = | Yajl_bool of bool external yajl_tree_parse : string -> yajl_val = "virt_builder_yajl_tree_parse" + +let object_find_optional key = function + | Yajl_object o -> + (match List.filter (fun (k, _) -&gt...
2018 Feb 12
0
[PATCH v2 1/1] Switch from YAJL to Jansson
...t;foo> later doesn't return NULL. - */ -#if defined(__GNUC__) && __GNUC__ >= 6 /* gcc >= 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 (...
2017 Nov 23
0
[PATCH 1/1] Switch from YAJL to Jansson
...t;foo> later doesn't return NULL. - */ -#if defined(__GNUC__) && __GNUC__ >= 6 /* gcc >= 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 (...
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
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
2018 Aug 20
1
Re: [PATCH v3 1/4] mltools: Rename Yajl module as JSON_parser and move to common/mltools.
...8458099db8a0bf4659a07ef055d changed all the code > to use Jansson instead of yajl. However it didn't change the OCaml > API name (which was still Yajl). This was done initially to avoid much larger patch/series for the yajl -> jansson conversion. And then... I forgot :-) > -type yajl_val = > -| Yajl_null > -| Yajl_string of string > -| Yajl_number of int64 > -| Yajl_double of float > -| Yajl_object of (string * yajl_val) array > -| Yajl_array of yajl_val array > -| Yajl_bool of bool > +type json_parser_val = > +| JSON_parser_null > +| JSON_parser_strin...
2018 Aug 17
0
[PATCH v3 1/4] mltools: Rename Yajl module as JSON_parser and move to common/mltools.
...ff --git a/builder/utils.mli b/builder/utils.mli index 4249fd956..5dde43a01 100644 --- a/builder/utils.mli +++ b/builder/utils.mli @@ -29,9 +29,9 @@ and revision = val string_of_revision : revision -> string (** Convert a {!revision} into a string. *) -val get_image_infos : string -> Yajl.yajl_val +val get_image_infos : string -> JSON_parser.json_parser_val (** [get_image_infos path] Run qemu-img info on the image pointed at - path as YAJL tree. *) + path as JSON tree. *) val increment_revision : revision -> revision (** Add one to the revision number *) diff --git a/builder...
2016 Jan 09
0
[PATCH] build: Require qemu >= 1.3.0 and yajl.
...#include <yajl/yajl_tree.h> -#endif #include <stdio.h> #include <string.h> #define Val_none (Val_int (0)) -value virt_builder_yajl_is_available (value unit); - -#if HAVE_YAJL value virt_builder_yajl_tree_parse (value stringv); static value @@ -95,13 +90,6 @@ convert_yajl_value (yajl_val val, int level) } value -virt_builder_yajl_is_available (value unit) -{ - /* NB: noalloc */ - return Val_true; -} - -value virt_builder_yajl_tree_parse (value stringv) { CAMLparam1 (stringv); @@ -124,21 +112,3 @@ virt_builder_yajl_tree_parse (value stringv) CAMLreturn (r...
2018 Aug 17
8
[PATCH v3 4/4] v2v: Add --print-estimate option to print copy size
I rethought this again, as I think that it's a dangerous assumption to bake qemu-img measure output into our API. This patch series runs qemu-img measure behind the scenes, but then parses the output and sums it to a single number which we print. Doing that required a bit of reworking, moving the Jansson [JSON parser] bindings from virt-builder into the common directory and a couple of other
2015 Aug 12
0
[PATCH 2/2] builder: support Simple Streams v1.0 as index metadata
...E_YAJL +#include <yajl/yajl_tree.h> +#endif + +#include <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_al...
2012 Dec 07
2
[PATCH] Add support for Windows dynamic disks (libldm / ldmtool).
This is just an initial version of the patch, not to be applied. It implements just the diskgroup functions, ie. corresponding to these ldmtool commands: * ldmtool scan * ldmtool show diskgroup <guid> I have chosen yajl as the JSON parsing library (don't worry, this is optional). You will also, of course, need ldmtool which is not packaged in anything except Fedora. Rich.
2017 Sep 12
0
[PATCH v2 4/5] lib: qemu: Add accessor to test if qemu does mandatory locking.
...ll-dereference" +#endif + +/** + * Test if the QMP schema contains a particular C<(key, value)> pair + * (anywhere). QMP is almost impossible to parse sanely so this is + * the minimum we need to detect if C<"locking"> is supported. + */ +static int +qmp_schema_contains (yajl_val tree, const char *key, const char *value) +{ + size_t i; + + if (YAJL_IS_OBJECT (tree)) { + for (i = 0; i < YAJL_GET_OBJECT(tree)->len; ++i) { + const char *k; + yajl_val v; + + k = YAJL_GET_OBJECT(tree)->keys[i]; + v = YAJL_GET_OBJECT(tree)->values[i]; + +...
2018 Aug 20
6
[PATCH 0/4] mltools: JSON unification
An evolution of: https://www.redhat.com/archives/libguestfs/2018-August/msg00155.html
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 Sep 12
0
[PATCH v2 3/5] lib: qemu: Run QMP ‘query-commands’, ‘query-qmp-schema’ against the qemu binary.
...t of qemu -device ? */ + char *qmp_commands; /* Output of QMP query-commands. */ + char *qmp_schema; /* Output of QMP query-qmp-schema. */ /* The following fields are derived from the fields above. */ struct version qemu_version; /* Parsed qemu version number. */ + yajl_val qmp_commands_tree; /* qmp_commands parsed into a JSON tree */ + yajl_val qmp_schema_tree; /* qmp_schema parsed into a JSON tree */ }; static int test_qemu_help (guestfs_h *g, struct qemu_data *data); @@ -61,12 +67,20 @@ static int write_cache_qemu_help (guestfs_h *g, const struct qemu_da...
2017 Sep 12
9
[PATCH v2 0/5] launch: direct: Disable qemu locking when opening drives readonly (RHBZ#1417306)
Patches 1-4 are almost the same as they are when previously posted here: https://www.redhat.com/archives/libguestfs/2017-September/msg00039.html Patch 5 actually uses the mandatory locking test to turn off locking in the narrow case where a drive is opened readonly, and then only for the drive being inspected. Passes ordinary tests (‘check-direct’ and ‘check-valgrind-direct’). Rich.
2017 Dec 15
0
[PATCH v2] lib/info: Remove /dev/fd hacking and pass a true filename to qemu-img info.
...8adfd..c58b3ebfb 100644 --- a/lib/info.c +++ b/lib/info.c @@ -24,7 +24,6 @@ #include <fcntl.h> #include <unistd.h> #include <sys/types.h> -#include <sys/stat.h> #include <sys/wait.h> #include <assert.h> #include <string.h> @@ -166,41 +165,24 @@ static yajl_val get_json_output (guestfs_h *g, const char *filename) { CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); - int fd, r; - char fdpath[64]; + CLEANUP_FREE char *rel_filename = NULL; + int r; yajl_val tree = NULL; - struct stat statbuf; - - fd = open (filename, O_RDONLY...
2017 Dec 15
2
[PATCH v2] lib/info: Remove /dev/fd hacking and pass a true filename
v1 posted here: https://www.redhat.com/archives/libguestfs/2017-December/msg00050.html v2 fixes the tests by rewriting relative paths as ./filename (so that filenames like "file:foo" work).
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
2017 Sep 11
4
[PATCH 0/4] lib: qemu: Add test for mandatory locking.
The patch I posted last week to disable mandatory locking for readonly drives (https://www.redhat.com/archives/libguestfs/2017-September/msg00013.html) was wrong in a couple of respects. Firstly it didn't work, which I didn't detect because my tests were testing the wrong thing. Oops. Secondly it used a simple version number check to detect qemu binaries implementing mandatory locking.