Displaying 20 results from an estimated 20 matches for "guestfs_int_btrfsqgroup_list_v".
Did you mean:
guestfs_int_btrfsqgroup_list_val
2015 Jun 17
1
Re: [PATCH v4 1/3] do_btrfs_qgroup_show: fix a bad return value
...alloc");
> - goto error;
> + return NULL;
> }
>
> ret->guestfs_int_btrfsqgroup_list_len = nr_qgroups;
> @@ -1293,38 +1295,32 @@ do_btrfs_qgroup_show (const char *path)
> calloc (nr_qgroups, sizeof (struct guestfs_int_btrfsqgroup));
> if (ret->guestfs_int_btrfsqgroup_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.
> for (i = 0; i < nr_qgrou...
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
0
[PATCH v4 1/3] do_btrfs_qgroup_show: fix a bad return value
...(!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 (const char *path)
calloc (nr_qgroups, sizeof (struct guestfs_int_btrfsqgroup));
if (ret->guestfs_int_btrfsqgroup_list_val == NULL) {
reply_with_perror ("malloc");
- goto error;
+ free (ret);
+ return NULL;
}
for (i = 0; i < nr_qgroups; ++i) {
char *line = lines[i + 2];
struct guestfs_int_btrfsqgroup *this =
&ret->guestfs_int_btrfsqgroup_list_val[i];
- ui...
2015 Jun 17
2
[PATCH] btrfs: keep calloc and its error message match
...umes, 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 (const char *path)
ret->guestfs_int_btrfsqgroup_list_val =
calloc (nr_qgroups, sizeof (struct guestfs_int_btrfsqgroup));
if (ret->guestfs_int_btrfsqgroup_list_val == NULL) {
- reply_with_perror ("malloc");
+ reply_with_perror ("calloc");
goto error;
}
--
2.1.0
2015 Jun 18
2
[PATCH v5 1/2] do_btrfs_qgroup_show: fix a bad return value
...eply_with_perror ("malloc");
- goto error;
+ return NULL;
}
ret->guestfs_int_btrfsqgroup_list_len = nr_qgroups;
@@ -1300,31 +1302,23 @@ do_btrfs_qgroup_show (const char *path)
char *line = lines[i + 2];
struct guestfs_int_btrfsqgroup *this =
&ret->guestfs_int_btrfsqgroup_list_val[i];
- uint64_t dummy1, dummy2;
- char *p;
- if (sscanf (line, "%" SCNu64 "/%" SCNu64 " %" SCNu64 " %" SCNu64,
- &dummy1, &dummy2, &this->btrfsqgroup_rfer,
- &this->btrfsqgroup_excl) != 4) {
+...
2014 Dec 05
0
[PATCH 09/11] New API: btrfs_qgroup_show
...----
+ */
+ 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;
+ }
+
+ ret->guestfs_int_btrfsqgroup_list_len = nr_qgroups;
+ ret->guestfs_int_btrfsqgroup_list_val =
+ calloc (nr_qgroups, sizeof (struct guestfs_int_btrfsqgroup));
+ if (ret->guestfs_int_btrfsqgroup_list_val == NULL) {
+ reply_with_perror ("malloc");
+ goto error;
+ }
+
+ for (i = 0; i < nr_qgroups; ++i) {
+ char *line = lines[i + 2];
+ struct guestfs_int_btr...
2015 Jun 17
0
Re: [PATCH] btrfs: keep calloc and its error message match
...bvolume));
> 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 (const char *path)
> ret->guestfs_int_btrfsqgroup_list_val =
> calloc (nr_qgroups, sizeof (struct guestfs_int_btrfsqgroup));
> if (ret->guestfs_int_btrfsqgroup_list_val == NULL) {
> - reply_with_perror ("malloc");
> + reply_with_perror ("calloc");
> goto error;
> }
LGTM, so pushed with the a...
2015 Jun 23
1
[PATCH] btrfs: remove redundant whitespace
...rfssubvolume_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_btrfsqgroup_list_val[i];
uint64_t dummy1, dummy2;
char *p;
--
2.1.0
2015 Jun 18
1
Re: [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value
...the "error:" label you keep
> > the "if (ret)" condition.
> >
>
> If we succeeded at malloc(3) but failed at calloc(3),
> we will goto error.
>
> At this time we've got a space with uninitialized data because of malloc(3),
> but no space for guestfs_int_btrfsqgroup_list_val.
> When processing in label error, we could not know:
> ret->guestfs_int_btrfssubvolume_list_val[i].btrfssubvolume_path
> is a valid address.
>
> 1) One solution is use calloc to replace the first malloc.
> Then:
> if (ret-> guestfs_int_btrfssubvolume_list_val)
>...
2015 Jun 17
2
Re: [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value
On Wednesday 17 June 2015 16:19:32 Chen Hanxiao wrote:
> don't return a value which is to be freed.
>
> v4: use strndup
> v3: v3: fix test case failure
> Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
> ---
> daemon/btrfs.c | 26 +++++++++++++++++---------
> 1 file changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/daemon/btrfs.c
2014 Dec 02
21
[PATCH 0/8] btrfs support part2: qgroup commands
Hi,
This series adds support to btrfs qgroup related commands, inclduing
quota commands, and two leftover of subvolume commands.
Regards,
Hu
Hu Tao (8):
New API: btrfs_subvolume_get_default
New API: btrfs_subvolume_show
New API: btrfs_quota_enable
New API: btrfs_quota_disable
New API: btrfs_quota_rescan
New API: btrfs_qgroup_limit
New API: btrfs_qgroup_create
New API:
2015 Jun 12
1
[PATCH] btrfs: use CLEANUP_FREE_STRING_LIST for list free
...ar **lines;
path_buf = sysroot_path (path);
if (path_buf == NULL) {
@@ -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_st...
2015 Jun 12
1
[PATCH v2] btrfs: use CLEANUP_FREE_STRING_LIST for list free
...ar **lines;
path_buf = sysroot_path (path);
if (path_buf == NULL) {
@@ -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;...
2015 Jun 15
0
[PATCH v3 1/3] do_btrfs_qgroup_show: fix a bad return value
...}
*p = '\0';
- this->btrfsqgroup_id = line;
+ this->btrfsqgroup_id = strdup (line);
+ if (this->btrfsqgroup_id == NULL)
+ goto error;
}
- free (lines);
return ret;
error:
- free_stringslen (lines, nr_qgroups + 2);
if (ret)
free (ret->guestfs_int_btrfsqgroup_list_val);
free (ret);
--
2.1.0
2015 Jun 18
0
Re: [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value
...#39;t need the change here, if later in the "error:" label you keep
> the "if (ret)" condition.
>
If we succeeded at malloc(3) but failed at calloc(3),
we will goto error.
At this time we've got a space with uninitialized data because of malloc(3),
but no space for guestfs_int_btrfsqgroup_list_val.
When processing in label error, we could not know:
ret->guestfs_int_btrfssubvolume_list_val[i].btrfssubvolume_path
is a valid address.
1) One solution is use calloc to replace the first malloc.
Then:
if (ret-> guestfs_int_btrfssubvolume_list_val)
for (...)
It costs more codes.
2...
2014 Dec 12
15
[PATCH v3 00/11] btrfs support part2: qgroup/quota commands
Hi,
This is v3 series to add support to btrfs qgroup related commands, inclduing
quota commands, and two leftover of subvolume commands.
Regards,
Hu
changes:
v3:
- don't intialize fs_buf (patch 1)
- check the return value of sysroot_path (patch 1)
- check fs_buf rather than fs (patch 1)
- fprintf (stderr,...) -> reply_with_error()
v2:
- add tests for new APIs
- combine
2014 Dec 11
14
[PATCH v2 00/11] btrfs support part2: qgroup/quota commands
Hi,
This is v2 series to add support to btrfs qgroup related commands, inclduing
quota commands, and two leftover of subvolume commands.
Regards,
Hu
changes:
v2:
- add tests for new APIs
- combine btrfs_quota_enable and btrfs_quota_disable
- following APIs changed to operate on Mountable_or_Path:
btrfs_subvolume_get_default, btrfs_quota_enable, btrfs_quota_rescan.
Hu Tao (11):
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.
...-1201,7 +1201,7 @@ do_btrfs_quota_rescan (const mountable_t *fs)
goto error;
}
-error:
+ error:
if (fs_buf && umount (fs_buf, fs) != 0)
return -1;
return r;
@@ -1412,7 +1412,7 @@ do_btrfs_qgroup_show (const char *path)
return ret;
-error:
+ error:
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...
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