search for: cleanup_cmd_close

Displaying 20 results from an estimated 71 matches for "cleanup_cmd_close".

2020 Aug 12
2
[PATCH v2] appliance: extract UUID from QCOW2 disk image
...b/lib/appliance-kcmdline.c @@ -71,7 +71,7 @@ read_uuid (guestfs_h *g, void *retv, const char *line, size_t len) * The L<file(1)> command does the hard work. */ static char * -get_root_uuid (guestfs_h *g, const char *appliance) +do_get_root_uuid (guestfs_h *g, const char *appliance) { CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); char *ret = NULL; @@ -96,6 +96,74 @@ get_root_uuid (guestfs_h *g, const char *appliance) } /** + * Read the first 256k bytes of the in_file with L<qemu-img(1)> command + * and write them into the out_file. That may be useful to get UUI...
2016 Mar 22
0
[PATCH v3 07/11] launch: direct: Don't run qemu -version.
...mu -version' so we know what options this qemu supports and - * the version. +/* Test qemu binary (or wrapper) runs, and do 'qemu -help' so we know + * the version of qemu what options this qemu supports. */ static int test_qemu (guestfs_h *g, struct backend_direct_data *data) { CLEANUP_CMD_CLOSE struct command *cmd1 = guestfs_int_new_command (g); CLEANUP_CMD_CLOSE struct command *cmd2 = guestfs_int_new_command (g); - CLEANUP_CMD_CLOSE struct command *cmd3 = guestfs_int_new_command (g); int r; free (data->qemu_help); data->qemu_help = NULL; - free (data->qemu_versio...
2020 Aug 13
2
[PATCH v3] appliance: extract UUID from QCOW2 disk image
...ppliance-kcmdline.c @@ -71,7 +71,7 @@ read_uuid (guestfs_h *g, void *retv, const char *line, size_t len) * The L<file(1)> command does the hard work. */ static char * -get_root_uuid (guestfs_h *g, const char *appliance) +get_root_uuid_with_file (guestfs_h *g, const char *appliance) { CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); char *ret = NULL; @@ -96,6 +96,72 @@ get_root_uuid (guestfs_h *g, const char *appliance) } /** + * Read the first 256k bytes of the in_file with L<qemu-img(1)> command + * and write them into the out_file. That may be useful to get UUI...
2018 Sep 21
4
[PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...dle. + * + * Note this option was added in qemu 2.11. We can remove this test + * when we can assume everyone is using qemu >= 2.11. + */ +static int +qemu_img_supports_U_option (guestfs_h *g) +{ + if (g->qemu_img_supports_U_option >= 0) + return g->qemu_img_supports_U_option; + + CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); + int r; + + guestfs_int_cmd_add_string_unquoted (cmd, + "qemu-img info --help | " + "grep -sq -- 'info.*-U'"); + r = guestfs_int_cmd_run (cm...
2016 May 17
2
[PATCH 0/2] Use -bios bios-fast.bin where supported.
NOTE: Not for upstream, yet. This depends on 3 non-upstream patches. - The qemu rework in libguestfs, which in turn depends on what Pino is up to. - Support for '-L ?' in qemu: https://lists.gnu.org/archive/html/qemu-devel/2016-05/threads.html#02596 - Support for bios-fast.bin in qemu: https://lists.gnu.org/archive/html/qemu-devel/2016-05/threads.html#02408 This commit
2020 Aug 12
0
[PATCH] appliance: extract UUID from QCOW2 disk image
...b/lib/appliance-kcmdline.c @@ -71,7 +71,7 @@ read_uuid (guestfs_h *g, void *retv, const char *line, size_t len) * The L<file(1)> command does the hard work. */ static char * -get_root_uuid (guestfs_h *g, const char *appliance) +do_get_root_uuid (guestfs_h *g, const char *appliance) { CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); char *ret = NULL; @@ -96,6 +96,74 @@ get_root_uuid (guestfs_h *g, const char *appliance) } /** + * Read the first 256k bytes of the in_file with L<qemu-img(1)> command + * and write them into the out_file. That may be useful to get UUI...
2017 Sep 12
0
[PATCH v2 2/5] lib: qemu: Factor out common code for reading and writing cache files.
...ed fields. */ + parse_qemu_version (g, data->qemu_help, &data->qemu_version); return data; + + error: + guestfs_int_free_qemu_data (data); + return NULL; } static int -test_qemu (guestfs_h *g, struct qemu_data *data) +test_qemu_help (guestfs_h *g, struct qemu_data *data) { - CLEANUP_CMD_CLOSE struct command *cmd1 = guestfs_int_new_command (g); - CLEANUP_CMD_CLOSE struct command *cmd2 = guestfs_int_new_command (g); + CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); int r; - guestfs_int_cmd_add_arg (cmd1, g->hv); - guestfs_int_cmd_add_arg (cmd1, "-disp...
2016 May 18
2
[PATCH v2 0/2] Use -bios bios-fast.bin where supported.
This commit uses -bios bios-fast.bin if available, which basically stops SeaBIOS from trying to do PCI probing during boot, which is a waste of time when using the -kernel option. v1 -> v2: - Rebase on top of Pino's work. This still has 3 dependencies: - The qemu memoization work (v2). - Support for '-L ?' in qemu:
2020 Aug 13
0
Re: [PATCH v3] appliance: extract UUID from QCOW2 disk image
...@@ read_uuid (guestfs_h *g, void *retv, const char *line, size_t len) > * The L<file(1)> command does the hard work. > */ > static char * > -get_root_uuid (guestfs_h *g, const char *appliance) > +get_root_uuid_with_file (guestfs_h *g, const char *appliance) > { > CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); > char *ret = NULL; > @@ -96,6 +96,72 @@ get_root_uuid (guestfs_h *g, const char *appliance) > } > > /** > + * Read the first 256k bytes of the in_file with L<qemu-img(1)> command > + * and write them into the out_...
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.
2020 Aug 12
0
Re: [PATCH] appliance: extract UUID from QCOW2 disk image
..., void *retv, const char *line, size_t len) > > * The L<file(1)> command does the hard work. > > */ > > static char * > >-get_root_uuid (guestfs_h *g, const char *appliance) > >+do_get_root_uuid (guestfs_h *g, const char *appliance) > > { > > CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); > > char *ret = NULL; > >@@ -96,6 +96,74 @@ get_root_uuid (guestfs_h *g, const char *appliance) > > } > > /** > >+ * Read the first 256k bytes of the in_file with L<qemu-img(1)> command > >+ * and writ...
2020 Aug 12
0
Re: [PATCH] appliance: extract UUID from QCOW2 disk image
...ne, size_t len) > >>   * The L<file(1)> command does the hard work. > >>   */ > >>  static char * > >>-get_root_uuid (guestfs_h *g, const char *appliance) > >>+do_get_root_uuid (guestfs_h *g, const char *appliance) > >>  { > >>    CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); > >>    char *ret = NULL; > >>@@ -96,6 +96,74 @@ get_root_uuid (guestfs_h *g, const char *appliance) > >>  } > >>  /** > >>+ * Read the first 256k bytes of the in_file with L<qemu-img(1)> command &...
2018 Oct 04
2
Re: [PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...* when we can assume everyone is using qemu >= 2.11. > > + */ > > +static int > > +qemu_img_supports_U_option (guestfs_h *g) > > +{ > > + if (g->qemu_img_supports_U_option >= 0) > > + return g->qemu_img_supports_U_option; > > + > > + CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); > > + int r; > > + > > + guestfs_int_cmd_add_string_unquoted (cmd, > > + "qemu-img info --help | " > > + "grep -sq -- 'in...
2018 Aug 22
1
[PATCH] lib: create: avoid one extra string allocation
...const struct guestfs_disk_create_argv *optargs) { - CLEANUP_FREE char *filename = NULL; const char *backingformat = NULL; const char *preallocation = NULL; const char *compat = NULL; @@ -263,16 +262,6 @@ disk_create_qcow2 (guestfs_h *g, const char *orig_filename, int64_t size, CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); int r; - /* If the filename is something like "file:foo" then qemu-img will - * try to interpret that as "foo" in the file:/// protocol. To - * avoid that, if the path is relative prefix it with "./" since -...
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
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.
2016 May 12
0
[PATCH 4/4] lib: qemu: Memoize qemu feature detection.
...MEMO_GENERATION, + (uint64_t) statbuf.st_size, + (uint64_t) statbuf.st_mtime, + g->hv) == -1) + goto stat_error; + if (fclose (fp) == -1) + goto stat_error; + + return data; +} + +static int +test_qemu (guestfs_h *g, struct qemu_data *data) +{ CLEANUP_CMD_CLOSE struct command *cmd1 = guestfs_int_new_command (g); CLEANUP_CMD_CLOSE struct command *cmd2 = guestfs_int_new_command (g); int r; - struct qemu_data *data; - - data = safe_calloc (g, 1, sizeof *data); guestfs_int_cmd_add_arg (cmd1, g->hv); guestfs_int_cmd_add_arg (cmd1, "-dis...
2016 May 18
2
[PATCH v2 0/2] lib: qemu: Memoize qemu feature detection.
v1 -> v2: - Rebase on top of Pino's version work. Two patches went upstream, these are the two remaining patches. Note the generation number is still inside the qemu.stat file. We could put it in the filename, I have no particular preference. Rich.
2015 Feb 02
1
Re: [PATCH 5/6] New APIs: copy-in and copy-out
...> +#include "guestfs-internal-actions.h" > + > +static int split_path (char *buf, size_t buf_size, const char *path, const char **dirname, const char **basename); > + > +int > +guestfs__copy_in (guestfs_h *g, const char *localpath, const char *remotedir) > +{ > + CLEANUP_CMD_CLOSE struct command *cmd = guestfs___new_command (g); > + int fd; > + int r; > + char fdbuf[64]; > + size_t buf_len = strlen (localpath) + 1; > + char buf[buf_len]; > + const char *dirname, *basename; > + > + if (guestfs_is_dir (g, remotedir) == -1) > + return -1; I...
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.