search for: btrfsbalance_status

Displaying 15 results from an estimated 15 matches for "btrfsbalance_status".

Did you mean: btrfs_balance_status
2015 Jul 13
1
[PATCH] daemon: add a space after func name to fit code-style
..., "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"); return NULL; @@ -1866,9 +1866,9 @@ do_btrfs_balance_status (const char *path) #undef N_MATCH if (STRE...
2017 Nov 03
1
[PATCH] daemon: btrfs: fix bad handling of a couple of errors
...ituations in btrfs_balance_status: - if the calloc for 'ret' fails, the 'goto error' would try to dereference the resulting null pointer (to free the items of the return struct); hence, just return null directly, instead of jumping to 'error' - if the strdup() for 'btrfsbalance_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_bala...
2015 Feb 11
0
[PATCH v3 1/2] New API: btrfs_balance_status
...nce on '/' is paused + * 3 out of about 8 chunks balanced (3 considered), 62% left + * + * no balance running: + * + * No Balance found on '/' + * + */ + if (nlines < 1) + return NULL; + if (strstr (lines[0], "No balance found on")) { + ret->btrfsbalance_status = strdup("none"); + if (ret->btrfsbalance_status == NULL) { + reply_with_perror ("strdup"); + return NULL; + } + return ret; + } + + re = pcre_compile ("Balance on '.*' is (.*)", 0, &errptr, &erroffset, NULL); + if (re == NULL)...
2015 Feb 13
0
[PATCH v4 1/2] New API: btrfs_balance_status
...considered), 62% left + * + * no balance running: + * + * No Balance found on '/' + * + */ + if (nlines < 1) { + reply_with_perror ("No balance status output"); + return NULL; + } + + if (strstr (lines[0], "No balance found on")) { + ret->btrfsbalance_status = strdup("none"); + if (ret->btrfsbalance_status == NULL) { + reply_with_perror ("strdup"); + return NULL; + } + return ret; + } + + re = pcre_compile ("Balance on '.*' is (.*)", 0, &errptr, &erroffset, NULL); + if (re == NULL)...
2018 Aug 06
1
[PATCH] btrfs_balance_status: delay allocation of 'ret'
...running: @@ -1711,6 +1705,12 @@ do_btrfs_balance_status (const char *path) return NULL; } + ret = calloc (1, sizeof *ret); + if (ret == NULL) { + reply_with_perror ("calloc"); + return NULL; + } + if (strstr (lines[0], "No balance found on")) { ret->btrfsbalance_status = strdup ("none"); if (ret->btrfsbalance_status == NULL) { -- 2.17.1
2015 Feb 02
0
Re: [PATCH 1/2] New API: btrfs_balance_status
...#39; > + * > + */ > + if (strstr (lines[0], "No balance found on")) { In case the output of the btrfs command changes in future, you need to check that the length of the lines[] array is >= 1 here, and >= 2 below. Otherwise this code will segfault. > + ret->btrfsbalance_status = strdup("none"); Where you call strdup, you have to check that the return value is not NULL, and if it is call reply_with_perror ("strdup"). > + return ret; > + } > + > + re = pcre_compile ("Balance on '.*' is (.*)", 0, &errptr, &err...
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
...utput"); reply_with_perror uses errno implicitly, but errno would not be set to anything interesting here. I will push these patches, with a few fixes. Thanks, Rich. > + return NULL; > + } > + > + if (strstr (lines[0], "No balance found on")) { > + ret->btrfsbalance_status = strdup("none"); > + if (ret->btrfsbalance_status == NULL) { > + reply_with_perror ("strdup"); > + return NULL; > + } > + return ret; > + } > + > + re = pcre_compile ("Balance on '.*' is (.*)", 0, &errptr, &a...
2015 Feb 02
5
[PATCH 1/2] New API: btrfs_balance_status
...t + * + * paused: + * + * Balance on '/' is paused + * 3 out of about 8 chunks balanced (3 considered), 62% left + * + * no balance running: + * + * No Balance found on '/' + * + */ + if (strstr (lines[0], "No balance found on")) { + ret->btrfsbalance_status = strdup("none"); + return ret; + } + + re = pcre_compile ("Balance on '.*' is (.*)", 0, &errptr, &erroffset, NULL); + if (re == NULL) { + reply_with_error ("pcre_compile (%i): %s", erroffset, errptr); + goto error; + } + if (pcre_exec (re...
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 ++++
2015 Feb 15
4
[PATCH v5 0/2] add btrfs_balance_status and btrfs_scrub_status
v5: - fix tests failure 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
2015 Feb 11
4
[PATCH v3 0/2] add btrfs_balance_status and btrfs_scrub_status
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 | 263 +++++++++++++++++++++++++++++++ generator/actions.ml | 26 +++
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 Oct 05
0
[PATCH 2/2] Fix whitespace.
...if (ret->guestfs_int_btrfsqgroup_list_val) { for (i = 0; i < nr_qgroups; ++i) free (ret->guestfs_int_btrfsqgroup_list_val[i].btrfsqgroup_id); @@ -1890,7 +1890,7 @@ do_btrfs_balance_status (const char *path) pcre_free (re); return ret; -error: + error: free (ret->btrfsbalance_status); free (ret); pcre_free (re); @@ -1979,49 +1979,49 @@ do_btrfs_scrub_status (const char *path) else if (STRPREFIX (lines[i], "\tscrub started at")) continue; else if (sscanf (lines[i], "\tdata_extents_scrubbed: %" SCNu64, -...
2015 Oct 05
3
[PATCH 1/2] Change 'fprintf (stdout,...)' -> printf.
Result of earlier copy and paste. --- align/scan.c | 35 ++++++++++--------- cat/cat.c | 39 +++++++++++---------- cat/filesystems.c | 69 +++++++++++++++++++------------------- cat/log.c | 35 ++++++++++--------- cat/ls.c | 61 +++++++++++++++++---------------- df/main.c | 43 ++++++++++++------------ diff/diff.c | 67