search for: get_json_output

Displaying 16 results from an estimated 16 matches for "get_json_output".

2018 Feb 12
0
[PATCH v2 1/1] Switch from YAJL to Jansson
...cleanup(cleanup_json_t_decref))) static void -cleanup_yajl_tree_free (void *ptr) +cleanup_json_t_decref (void *ptr) { - yajl_tree_free (* (yajl_val *) ptr); + json_decref (* (json_t **) ptr); } #else -#define CLEANUP_YAJL_TREE_FREE +#define CLEANUP_JSON_T_DECREF #endif -static yajl_val get_json_output (guestfs_h *g, const char *filename); +static json_t *get_json_output (guestfs_h *g, const char *filename); static void set_child_rlimits (struct command *); char * guestfs_impl_disk_format (guestfs_h *g, const char *filename) { - size_t i, len; - CLEANUP_YAJL_TREE_FREE yajl_val tree = get_...
2017 Nov 23
0
[PATCH 1/1] Switch from YAJL to Jansson
...cleanup(cleanup_json_t_decref))) static void -cleanup_yajl_tree_free (void *ptr) +cleanup_json_t_decref (void *ptr) { - yajl_tree_free (* (yajl_val *) ptr); + json_decref (* (json_t **) ptr); } #else -#define CLEANUP_YAJL_TREE_FREE +#define CLEANUP_JSON_T_DECREF #endif -static yajl_val get_json_output (guestfs_h *g, const char *filename); +static json_t *get_json_output (guestfs_h *g, const char *filename); static void set_child_rlimits (struct command *); char * guestfs_impl_disk_format (guestfs_h *g, const char *filename) { - size_t i, len; - CLEANUP_YAJL_TREE_FREE yajl_val tree = get_...
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 Sep 21
4
[PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...see lib/info.c */ + /* Start with large serial numbers so they are easy to spot * inside the protocol. */ diff --git a/lib/info.c b/lib/info.c index 2eadc1c11..74e4424b8 100644 --- a/lib/info.c +++ b/lib/info.c @@ -57,6 +57,7 @@ cleanup_json_t_decref (void *ptr) #endif static json_t *get_json_output (guestfs_h *g, const char *filename); +static int qemu_img_supports_U_option (guestfs_h *g); static void set_child_rlimits (struct command *); char * @@ -149,6 +150,11 @@ get_json_output (guestfs_h *g, const char *filename) guestfs_int_cmd_add_arg (cmd, "qemu-img"); guestfs_in...
2018 Sep 12
1
[PATCH] lib: Use qemu-img info -U option to avoid locking error.
https://bugs.launchpad.net/qemu/+bug/1740364 --- lib/info.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/info.c b/lib/info.c index 442a9755b..86044855e 100644 --- a/lib/info.c +++ b/lib/info.c @@ -149,6 +149,7 @@ get_json_output (guestfs_h *g, const char *filename) guestfs_int_cmd_add_arg (cmd, QEMU_IMG); guestfs_int_cmd_add_arg (cmd, "info"); + guestfs_int_cmd_add_arg (cmd, "-U"); guestfs_int_cmd_add_arg (cmd, "--output"); guestfs_int_cmd_add_arg (cmd, "json"); if...
2018 Oct 02
0
Re: [PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...l numbers so they are easy to spot > * inside the protocol. > */ > diff --git a/lib/info.c b/lib/info.c > index 2eadc1c11..74e4424b8 100644 > --- a/lib/info.c > +++ b/lib/info.c > @@ -57,6 +57,7 @@ cleanup_json_t_decref (void *ptr) > #endif > > static json_t *get_json_output (guestfs_h *g, const char *filename); > +static int qemu_img_supports_U_option (guestfs_h *g); > static void set_child_rlimits (struct command *); > > char * > @@ -149,6 +150,11 @@ get_json_output (guestfs_h *g, const char *filename) > > guestfs_int_cmd_add_arg (cmd, &quot...
2016 Jan 09
0
[PATCH] build: Require qemu >= 1.3.0 and yajl.
...ename); -#if HAVE_YAJL +#ifdef HAVE_ATTRIBUTE_CLEANUP +#define CLEANUP_YAJL_TREE_FREE __attribute__((cleanup(cleanup_yajl_tree_free))) + +static void +cleanup_yajl_tree_free (void *ptr) +{ + yajl_tree_free (* (yajl_val *) ptr); +} + +#else +#define CLEANUP_YAJL_TREE_FREE +#endif + static yajl_val get_json_output (guestfs_h *g, const char *filename); -#endif -static char *old_parser_disk_format (guestfs_h *g, const char *filename); -static int64_t old_parser_disk_virtual_size (guestfs_h *g, const char *filename); -static int old_parser_disk_has_backing_file (guestfs_h *g, const char *filename); static void...
2015 Oct 14
2
[PATCH 1/2] lib: info: Move common code for setting child rlimits.
...but I also set the memory limit to really 1 GB, and not 1×10⁹. --- src/info.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/info.c b/src/info.c index d7f45f0..616ef50 100644 --- a/src/info.c +++ b/src/info.c @@ -56,6 +56,7 @@ static yajl_val get_json_output (guestfs_h *g, const char *filename); static char *old_parser_disk_format (guestfs_h *g, const char *filename); static int64_t old_parser_disk_virtual_size (guestfs_h *g, const char *filename); static int old_parser_disk_has_backing_file (guestfs_h *g, const char *filename); +static void set_chi...
2017 Dec 15
0
[PATCH v2] lib/info: Remove /dev/fd hacking and pass a true filename to qemu-img info.
...b3ebfb 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 /* NB: !O_CLOEXE...
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 Dec 12
1
Re: failure to virt-sysprep (FC27?)
...6dcbfc 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,18 @@ 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]; + int r; yajl_val tree = NULL; - struct stat statbuf; - - fd = open (filename, O_RDONLY /* NB: !O_CLOEXEC */); - if (fd == -1) { - perrorf (g,...
2015 May 26
0
[PATCH] lib: Limit space and time used by 'qemu-img info' subprocess.
.../src/info.c @@ -31,6 +31,14 @@ #include <assert.h> #include <string.h> +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif + +#ifdef HAVE_SYS_RESOURCE_H +#include <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); +...
2017 Oct 06
2
[PATCH] lib: Pick up qemu-img path at build time.
...stfs_int_external_command_failed (g, r, "qemu-img", orig_filename); + guestfs_int_external_command_failed (g, r, QEMU_IMG, orig_filename); return -1; } diff --git a/lib/info.c b/lib/info.c index f7378adfd..4464df994 100644 --- a/lib/info.c +++ b/lib/info.c @@ -191,7 +191,7 @@ get_json_output (guestfs_h *g, const char *filename) snprintf (fdpath, sizeof fdpath, "/dev/fd/%d", fd); guestfs_int_cmd_clear_close_files (cmd); - guestfs_int_cmd_add_arg (cmd, "qemu-img"); + guestfs_int_cmd_add_arg (cmd, QEMU_IMG); guestfs_int_cmd_add_arg (cmd, "info");...
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
2015 Feb 14
2
[PATCH 0/2] Change guestfs__*
libguestfs has used double and triple underscores in identifiers. These aren't valid for global names in C++. (http://stackoverflow.com/a/228797) These large but completely mechanical patches change the illegal identifiers to legal ones. Rich.