search for: guestfs_int_count_str

Displaying 20 results from an estimated 74 matches for "guestfs_int_count_str".

2016 May 24
2
[PATCH] utils: make guestfs_int_count_strings return 0 on NULL input
This miniature patch makes function guestfs_int_count_strings accept NULL input and return 0 signalling that it is empty list. It makes it more usefull with NULL initialized variables and a tiny bit more robust. Maros Zatko (1): utils: make guestfs_int_count_strings return 0 on NULL input src/utils.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.5....
2017 Jun 19
0
[PATCH v7 13/13] daemon: Link guestfsd with libutils.
...5adc959a5..bd54c4849 100644 --- a/daemon/augeas.c +++ b/daemon/augeas.c @@ -436,7 +436,7 @@ do_aug_ls (const char *path) if (matches == NULL) return NULL; /* do_aug_match has already sent the error */ - sort_strings (matches, count_strings ((void *) matches)); + sort_strings (matches, guestfs_int_count_strings ((void *) matches)); return matches; /* Caller frees. */ } diff --git a/daemon/btrfs.c b/daemon/btrfs.c index ae2310b53..5f1e5d1d0 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -152,7 +152,7 @@ do_mkfs_btrfs (char *const *devices, int leafsize, const char *label, co...
2016 May 24
0
[PATCH] utils: make guestfs_int_count_strings return 0 on NULL input
Make guestfs_int_count_strings a bit more robust and usefull with NULL initialized variables. --- src/utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils.c b/src/utils.c index f099a22..3639e92 100644 --- a/src/utils.c +++ b/src/utils.c @@ -55,6 +55,9 @@ guestfs_int_count_strings (char *const *argv) {...
2016 May 24
1
[PATCH] rescue: add --autosysroot option RHBZ#1183493
...l command line in format guestfs_command=command;. Command ends with a semicolon and there can be multiple commands specified. These are executed just before bash starts. On successfull run user is presented directly with bash in chroot environment. RFE: RHBZ#1183493 Depends on commit: utils: make guestfs_int_count_strings return 0 on NULL input Maros Zatko (1): rescue: add --autosysroot option RHBZ#1183493 appliance/init | 6 +++ rescue/rescue.c | 160 ++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 134 insertions(+), 32 deletions(-) -- 2.5.5
2019 Dec 20
3
[common/libguestfs PATCH 0/2] Fix OCaml/Python linking
Make sure they can build also in no as-neede setups. Pino Toscano (1): utils: split string list functions in own file build: use split stringlist functions from common/utils utils/Makefile.am | 2 + utils/guestfs-stringlists-utils.h | 30 +++++ utils/guestfs-utils.h | 7 +- utils/stringlists-utils.c | 197 ++++++++++++++++++++++++++++++ utils/utils.c
2018 Aug 06
1
[PATCH] btrfs_balance_status: delay allocation of 'ret'
...l leak it. --- daemon/btrfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 26757d4fb..5c4be6cf7 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1683,12 +1683,6 @@ do_btrfs_balance_status (const char *path) nlines = guestfs_int_count_strings (lines); - ret = calloc (1, sizeof *ret); - if (ret == NULL) { - reply_with_perror ("calloc"); - return NULL; - } - /* Output of `btrfs balance status' is like: * * running: @@ -1711,6 +1705,12 @@ do_btrfs_balance_status (const char *path) return NULL;...
2019 Nov 27
1
Re: [PATCH common v2 2/3] options: Allow multiple --key parameters.
...l --key /dev/sda1:key:trykey1 --key /dev/sda1:key:trykey2 > > would try "trykey1" and "trykey2" against /dev/sda1. > --- Mostly LGTM, just one note/question below. > + CLEANUP_FREE_STRING_LIST char **keys = get_keys (ks, partitions[i]); > + > + if (guestfs_int_count_strings (keys) == 0) > + error (EXIT_FAILURE, 0, > + _("no key was provided to open LUKS encrypted %s, " > + "try using --key on the command line"), > + partitions[i]); Is this check ever going to be true? get_keys() ca...
2016 Jun 01
0
[PATCH v2] rescue: add --autosysroot option RHBZ#1183493
...suggestion (struct drv *drvs) if (roots[0] == NULL) { suggest_filesystems (); - return; + return NULL; } printf (_("This disk contains one or more operating systems. You can use these mount\n" @@ -436,10 +526,16 @@ do_suggestion (struct drv *drvs) qsort (mps, guestfs_int_count_strings (mps) / 2, 2 * sizeof (char *), compare_keys_len); - for (j = 0; mps[j] != NULL; j += 2) - printf ("mount %s /sysroot%s\n", mps[j+1], mps[j]); + /* First we save commands to mount system root. */ + for (j = 0; mps[j] != NULL; j += 2) { + int cnt = gues...
2016 Jun 01
2
[PATCH v2] rescue: add --autosysroot option RHBZ#1183493
--autosysroot option uses suggestions to user on how to mount filesystems and change root suggested by --suggest option in virt-rescue. Commands are passed on kernel command line in format guestfs_command=command;. Command ends with a semicolon and there can be multiple commands specified. These are executed just before bash starts. On successfull run user is presented directly with bash in
2015 Jul 21
1
[PATCH] p2v: tests: Don't fail when test machine has only a single hard disk.
...index dce6fbb..b283417 100644 --- a/p2v/kernel.c +++ b/p2v/kernel.c @@ -206,6 +206,15 @@ kernel_configuration (struct config *config, char **cmdline, int cmdline_source) exit (EXIT_SUCCESS); } + /* Some disks must have been specified for conversion. */ + if (config->disks == NULL || guestfs_int_count_strings (config->disks) == 0) { + fprintf (stderr, "%s: error: no non-removable disks were discovered on this machine.\n", + guestfs_int_program_name); + fprintf (stderr, "virt-p2v looked in /sys/block and in p2v.disks on the kernel command line.\n"); + fprin...
2019 Nov 12
0
[PATCH 2/2] options: Allow multiple --key parameters and default keys.
...call guestfs_luks_open_ro if readonly flag - * is set? This might break 'mount_ro'. - */ - if (guestfs_luks_open (g, partitions[i], key, mapname) == -1) - exit (EXIT_FAILURE); - + CLEANUP_FREE_STRING_LIST char **keys = get_keys (ks, partitions[i]); + + if (guestfs_int_count_strings (keys) == 0) + error (EXIT_FAILURE, 0, + _("no key was provided to open LUKS encrypted %s, " + "try using --key on the command line"), + partitions[i]); + + /* Try each key in turn. */ + for (j = 0; keys[j] != NULL...
2019 Nov 26
6
[PATCH options v2 0/3] options: Allow multiple and default --key parameters.
v1: https://www.redhat.com/archives/libguestfs/2019-November/msg00036.html
2020 Mar 12
0
[PATCH libguestfs 1/3] daemon: xattr: Refactor code which splits attr names from the kernel.
...get from the kernel is a string "foo\0bar\0baz" of length - * len. First count the strings. - */ - r->guestfs_int_xattr_list_len = 0; - for (i = 0; i < (size_t) len; i += strlen (&buf[i]) + 1) - r->guestfs_int_xattr_list_len++; + r->guestfs_int_xattr_list_len = guestfs_int_count_strings (names); r->guestfs_int_xattr_list_val = calloc (r->guestfs_int_xattr_list_len, sizeof (guestfs_int_xattr)); @@ -134,34 +163,34 @@ getxattrs (const char *path, goto error; } - for (i = 0, j = 0; i < (size_t) len; i += strlen (&buf[i]) + 1, ++j) { + for (i = 0;...
2020 Mar 16
0
[PATCH libguestfs v2 1/3] daemon: xattr: Refactor code which splits attr names from the kernel.
...get from the kernel is a string "foo\0bar\0baz" of length - * len. First count the strings. - */ - r->guestfs_int_xattr_list_len = 0; - for (i = 0; i < (size_t) len; i += strlen (&buf[i]) + 1) - r->guestfs_int_xattr_list_len++; + r->guestfs_int_xattr_list_len = guestfs_int_count_strings (names); r->guestfs_int_xattr_list_val = calloc (r->guestfs_int_xattr_list_len, sizeof (guestfs_int_xattr)); @@ -134,34 +160,34 @@ getxattrs (const char *path, goto error; } - for (i = 0, j = 0; i < (size_t) len; i += strlen (&buf[i]) + 1, ++j) { + for (i = 0;...
2020 Mar 16
6
[PATCH libguestfs v2 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
v1 here: https://www.redhat.com/archives/libguestfs/2020-March/msg00099.html This one fixes most of the points picked up in review, and does not strdup the strings which should keep down memory usage if that is a concern. Rich.
2020 Feb 20
0
[PATCH] daemon: Translate device names if Linux device ordering is unstable (RHBZ#1804207).
...vice name translation cache: %s", err); + + lines = split_lines (out); + if (lines == NULL) + error (EXIT_FAILURE, errno, "split_lines"); + + /* Delete entries for partitions. */ + for (i = 0; lines[i] != NULL; ++i) { + if (strstr (lines[i], "-part")) { + n = guestfs_int_count_strings (&lines[i+1]); + memmove (&lines[i], &lines[i+1], (n+1) * sizeof (char *)); + i--; + } + } + + cache_size = guestfs_int_count_strings (lines); + cache = calloc (cache_size, sizeof (char *)); + if (cache == NULL) + error (EXIT_FAILURE, errno, "calloc");...
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.
2016 Jun 09
2
Re: [PATCH v2] rescue: add --autosysroot option RHBZ#1183493
...est_filesystems (); > - return; > + return NULL; 'cmds' is leaked here. > } > > printf (_("This disk contains one or more operating systems. You can use these mount\n" > @@ -436,10 +526,16 @@ do_suggestion (struct drv *drvs) > qsort (mps, guestfs_int_count_strings (mps) / 2, 2 * sizeof (char *), > compare_keys_len); > > - for (j = 0; mps[j] != NULL; j += 2) > - printf ("mount %s /sysroot%s\n", mps[j+1], mps[j]); > + /* First we save commands to mount system root. */ > + for (j = 0; mps[j] != NULL; j...
2020 Mar 12
8
[PATCH libguestfs 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
https://bugzilla.redhat.com/show_bug.cgi?id=1811539 Commands including virt-diff which read extended attributes will sometimes fail on NTFS filesystems that are using system compressed. The reason is complex, see comment 5 of the bug linked above. This patch filters out the troublesome xattr. For justification, see the comment I added in patch 3. Patch 1 & 2 are refactoring. I was on the
2016 Jun 16
0
Re: [PATCH v2] rescue: add --autosysroot option RHBZ#1183493
...; >> + return NULL; > 'cmds' is leaked here. > >> } >> >> printf (_("This disk contains one or more operating systems. You can use these mount\n" >> @@ -436,10 +526,16 @@ do_suggestion (struct drv *drvs) >> qsort (mps, guestfs_int_count_strings (mps) / 2, 2 * sizeof (char *), >> compare_keys_len); >> >> - for (j = 0; mps[j] != NULL; j += 2) >> - printf ("mount %s /sysroot%s\n", mps[j+1], mps[j]); >> + /* First we save commands to mount system root. */ >> + for...