search for: generic_write_cache

Displaying 12 results from an estimated 12 matches for "generic_write_cache".

2017 Sep 12
0
[PATCH v2 3/5] lib: qemu: Run QMP ‘query-commands’, ‘query-qmp-schema’ against the qemu binary.
...(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 int generic_qmp_test (guestfs_h *g, struct qemu_data *data, const char *qmp_command, char **outp); /* This structure abstracts the data we are reading from qemu and how * we get it. @@ -89,6 +103,10 @@ static const struct qemu_fiel...
2017 Sep 12
2
Re: [PATCH v2 2/5] lib: qemu: Factor out common code for reading and writing cache files.
...ss() failed for any other error though; IMHO a better check could be: if (access (filename, R_OK) == -1) { if (errno == ENOENT) return 0; /* no cache, run the test instead */ perrorf (g, "access: %s", filename); return -1; } > +static int > +generic_write_cache (guestfs_h *g, const char *filename, const char *str) > +{ > + CLEANUP_FCLOSE FILE *fp = fopen (filename, "w"); > + if (fp == NULL) { > + perrorf (g, "%s", filename); > + return -1; > + } > + > + if (fprintf (fp, "%s", str) == -1) { &g...
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 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 Sep 12
0
[PATCH v2 2/5] lib: qemu: Factor out common code for reading and writing cache files.
...data *data, const char *filename); static void parse_qemu_version (guestfs_h *g, const char *, struct version *qemu_version); 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); + +/* This structure abstracts the data we are reading from qemu and how + * we get it. + */ +static const struct qemu_fields { + const char *name; + /* Function to perform the test on g->hv. */ + int (*test) (guestfs_h *g, struct qemu_da...
2018 Sep 13
1
[PATCH] lib: direct: Query qemu binary for availability of KVM (RHBZ#1605071).
...atic 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 (guestfs_h *g, const char *filename, const char *str); @@ -105,6 +124,8 @@ static const struct qemu_fields { test_qemu_devices, read_cache_qemu_devices, write_cache_qemu_devices }, { "qmp-schema", test_qmp_schema, read_cache_qmp_schema, write_cache_qmp_schema }, + { "qu...
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 Sep 12
0
Re: [PATCH v2 2/5] lib: qemu: Factor out common code for reading and writing cache files.
...ache, run the test instead */ > perrorf (g, "access: %s", filename); > return -1; > } But isn't it OK since the following line will return the true error: if (guestfs_int_read_whole_file (g, filename, strp, NULL) == -1) ... ? > > +static int > > +generic_write_cache (guestfs_h *g, const char *filename, const char *str) > > +{ > > + CLEANUP_FCLOSE FILE *fp = fopen (filename, "w"); > > + if (fp == NULL) { > > + perrorf (g, "%s", filename); > > + return -1; > > + } > > + > > + if (fprin...
2018 Feb 12
0
[PATCH v2 1/1] Switch from YAJL to Jansson
...tic void parse_json (guestfs_h *g, const char *, yajl_val *); +static void parse_json (guestfs_h *g, const char *, json_t **); 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); @@ -405,17 +405,17 @@ parse_qemu_version (guestfs_h *g, const char *qemu_help, * is not possible. */ static void -parse_json (guestfs_h *g, const char *json, yajl_val *treep) +parse_json (guestfs_h *g, const char *json, json_t **treep) {...
2017 Nov 23
0
[PATCH 1/1] Switch from YAJL to Jansson
...tic void parse_json (guestfs_h *g, const char *, yajl_val *); +static void parse_json (guestfs_h *g, const char *, json_t **); 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); @@ -405,17 +405,17 @@ parse_qemu_version (guestfs_h *g, const char *qemu_help, * is not possible. */ static void -parse_json (guestfs_h *g, const char *json, yajl_val *treep) +parse_json (guestfs_h *g, const char *json, json_t **treep) {...
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