search for: parse_json

Displaying 20 results from an estimated 25 matches for "parse_json".

2018 Feb 12
0
[PATCH v2 1/1] Switch from YAJL to Jansson
.../ -#if defined(__GNUC__) && GUESTFS_GCC_VERSION >= 60000 /* gcc >= 6 */ -#pragma GCC diagnostic ignored "-Wnull-dereference" -#endif - int optgroup_ldm_available (void) { @@ -72,44 +65,42 @@ do_ldmtool_remove_all (void) return 0; } -static yajl_val +static json_t * parse_json (const char *json, const char *func) { - yajl_val tree; - char parse_error[1024]; + json_t *tree; + json_error_t err; if (verbose) fprintf (stderr, "%s: parsing json: %s\n", func, json); - tree = yajl_tree_parse (json, parse_error, sizeof parse_error); + tree = json_loa...
2017 Nov 23
0
[PATCH 1/1] Switch from YAJL to Jansson
.../ -#if defined(__GNUC__) && GUESTFS_GCC_VERSION >= 60000 /* gcc >= 6 */ -#pragma GCC diagnostic ignored "-Wnull-dereference" -#endif - int optgroup_ldm_available (void) { @@ -72,44 +65,42 @@ do_ldmtool_remove_all (void) return 0; } -static yajl_val +static json_t * parse_json (const char *json, const char *func) { - yajl_val tree; - char parse_error[1024]; + json_t *tree; + json_error_t err; if (verbose) fprintf (stderr, "%s: parsing json: %s\n", func, json); - tree = yajl_tree_parse (json, parse_error, sizeof parse_error); + tree = json_loa...
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
2017 Sep 12
0
[PATCH v2 3/5] lib: qemu: Run QMP ‘query-commands’, ‘query-qmp-schema’ against the qemu binary.
...tatic int read_cache_qemu_stat (guestfs_h *g, struct qemu_data *data, const char *filename); static int write_cache_qemu_stat (guestfs_h *g, const struct qemu_data *data, const char *filename); static void parse_qemu_version (guestfs_h *g, const char *, struct version *qemu_version); +static void parse_json (guestfs_h *g, const char *, yajl_val *); static void read_all (guestfs_h *g, void *retv, const char *buf, size_t len); static int generic_read_cache (guestfs_h *g, const char *filename, char **strp); static int generic_write_cache (guestfs_h *g, const char *filename, const char *str); +static i...
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.
2018 Sep 13
1
[PATCH] lib: direct: Query qemu binary for availability of KVM (RHBZ#1605071).
...tatic int read_cache_qemu_stat (guestfs_h *g, struct qemu_data *data, const char *filename); static int write_cache_qemu_stat (guestfs_h *g, const struct qemu_data *data, const char *filename); static void parse_qemu_version (guestfs_h *g, const char *, struct version *qemu_version); static void parse_json (guestfs_h *g, const char *, json_t **); +static void parse_has_kvm (guestfs_h *g, const char *, bool *); static void read_all (guestfs_h *g, void *retv, const char *buf, size_t len); static int generic_read_cache (guestfs_h *g, const char *filename, char **strp); static int generic_write_cache...
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.
2017 Dec 15
0
[PATCH v2] lib/info: Remove /dev/fd hacking and pass a true filename to qemu-img info.
...- guestfs_int_cmd_add_arg (cmd, fdpath); + if (filename[0] == '/') + guestfs_int_cmd_add_arg (cmd, filename); + else { + rel_filename = safe_asprintf (g, "./%s", filename); + guestfs_int_cmd_add_arg (cmd, rel_filename); + } guestfs_int_cmd_set_stdout_callback (cmd, parse_json, &tree, CMD_STDOUT_FLAG_WHOLE_BUFFER); set_child_rlimits (cmd); r = guestfs_int_cmd_run (cmd); - close (fd); if (r == -1) return NULL; if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) { -- 2.15.1
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).
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 12
1
Re: failure to virt-sysprep (FC27?)
..."); guestfs_int_cmd_add_arg (cmd, "info"); guestfs_int_cmd_add_arg (cmd, "--output"); guestfs_int_cmd_add_arg (cmd, "json"); - guestfs_int_cmd_add_arg (cmd, fdpath); + guestfs_int_cmd_add_arg (cmd, filename); guestfs_int_cmd_set_stdout_callback (cmd, parse_json, &tree, CMD_STDOUT_FLAG_WHOLE_BUFFER); set_child_rlimits (cmd); r = guestfs_int_cmd_run (cmd); - close (fd); if (r == -1) return NULL; if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) { -- 2.15.1 --HKEL+t8MFpg/ASTE--
2015 May 26
0
[PATCH] lib: Limit space and time used by 'qemu-img info' subprocess.
...sys/resource.h> +#endif + #if HAVE_YAJL #include <yajl/yajl_tree.h> #endif @@ -269,7 +277,13 @@ get_json_output (guestfs_h *g, const char *filename) guestfs_int_cmd_add_arg (cmd, "json"); guestfs_int_cmd_add_arg (cmd, fdpath); guestfs_int_cmd_set_stdout_callback (cmd, parse_json, &tree, - CMD_STDOUT_FLAG_WHOLE_BUFFER); + CMD_STDOUT_FLAG_WHOLE_BUFFER); +#ifdef RLIMIT_AS + guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_AS, 1000000000 /* 1GB */); +#endif +#ifdef RLIMIT_CPU + guestfs_int_cmd_set_chi...
2015 Oct 14
2
[PATCH 1/2] lib: info: Move common code for setting child rlimits.
...ar *filename); +static void set_child_rlimits (struct command *); char * guestfs_impl_disk_format (guestfs_h *g, const char *filename) @@ -276,12 +277,7 @@ get_json_output (guestfs_h *g, const char *filename) guestfs_int_cmd_add_arg (cmd, fdpath); guestfs_int_cmd_set_stdout_callback (cmd, parse_json, &tree, CMD_STDOUT_FLAG_WHOLE_BUFFER); -#ifdef RLIMIT_AS - guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_AS, 1000000000 /* 1GB */); -#endif -#ifdef RLIMIT_CPU - guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_CPU, 10 /* seconds */); -#endif + set_child_r...
2020 Jul 22
1
回复: 回复: bug report
...sk_format "10.188.188.34.sys.img" libguestfs: command: run: qemu-img --help | grep -sqE -- '\binfo\b.*-U\b' libguestfs: command: run: qemu-img libguestfs: command: run: \ info libguestfs: command: run: \ --output json libguestfs: command: run: \ ./10.188.188.34.sys.img libguestfs: parse_json: qemu-img info JSON output:\n{\n&nbsp; &nbsp; "virtual-size": 53687091200, \n&nbsp; &nbsp; "filename": "./10.188.188.34.sys.img", \n&nbsp; &nbsp; "cluster-size": 65536, \n&nbsp; &nbsp; "format": "qcow2", \n&...
2017 Sep 12
8
[PATCH v3 0/6] launch: direct: Disable qemu locking when opening drives readonly.
v2 -> v3: - I addressed everything that Pino mentioned last time. - It's tricky to get a stable run when multiple copies of qemu are involved, because the same cache files get overwritten by parallel libguestfs. So I changed the names of the cache files to include the qemu binary key (size, mtime), which removes this conflict. This is in new patch 4/6. Rich.
2017 Apr 07
2
difficulty using virt-v2v with OVA
...trace: set_verbose true libguestfs: trace: set_verbose = 0 libguestfs: trace: disk_has_backing_file "/var/tmp/v2vovle91365.qcow2" libguestfs: command: run: qemu-img libguestfs: command: run: \ info libguestfs: command: run: \ --output json libguestfs: command: run: \ /dev/fd/3 libguestfs: parse_json: qemu-img info JSON output:\n{\n "backing-filename-format": "vmdk",\n "virtual-size": 21474836480,\n "filename": "/dev/fd/3",\n "cluster-size": 65536,\n "format": "qcow2",\n "actual-size": 200704,\...
2017 Dec 12
4
Re: failure to virt-sysprep (FC27?)
On Thu, Nov 23, 2017 at 02:05:32PM +0000, Richard W.M. Jones wrote: > On Thu, Nov 23, 2017 at 03:00:45PM +0200, Yaniv Kaul wrote: > > On Thu, Nov 23, 2017 at 10:57 AM, Richard W.M. Jones <rjones@redhat.com> > > wrote: > > > > > On Tue, Nov 21, 2017 at 11:43:54PM +0200, Yaniv Kaul wrote: > > > > Since I upgrading to FC27, I *sometimes* fail to
2016 Jan 09
0
[PATCH] build: Require qemu >= 1.3.0 and yajl.
...t;yajl/yajl_tree.h> -#endif #include "daemon.h" #include "actions.h" #include "optgroups.h" -#if HAVE_YAJL - GUESTFSD_EXT_CMD(str_ldmtool, ldmtool); int @@ -441,9 +437,3 @@ do_ldmtool_volume_partitions (const char *diskgroup, const char *volume) return parse_json_get_object_string_list (out, "partitions", __func__, "ldmtool show volume"); } - -#else /* !HAVE_YAJL */ - -OPTGROUP_LDM_NOT_AVAILABLE - -#endif diff --git a/m4/guestfs_libraries.m4 b/m4/guestfs_libraries.m4 index 0187c20..c5a4a01 10...
2016 Jul 07
0
[PATCH 2/2] daemon: fix cleanup of stringsbuf usages
...st char *pattern) if (end_stringsbuf (&ret) == -1) goto error; globfree (&devs); - return ret.argv; + return take_stringsbuf (&ret); error: globfree (&devs); - if (ret.argv != NULL) - free_stringslen (ret.argv, ret.size); return NULL; } @@ -176,7 +174,7 @@ parse_json (const char *json, const char *func) static char ** json_value_to_string_list (yajl_val node) { - DECLARE_STRINGSBUF (strs); + CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (strs); yajl_val n; size_t i, len; @@ -194,7 +192,7 @@ json_value_to_string_list (yajl_val node) if (end_stringsb...