Displaying 20 results from an estimated 36 matches for "do_btrfs_balance_status".
2017 Nov 03
1
[PATCH] daemon: btrfs: fix bad handling of a couple of errors
...alance_status' fails, then the directly
return would leak 'ret'
---
daemon/btrfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index d363ada6d..26757d4fb 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1686,7 +1686,7 @@ do_btrfs_balance_status (const char *path)
ret = calloc (1, sizeof *ret);
if (ret == NULL) {
reply_with_perror ("calloc");
- goto error;
+ return NULL;
}
/* Output of `btrfs balance status' is like:
@@ -1715,7 +1715,7 @@ do_btrfs_balance_status (const char *path)
ret->btrfsba...
2018 Aug 06
1
[PATCH] btrfs_balance_status: delay allocation of 'ret'
...e as possible, so there is no risk that early
returns will 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_btrf...
2015 Jul 13
1
[PATCH] daemon: add a space after func name to fit code-style
...ADD_ARG (argv, i, "-czlib");
- else if (STREQ(compress, "lzo"))
+ else if (STREQ (compress, "lzo"))
ADD_ARG (argv, i, "-clzo");
else {
reply_with_error ("unknown compress method: %s", compress);
@@ -1845,7 +1845,7 @@ do_btrfs_balance_status (const char *path)
}
if (strstr (lines[0], "No balance found on")) {
- ret->btrfsbalance_status = strdup("none");
+ ret->btrfsbalance_status = strdup ("none");
if (ret->btrfsbalance_status == NULL) {
reply_with_perror ("strdup&qu...
2016 Feb 23
3
[PATCH 1/2] lib: Allow the COMPILE_REGEXP macro to be used everywhere.
Since the daemon links to pcre and use regular expressions, and since
the COMPILE_REGEXP macro doesn't depend on any aspects of the
library-side code (eg. the guestfs_h handle etc), we can allow the
daemon to use the COMPILE_REGEXP macro. Move the macro to
"guestfs-internal-all.h" to permit this.
---
src/guestfs-internal-all.h | 26 ++++++++++++++++++++++++++
src/guestfs-internal.h
2015 Jun 19
1
[PATCH] btrfs: fix leak in btrfs_balance_status
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
---
daemon/btrfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 050bf18..8b5779a 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1688,8 +1688,8 @@ do_btrfs_balance_status (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE char *out = NULL;
CLEANUP_FREE_STRING_LIST char **lines = NULL;
- char *out;
int r;
guestfs_int_btrfsbalance *ret;
size_t nlines;
--
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 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 12
1
[PATCH] btrfs: use CLEANUP_FREE_STRING_LIST for list free
...) {
@@ -1323,11 +1321,9 @@ do_btrfs_qgroup_show (const char *path)
this->btrfsqgroup_id = line;
}
- free (lines);
return ret;
error:
- free_stringslen (lines, nr_qgroups + 2);
if (ret)
free (ret->guestfs_int_btrfsqgroup_list_val);
free (ret);
@@ -1707,7 +1703,7 @@ do_btrfs_balance_status (const char *path)
char *out;
int r;
guestfs_int_btrfsbalance *ret;
- char **lines;
+ CLEANUP_FREE_STRING_LIST char **lines;
size_t nlines;
const char *errptr;
int erroffset;
@@ -1833,7 +1829,7 @@ do_btrfs_scrub_status (const char *path)
char *out;
int r;
guestfs_int_bt...
2015 Jun 12
1
[PATCH v2] btrfs: use CLEANUP_FREE_STRING_LIST for list free
...{
@@ -1323,11 +1321,9 @@ do_btrfs_qgroup_show (const char *path)
this->btrfsqgroup_id = line;
}
- free (lines);
return ret;
error:
- free_stringslen (lines, nr_qgroups + 2);
if (ret)
free (ret->guestfs_int_btrfsqgroup_list_val);
free (ret);
@@ -1704,10 +1700,10 @@ do_btrfs_balance_status (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE_STRING_LIST char **lines = NULL;
char *out;
int r;
guestfs_int_btrfsbalance *ret;
- char **lines;
size_t nlines;
const char *errptr;
int erroffset;
@@ -183...
2015 Jun 15
0
[PATCH v2 3/3] btrfs: use CLEANUP_FREE_STRING_LIST for list free
Signed-off-by: Chen Hanxiao <chenhanxiao@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 c1462fd..5d87f53 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1704,10 +1704,10 @@ do_btrfs_balance_status (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE_STRING_LIST char **lines = NULL;
char *out;
int r;
guestfs_int_btrfsbalance *ret;
- char **lines;
size_t nlines;
const char *errptr;
int erroffset;
@@ -183...
2015 Jun 16
1
[PATCH] btrfs: use calloc instead of malloc+memset
Small optimization, and 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));
/* O...
2015 Jun 17
0
[PATCH v4 3/3] btrfs: use CLEANUP_FREE_STRING_LIST for list free
Signed-off-by: Chen Hanxiao <chenhanxiao@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 5361984..88be9ec 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1692,10 +1692,10 @@ do_btrfs_balance_status (const char *path)
size_t i = 0;
CLEANUP_FREE char *path_buf = NULL;
CLEANUP_FREE char *err = NULL;
+ CLEANUP_FREE_STRING_LIST char **lines = NULL;
char *out;
int r;
guestfs_int_btrfsbalance *ret;
- char **lines;
size_t nlines;
const char *errptr;
int erroffset;
@@ -181...
2015 Feb 11
0
[PATCH v3 1/2] New API: btrfs_balance_status
...2 +-
8 files changed, 151 insertions(+), 1 deletion(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 5cab52a..5cebd91 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1659,3 +1659,126 @@ do_btrfs_rescue_super_recover (const char *device)
return 0;
}
+
+guestfs_int_btrfsbalance *
+do_btrfs_balance_status (const char *path)
+{
+ const size_t MAX_ARGS = 64;
+ const char *argv[MAX_ARGS];
+ size_t i = 0;
+ CLEANUP_FREE char *path_buf = NULL;
+ CLEANUP_FREE char *err = NULL;
+ char *out;
+ int r;
+ guestfs_int_btrfsbalance *ret;
+ char **lines;
+ size_t nlines;
+ const char *errptr;
+ int er...
2015 Feb 13
0
[PATCH v4 1/2] New API: btrfs_balance_status
...2 +-
8 files changed, 154 insertions(+), 1 deletion(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 5cab52a..a979327 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1659,3 +1659,129 @@ do_btrfs_rescue_super_recover (const char *device)
return 0;
}
+
+guestfs_int_btrfsbalance *
+do_btrfs_balance_status (const char *path)
+{
+ const size_t MAX_ARGS = 64;
+ const char *argv[MAX_ARGS];
+ size_t i = 0;
+ CLEANUP_FREE char *path_buf = NULL;
+ CLEANUP_FREE char *err = NULL;
+ char *out;
+ int r;
+ guestfs_int_btrfsbalance *ret;
+ char **lines;
+ size_t nlines;
+ const char *errptr;
+ int er...
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
2015 Feb 13
1
Re: [PATCH v4 1/2] New API: btrfs_balance_status
...t;
> diff --git a/daemon/btrfs.c b/daemon/btrfs.c
> index 5cab52a..a979327 100644
> --- a/daemon/btrfs.c
> +++ b/daemon/btrfs.c
> @@ -1659,3 +1659,129 @@ do_btrfs_rescue_super_recover (const char *device)
>
> return 0;
> }
> +
> +guestfs_int_btrfsbalance *
> +do_btrfs_balance_status (const char *path)
> +{
> + const size_t MAX_ARGS = 64;
> + const char *argv[MAX_ARGS];
> + size_t i = 0;
> + CLEANUP_FREE char *path_buf = NULL;
> + CLEANUP_FREE char *err = NULL;
> + char *out;
> + int r;
> + guestfs_int_btrfsbalance *ret;
> + char **lines;...
2015 Jun 11
0
Re: [PATCH] New API: btrfs_filesystem_show_all
...; +
> +error:
> + free_stringslen (lines, nlines);
As noted above, just make "lines" as CLEANUP_FREE_STRING_LIST.
Also, it seems this wrong handling of the return value of split_lines
has been done in other btrfs implementations:
- do_btrfs_subvolume_list
- do_btrfs_qgroup_show
- do_btrfs_balance_status
- do_btrfs_scrub_status
> + if (label_tmp)
> + free (label_tmp);
> + if (uuid_tmp)
> + free (uuid_tmp);
> +
> + for (i = 0; i < nr_filesystem_show; i++) {
> + struct guestfs_int_btrfsfsshow *this_new =
> + &ret->guestfs_int_btrfsfsshow_list_val[i]...
2015 Jun 11
2
[PATCH] New API: btrfs_filesystem_show_all
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
---
daemon/btrfs.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++
generator/actions.ml | 19 ++++++
generator/structs.ml | 13 ++++
src/MAX_PROC_NR | 2 +-
4 files changed, 209 insertions(+), 1 deletion(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 39392f7..09f7615 100644
--- a/daemon/btrfs.c
+++
2015 Jun 11
1
Re: [PATCH] New API: btrfs_filesystem_show_all
...(lines, nlines);
>
> As noted above, just make "lines" as CLEANUP_FREE_STRING_LIST.
>
> Also, it seems this wrong handling of the return value of split_lines
> has been done in other btrfs implementations:
> - do_btrfs_subvolume_list
> - do_btrfs_qgroup_show
> - do_btrfs_balance_status
> - do_btrfs_scrub_status
Yes, I'll send a patch to fix them later.
>
> > + if (label_tmp)
> > + free (label_tmp);
> > + if (uuid_tmp)
> > + free (uuid_tmp);
> > +
> > + for (i = 0; i < nr_filesystem_show; i++) {
> > + struct gue...
2015 Feb 03
2
[PATCH v2 0/2] add btrfs_balance_status and btrfs_scrub_status
changes in 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 | 263 +++++++++++++++++++++++++++++++
generator/actions.ml | 26 +++
generator/structs.ml | 34 ++++