search for: count_strings

Displaying 20 results from an estimated 96 matches for "count_strings".

2017 Jun 19
0
[PATCH v7 13/13] daemon: Link guestfsd with libutils.
...FLAGS) \ diff --git a/daemon/augeas.c b/daemon/augeas.c index 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...
2010 Jun 02
0
[PATCH] daemon: count_strings function returns size_t
The return value from count_strings can only ever be >= 0, so it should be a size_t not an int. This is in preparation for fixing 598309, but I'm still testing that (rather large) patch. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. T...
2018 May 04
1
[PATCH] common/qemuopts: ensure arg lists are never empty
...,15 @@ qemuopts_append_arg_list_format (struct qemuopts *qopts, int qemuopts_end_arg_list (struct qemuopts *qopts) { - /* Nothing to do, the list is already well-formed. */ + struct qopt *qopt; + size_t len; + + qopt = last_option (qopts); + assert (qopt->type == QOPT_ARG_LIST); + len = count_strings (qopt->values); + if (len == 0) + return -1; + return 0; } @@ -816,7 +824,9 @@ qemuopts_to_argv (struct qemuopts *qopts) case QOPT_ARG_LIST: /* We only have to do comma-quoting here. */ values = qopts->options[i].values; - len = count_strings (values) - 1 /*...
2015 Jun 17
4
[PATCH 1/4] daemon: introduce free_stringsbuf
...@@ extern int add_string (struct stringsbuf *sb, const char *str); extern int add_sprintf (struct stringsbuf *sb, const char *fs, ...) __attribute__((format (printf,2,3))); extern int end_stringsbuf (struct stringsbuf *sb); +extern void free_stringsbuf (struct stringsbuf *sb); extern size_t count_strings (char *const *argv); extern void sort_strings (char **argv, size_t len); diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index c912ee3..453dee1 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -587,6 +587,13 @@ end_stringsbuf (struct stringsbuf *sb) return add_string_nodup (sb, NULL...
2009 Aug 17
13
total warning-removal for daemon/
The warnings in daemon were aggravating and risky for development (too easy to miss new ones) so I spent some time last week and today working on removing them. The first patch gets us down to almost no warnings with the original -Wall setting. That was by far the hardest part. Once I'd done that, I enabled nearly all of gcc's warnings via gnulib's warnings and manywarnings modules
2013 Jan 24
5
[PATCH] btrfs: Fix btrfs_subvolume_list on F18
...t;" is the subvolume path, relative to the top of the filesystem. + * + * Note that the order that each of the above is fixed, but different versions + * of btrfs may display different sets of data. Specifically, older versions + * of btrfs do not display gen. */ nr_subvolumes = count_strings (lines); @@ -384,33 +390,64 @@ do_btrfs_subvolume_list (const char *fs) return NULL; } + const char *errptr; + int erroffset; + pcre *re = pcre_compile ("ID\\s+(\\d+).*\\s" + "top level\\s+(\\d+).*\\s" + "pa...
2012 Mar 13
2
[PATCH 0/2] 'int' to 'size_t' changes
These two patches are probably not completely independent, but separating them is a lot of work. With *both* patches applied, all the tests and extra-tests pass. That's no guarantee however that there isn't a mistake, so I don't think this patch is a candidate for the 1.16 branch, until it's had a lot more testing in development. Rich.
2015 Jun 17
1
Re: [PATCH v4 1/3] do_btrfs_qgroup_show: fix a bad return value
...show' is like: > + * > + * qgroupid rfer excl > + * -------- ---- ---- > + * 0/5 9249849344 9249849344 > * > - * qgroupid rfer excl > - * -------- ---- ---- > */ > size_t nr_qgroups = count_strings (lines) - 2; > guestfs_int_btrfsqgroup_list *ret = NULL; > ret = malloc (sizeof *ret); > if (!ret) { > reply_with_perror ("malloc"); > - goto error; > + return NULL; > } > > ret->guestfs_int_btrfsqgroup_list_len = nr_qgroups; >...
2015 Mar 03
4
[PATCH 0/2] btrfs: add support to btrfs-image
This series adds new APIs to support btrfstune. Chen Hanxiao (2): New API: btrfs-image New API: btrfs_image_restore daemon/btrfs.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ generator/actions.ml | 45 +++++++++++++++++++++++++++ src/MAX_PROC_NR | 2 +- 3 files changed, 133 insertions(+), 1 deletion(-) -- 2.1.0
2012 Jan 31
2
[PATCH 1/2] examples: code cleanups
...-int +int main (int argc, char *argv[]) { guestfs_h *g; diff --git a/examples/inspect_vm.c b/examples/inspect_vm.c index 6c45aac..5a61904 100644 --- a/examples/inspect_vm.c +++ b/examples/inspect_vm.c @@ -21,7 +21,7 @@ count_strings (char *const *argv) return c; } -int +int main (int argc, char *argv[]) { guestfs_h *g; -- 1.7.9
2012 Mar 09
1
[PATCH 1/2] Close all file descriptors in the recovery process.
From: "Richard W.M. Jones" <rjones at redhat.com> If the parent process uses a pipe (or any fd, but pipes are a particular problem), then the recovery process would hold open the file descriptor(s) of the pipe, meaning that it could not be fully closed in the parent. Because the recovery process doesn't use exec(2), this wasn't avoidable even using FD_CLOEXEC. Avoid this
2011 Nov 11
3
[PATCH v2] Add mdadm-create, list-md-devices APIs.
This adds the mdadm-create API for creating RAID devices, and includes various fixes for the other two patches. Rich.
2015 Jun 17
6
[PATCH v4 0/3] btrfs: use CLEANUP_FREE_STRING_LIST for list free
As Pino's comment, we should take advantage of macro CLEANUP_FREE_STRING_LIST v4: remove some redundant strdup v3: fix test case failure v2: properly initialize lines Chen Hanxiao (3): do_btrfs_qgroup_show: fix a bad return value do_btrfs_subvolume_list: fix a bad return value btrfs: use CLEANUP_FREE_STRING_LIST for list free daemon/btrfs.c | 70
2012 Aug 06
1
[PATCH V2] virt-diff: add new virt-diff tool
...++i) { + if (c_isalnum (device[i])) { + *mapname++ = device[i]; + len--; + } + } + + *mapname = '\0'; +} + +static void +free_strings (char **strings) +{ + size_t i; + + for (i = 0; strings[i] != NULL; ++i) + free (strings[i]); + free (strings); +} + +static size_t +count_strings (char **strings) +{ + size_t i; + + for (i = 0; strings[i] != NULL; ++i) + ; + return i; +} + +/* Simple implementation of decryption: look for any crypto_LUKS + * partitions and decrypt them, then rescan for VGs. This only works + * for Fedora whole-disk encryption. WIP to make this work f...
2015 Jun 16
1
[PATCH] btrfs: use calloc instead of malloc+memset
...eases the code. --- daemon/btrfs.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index f02acb1..7b14bac 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1723,12 +1723,11 @@ do_btrfs_balance_status (const char *path) nlines = count_strings (lines); - ret = malloc(sizeof *ret); + ret = calloc (1, sizeof *ret); if (ret == NULL) { - reply_with_perror ("malloc"); + reply_with_perror ("calloc"); goto error; } - memset (ret, 0, sizeof(*ret)); /* Output of `btrfs balance status' is like:...
2015 Jun 17
0
[PATCH v4 1/3] do_btrfs_qgroup_show: fix a bad return value
...e 0 and 1 are: + /* Output of `btrfs qgroup show' is like: + * + * qgroupid rfer excl + * -------- ---- ---- + * 0/5 9249849344 9249849344 * - * qgroupid rfer excl - * -------- ---- ---- */ size_t nr_qgroups = count_strings (lines) - 2; guestfs_int_btrfsqgroup_list *ret = NULL; ret = malloc (sizeof *ret); if (!ret) { reply_with_perror ("malloc"); - goto error; + return NULL; } ret->guestfs_int_btrfsqgroup_list_len = nr_qgroups; @@ -1293,38 +1295,32 @@ do_btrfs_qgroup_show (cons...
2015 Mar 03
0
[PATCH 2/2] New API: btrfs_image_restore
...emon/btrfs.c b/daemon/btrfs.c index be648bc..e036880 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -2054,3 +2054,41 @@ do_btrfs_image (char *const *sources, const char *image, return 0; } + +int +do_btrfs_image_restore (const char *image, char *const *sources) +{ + size_t nr_sources = count_strings (sources); + const size_t MAX_ARGS = 64 + nr_sources; + const char *argv[MAX_ARGS]; + size_t i = 0, j; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + if (nr_sources == 0) { + reply_with_error ("list of sources must be non-empty"); + return...
2015 Mar 03
0
[PATCH 1/2] New API: btrfs-image
...image, btrfs-image); int optgroup_btrfs_available (void) @@ -2005,3 +2006,51 @@ do_btrfstune_enable_skinny_metadata_extent_refs (const char *device) return 0; } + +int +do_btrfs_image (char *const *sources, const char *image, + int compresslevel, int numthreads) +{ + size_t nr_sources = count_strings (sources); + const size_t MAX_ARGS = 64 + nr_sources; + const char *argv[MAX_ARGS]; + size_t i = 0, j; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + char compresslevel_s[64]; + char numthreads_s[64]; + int r; + + if (nr_sources == 0) { + reply_with_error ("l...
2017 Apr 25
0
[PATCH] daemon: Use CLEANUP_* functions to avoid an explicit free in stub functions.
...((xdrproc_t) &xdr_guestfs_%s_ret, (char *) &ret);\n" - name; - pr " free (r);\n" + name | RStringList n | RHashtable n -> pr " struct guestfs_%s_ret ret;\n" name; pr " ret.%s.%s_len = count_strings (r);\n" n n; pr " ret.%s.%s_val = r;\n" n n; pr " reply ((xdrproc_t) &xdr_guestfs_%s_ret, (char *) &ret);\n" - name; - pr " free_strings (r);\n" + name | RStruct (n, _) ->...
2015 Feb 13
3
[PATCH v4 0/2] add btrfs_balance_status and btrfs_scrub_status
v4: - add reply_with_error when nlines < 1 - remove `i == X' tests. v3: - rebase on upstream - fix some comments v2: - add check for the length of lines[] - the code parsing 'btrfs scrub -R status' output is changed into a loop Hu Tao (2): New API: btrfs_balance_status New API: btfs_scrub_status daemon/btrfs.c | 268