search for: guestfs_int_btrfssubvolume_list_val

Displaying 20 results from an estimated 26 matches for "guestfs_int_btrfssubvolume_list_val".

2013 Jan 24
5
[PATCH] btrfs: Fix btrfs_subvolume_list on F18
..."top level\\s+(\\d+).*\\s" + "path\\s(.*)", + 0, &errptr, &erroffset, NULL); + if (re == NULL) { + reply_with_error ("pcre_compile (%i): %s", erroffset, errptr); + free (ret->guestfs_int_btrfssubvolume_list_val); + free (ret); + free_stringslen (lines, nr_subvolumes); + return NULL; + } + for (i = 0; i < nr_subvolumes; ++i) { /* To avoid allocations, reuse the 'line' buffer to store the * path. Thus we don't need to free 'line', since it will be * free...
2015 Jun 17
2
Re: [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value
...t; - goto error; > + return NULL; > } > > ret->guestfs_int_btrfssubvolume_list_len = nr_subvolumes; > @@ -480,7 +480,8 @@ do_btrfs_subvolume_list (const mountable_t *fs) > calloc (nr_subvolumes, sizeof (struct guestfs_int_btrfssubvolume)); > if (ret->guestfs_int_btrfssubvolume_list_val == NULL) { > reply_with_perror ("malloc"); > - goto error; > + free (ret); > + return NULL; > } You don't need the change here, if later in the "error:" label you keep the "if (ret)" condition. > const char *errptr; > @@ -...
2015 Jun 18
0
Re: [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value
...return NULL; > > } > > > > ret->guestfs_int_btrfssubvolume_list_len = nr_subvolumes; > > @@ -480,7 +480,8 @@ do_btrfs_subvolume_list (const mountable_t *fs) > > calloc (nr_subvolumes, sizeof (struct guestfs_int_btrfssubvolume)); > > if (ret->guestfs_int_btrfssubvolume_list_val == NULL) { > > reply_with_perror ("malloc"); > > - goto error; > > + free (ret); > > + return NULL; > > } > > You don't need the change here, if later in the "error:" label you keep > the "if (ret)" condition...
2015 Jun 18
1
Re: [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value
...} > > > > > > ret->guestfs_int_btrfssubvolume_list_len = nr_subvolumes; > > > @@ -480,7 +480,8 @@ do_btrfs_subvolume_list (const mountable_t *fs) > > > calloc (nr_subvolumes, sizeof (struct guestfs_int_btrfssubvolume)); > > > if (ret->guestfs_int_btrfssubvolume_list_val == NULL) { > > > reply_with_perror ("malloc"); > > > - goto error; > > > + free (ret); > > > + return NULL; > > > } > > > > You don't need the change here, if later in the "error:" label you keep >...
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
2015 Jun 17
2
[PATCH] btrfs: keep calloc and its error message match
...nxiao@cn.fujitsu.com> --- daemon/btrfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 7b14bac..e8059db 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -479,7 +479,7 @@ do_btrfs_subvolume_list (const mountable_t *fs) ret->guestfs_int_btrfssubvolume_list_val = calloc (nr_subvolumes, sizeof (struct guestfs_int_btrfssubvolume)); if (ret->guestfs_int_btrfssubvolume_list_val == NULL) { - reply_with_perror ("malloc"); + reply_with_perror ("calloc"); goto error; } @@ -1292,7 +1292,7 @@ do_btrfs_qgroup_show (cons...
2015 Jun 17
0
[PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value
...ply_with_perror ("malloc"); - goto error; + return NULL; } ret->guestfs_int_btrfssubvolume_list_len = nr_subvolumes; @@ -480,7 +480,8 @@ do_btrfs_subvolume_list (const mountable_t *fs) calloc (nr_subvolumes, sizeof (struct guestfs_int_btrfssubvolume)); if (ret->guestfs_int_btrfssubvolume_list_val == NULL) { reply_with_perror ("malloc"); - goto error; + free (ret); + return NULL; } const char *errptr; @@ -530,20 +531,27 @@ do_btrfs_subvolume_list (const mountable_t *fs) #undef XSTRTOU64 - memmove (line, line + ovector[6], ovector[7] - ovector[6] +...
2015 Jun 18
2
[PATCH v5 1/2] do_btrfs_qgroup_show: fix a bad return value
We should not use temporary lines buffer as return value, for lines buffer will be freed. Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> --- v5: modify according to Pino's comments v4: take advantage of sscanf's '%m'. v3: fix test case failure daemon/btrfs.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git
2017 Jul 21
0
[PATCH v2 15/23] daemon: Reimplement ‘btrfs_subvolume_list’ and ‘btrfs_subvolume_get_default’ in OCaml.
..._int_btrfssubvolume_list *ret = NULL; - - const size_t nr_subvolumes = guestfs_int_count_strings (lines); - - ret = malloc (sizeof *ret); - if (!ret) { - reply_with_perror ("malloc"); - return NULL; - } - - ret->guestfs_int_btrfssubvolume_list_len = nr_subvolumes; - ret->guestfs_int_btrfssubvolume_list_val = - calloc (nr_subvolumes, sizeof (struct guestfs_int_btrfssubvolume)); - if (ret->guestfs_int_btrfssubvolume_list_val == NULL) { - reply_with_perror ("calloc"); - goto error; - } - - for (i = 0; i < nr_subvolumes; ++i) { - /* To avoid allocations, reuse the 'line...
2017 Jul 14
0
[PATCH 18/27] daemon: Reimplement ‘btrfs_subvolume_list’ and ‘btrfs_subvolume_get_default’ in OCaml.
..._int_btrfssubvolume_list *ret = NULL; - - const size_t nr_subvolumes = guestfs_int_count_strings (lines); - - ret = malloc (sizeof *ret); - if (!ret) { - reply_with_perror ("malloc"); - return NULL; - } - - ret->guestfs_int_btrfssubvolume_list_len = nr_subvolumes; - ret->guestfs_int_btrfssubvolume_list_val = - calloc (nr_subvolumes, sizeof (struct guestfs_int_btrfssubvolume)); - if (ret->guestfs_int_btrfssubvolume_list_val == NULL) { - reply_with_perror ("calloc"); - goto error; - } - - for (i = 0; i < nr_subvolumes; ++i) { - /* To avoid allocations, reuse the 'line...
2015 Jun 17
0
Re: [PATCH] btrfs: keep calloc and its error message match
...fs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/daemon/btrfs.c b/daemon/btrfs.c > index 7b14bac..e8059db 100644 > --- a/daemon/btrfs.c > +++ b/daemon/btrfs.c > @@ -479,7 +479,7 @@ do_btrfs_subvolume_list (const mountable_t *fs) > ret->guestfs_int_btrfssubvolume_list_val = > calloc (nr_subvolumes, sizeof (struct guestfs_int_btrfssubvolume)); > if (ret->guestfs_int_btrfssubvolume_list_val == NULL) { > - reply_with_perror ("malloc"); > + reply_with_perror ("calloc"); > goto error; > } > > @@ -1292...
2015 Jun 23
1
[PATCH] btrfs: remove redundant whitespace
...b/daemon/btrfs.c index 8b5779a..306cade 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -512,7 +512,7 @@ do_btrfs_subvolume_list (const mountable_t *fs) goto error; } - struct guestfs_int_btrfssubvolume *this = + struct guestfs_int_btrfssubvolume *this = &ret->guestfs_int_btrfssubvolume_list_val[i]; #if __WORDSIZE == 64 @@ -1298,7 +1298,7 @@ do_btrfs_qgroup_show (const char *path) for (i = 0; i < nr_qgroups; ++i) { char *line = lines[i + 2]; - struct guestfs_int_btrfsqgroup *this = + struct guestfs_int_btrfsqgroup *this = &ret->guestfs_int_btrfsqgro...
2015 Jun 12
1
[PATCH] btrfs: use CLEANUP_FREE_STRING_LIST for list free
..._t MAX_ARGS = 64; const char *argv[MAX_ARGS]; @@ -534,13 +534,11 @@ do_btrfs_subvolume_list (const mountable_t *fs) this->btrfssubvolume_path = line; } - free (lines); pcre_free (re); return ret; error: - free_stringslen (lines, nr_subvolumes); if (ret) free (ret->guestfs_int_btrfssubvolume_list_val); free (ret); if (re) pcre_free (re); @@ -1254,7 +1252,7 @@ do_btrfs_qgroup_show (const char *path) CLEANUP_FREE char *err = NULL; CLEANUP_FREE char *out = NULL; int r; - char **lines; + CLEANUP_FREE_STRING_LIST char **lines; path_buf = sysroot_path (path); if (path_buf ==...
2015 Jun 12
1
[PATCH v2] btrfs: use CLEANUP_FREE_STRING_LIST for list free
..._t MAX_ARGS = 64; const char *argv[MAX_ARGS]; @@ -534,13 +534,11 @@ do_btrfs_subvolume_list (const mountable_t *fs) this->btrfssubvolume_path = line; } - free (lines); pcre_free (re); return ret; error: - free_stringslen (lines, nr_subvolumes); if (ret) free (ret->guestfs_int_btrfssubvolume_list_val); free (ret); if (re) pcre_free (re); @@ -1253,8 +1251,8 @@ do_btrfs_qgroup_show (const char *path) CLEANUP_FREE char *path_buf = NULL; CLEANUP_FREE char *err = NULL; CLEANUP_FREE char *out = NULL; + CLEANUP_FREE_STRING_LIST char **lines = NULL; int r; - char **lines; path_...
2015 Jun 15
0
[PATCH v3 2/3] do_btrfs_subvolume_list: fix a bad return value
...; - this->btrfssubvolume_path = line; + this->btrfssubvolume_path = strdup (line); + if (this->btrfssubvolume_path == NULL) + goto error; } - free (lines); pcre_free (re); return ret; error: - free_stringslen (lines, nr_subvolumes); if (ret) free (ret->guestfs_int_btrfssubvolume_list_val); free (ret); if (re) pcre_free (re); -- 2.1.0
2015 Jun 15
7
[PATCH v3 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 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 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
2015 Oct 05
0
[PATCH 2/2] Fix whitespace.
...mand: %s", line); - goto error; - } +#undef N_MATCHES + { + unexpected_output: + reply_with_error ("unexpected output from 'btrfs subvolume list' command: %s", line); + goto error; + } struct guestfs_int_btrfssubvolume *this = &ret->guestfs_int_btrfssubvolume_list_val[i]; - #if __WORDSIZE == 64 - #define XSTRTOU64 xstrtoul - #else - #define XSTRTOU64 xstrtoull - #endif +#if __WORDSIZE == 64 +#define XSTRTOU64 xstrtoul +#else +#define XSTRTOU64 xstrtoull +#endif if (XSTRTOU64 (line + ovector[2], NULL, 10, &this-...
2017 Jun 05
19
[PATCH v3 00/19] Allow APIs to be implemented in OCaml.
v2 was here: https://www.redhat.com/archives/libguestfs/2017-June/msg00008.html This series gets as far as a working (and faster) reimplementation of ‘guestfs_list_filesystems’. I also have another patch series on top of this one which reimplements the inspection APIs inside the daemon, but that needs a bit more work still, since inspection turns out to be a very large piece of code. Rich.
2017 Jul 27
23
[PATCH v3 00/23] Reimplement many daemon APIs in OCaml.
I think this fixes everything mentioned: - Added the Optgroups module as suggested. - Remove command temporary files. - Replace command ~flags with ?fold_stdout_on_stderr. - Nest _with_mounted function. - Rebase & retest. Rich.
2017 Jul 21
27
[PATCH v2 00/23] Reimplement many daemon APIs in OCaml.
v1 was posted here: https://www.redhat.com/archives/libguestfs/2017-July/msg00098.html This series now depends on two small patches which I posted separately: https://www.redhat.com/archives/libguestfs/2017-July/msg00207.html https://www.redhat.com/archives/libguestfs/2017-July/msg00209.html v1 -> v2: - Previously changes to generator/daemon.ml were made incrementally through the patch