search for: fs_buf

Displaying 20 results from an estimated 50 matches for "fs_buf".

2014 Dec 11
1
Re: [PATCH v2 01/11] daemon: btrfs: add helper functions mount and umount
...n/btrfs.c > index 754fdcd..2e9859d 100644 > --- a/daemon/btrfs.c > +++ b/daemon/btrfs.c > @@ -326,6 +326,56 @@ do_btrfs_subvolume_create (const char *dest, const char *qgroupid) > return 0; > } > > +static char > +*mount (const mountable_t *fs) > +{ > + char *fs_buf = NULL; You shouldn't initialize fs_buf to NULL here, since it prevents the compiler from detecting uninitialized use of fs_buf. The reason it was initialized to NULL in the previous code was because it was a CLEANUP_FREE function (and those have to be initialized almost always). You have co...
2014 Dec 12
0
[PATCH v3 01/11] daemon: btrfs: add helper functions mount and umount
...), 48 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 754fdcd..514ba37 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -326,6 +326,58 @@ do_btrfs_subvolume_create (const char *dest, const char *qgroupid) return 0; } +static char +*mount (const mountable_t *fs) +{ + char *fs_buf; + + if (fs->type == MOUNTABLE_PATH) { + fs_buf = sysroot_path (fs->device); + if (fs_buf == NULL) + reply_with_perror ("malloc"); + } else { + fs_buf = strdup ("/tmp/btrfs.XXXXXX"); + if (fs_buf == NULL) { + reply_with_perror ("strdup");...
2014 Dec 11
0
[PATCH v2 01/11] daemon: btrfs: add helper functions mount and umount
...), 48 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 754fdcd..2e9859d 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -326,6 +326,56 @@ do_btrfs_subvolume_create (const char *dest, const char *qgroupid) return 0; } +static char +*mount (const mountable_t *fs) +{ + char *fs_buf = NULL; + + if (fs->type == MOUNTABLE_PATH) { + return sysroot_path (fs->device); + } else { + fs_buf = strdup ("/tmp/btrfs.XXXXXX"); + if (fs_buf == NULL) { + fprintf (stderr, "strdup\n"); + return NULL; + } + + if (mkdtemp (fs_buf) == NULL) { +...
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):
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 btrfs_quota_enable and btrfs_quota_disable - following APIs changed to operate on Mountable_or_P...
2014 Dec 11
0
[PATCH v2 02/11] New API: btrfs_subvolume_get_default
...44 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -553,6 +553,45 @@ do_btrfs_subvolume_set_default (int64_t id, const char *fs) return 0; } +int64_t +do_btrfs_subvolume_get_default (const mountable_t *fs) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + char *fs_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + int64_t ret = -1; + + fs_buf = mount (fs); + if (fs_buf == NULL) + goto error; + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "subvolume"); + ADD_ARG (argv, i, "get-default");...
2013 Jan 24
5
[PATCH] btrfs: Fix btrfs_subvolume_list on F18
...100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -21,6 +21,7 @@ #include <stdio.h> #include <stdlib.h> #include <inttypes.h> +#include <pcre.h> #include <string.h> #include <unistd.h> @@ -326,7 +327,7 @@ do_btrfs_subvolume_list (const char *fs) char *fs_buf; const char *argv[MAX_ARGS]; size_t i = 0; - char *out, *err, **lines, *pos; + char *out, *err, **lines; size_t nr_subvolumes; int r; @@ -358,13 +359,18 @@ do_btrfs_subvolume_list (const char *fs) /* Output is: * - * ID 256 top level 5 path test1 - * ID 257 top level 5...
2015 Feb 21
5
[PATCH v2 0/4] btrfs: add support to btrfs inspect-internal
This series adds new APIs to support btrfs inspect-internal. v2: - use full name of btrfs command as inspect-internal Hu Tao (4): New API: btrfs_inspect_internal_rootid New API: btrfs_inspect_internal_subvolid_resolve New API: btrfs_inspect_internal_inode_resolve New API: btrfs_inspect_internal_logical_resolve daemon/btrfs.c | 161
2014 Nov 21
2
Re: [PATCH 5/6] New API: btrfs_subvolume_get_default
...fs.c > @@ -549,6 +549,44 @@ do_btrfs_subvolume_set_default (int64_t id, const char *fs) > } > > int > +do_btrfs_subvolume_get_default (const char *fs) > +{ > + const size_t MAX_ARGS = 64; > + const char *argv[MAX_ARGS]; > + size_t i = 0; > + CLEANUP_FREE char *fs_buf = NULL; > + CLEANUP_FREE char *err = NULL; > + CLEANUP_FREE char *out = NULL; > + int r; > + > + fs_buf = sysroot_path (fs); > + if (fs_buf == NULL) { > + reply_with_perror ("malloc"); > + return -1; > + } > + > + ADD_ARG (argv, i, str_btrfs);...
2017 Jul 21
0
[PATCH v2 15/23] daemon: Reimplement ‘btrfs_subvolume_list’ and ‘btrfs_subvolume_get_default’ in OCaml.
...st, - "ID\\s+(\\d+).*\\s" - "top level\\s+(\\d+).*\\s" - "path\\s(.*)", - 0) COMPILE_REGEXP (re_btrfs_balance_status, "Balance on '.*' is (.*)", 0) int @@ -483,137 +478,6 @@ umount (char *fs_buf, const mountable_t *fs) return 0; } -guestfs_int_btrfssubvolume_list * -do_btrfs_subvolume_list (const mountable_t *fs) -{ - CLEANUP_FREE_STRING_LIST char **lines = NULL; - size_t i = 0; - const size_t MAX_ARGS = 64; - const char *argv[MAX_ARGS]; - - /* Execute 'btrfs subvolume list...
2017 Jul 14
0
[PATCH 18/27] daemon: Reimplement ‘btrfs_subvolume_list’ and ‘btrfs_subvolume_get_default’ in OCaml.
...st, - "ID\\s+(\\d+).*\\s" - "top level\\s+(\\d+).*\\s" - "path\\s(.*)", - 0) COMPILE_REGEXP (re_btrfs_balance_status, "Balance on '.*' is (.*)", 0) int @@ -483,137 +478,6 @@ umount (char *fs_buf, const mountable_t *fs) return 0; } -guestfs_int_btrfssubvolume_list * -do_btrfs_subvolume_list (const mountable_t *fs) -{ - CLEANUP_FREE_STRING_LIST char **lines = NULL; - size_t i = 0; - const size_t MAX_ARGS = 64; - const char *argv[MAX_ARGS]; - - /* Execute 'btrfs subvolume list...
2015 Jun 16
1
[PATCH] btrfs: remove unused 'out' variables
...------------------------ 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 39392f7..f02acb1 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1049,7 +1049,6 @@ do_btrfs_quota_enable (const mountable_t *fs, int enable) size_t i = 0; char *fs_buf = NULL; CLEANUP_FREE char *err = NULL; - CLEANUP_FREE char *out = NULL; int r = -1; fs_buf = mount (fs); @@ -1065,7 +1064,7 @@ do_btrfs_quota_enable (const mountable_t *fs, int enable) ADD_ARG (argv, i, fs_buf); ADD_ARG (argv, i, NULL); - r = commandv (&out, &err, argv)...
2014 Nov 21
0
[PATCH 5/6] New API: btrfs_subvolume_get_default
...179b57 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -549,6 +549,44 @@ do_btrfs_subvolume_set_default (int64_t id, const char *fs) } int +do_btrfs_subvolume_get_default (const char *fs) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *fs_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + + fs_buf = sysroot_path (fs); + if (fs_buf == NULL) { + reply_with_perror ("malloc"); + return -1; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "subvolume"); + ADD_AR...
2014 Nov 24
0
Re: [PATCH 5/6] New API: btrfs_subvolume_get_default
...set_default (int64_t id, const > char *fs) > > } > > > > int > > +do_btrfs_subvolume_get_default (const char *fs) > > +{ > > + const size_t MAX_ARGS = 64; > > + const char *argv[MAX_ARGS]; > > + size_t i = 0; > > + CLEANUP_FREE char *fs_buf = NULL; > > + CLEANUP_FREE char *err = NULL; > > + CLEANUP_FREE char *out = NULL; > > + int r; > > + > > + fs_buf = sysroot_path (fs); > > + if (fs_buf == NULL) { > > + reply_with_perror ("malloc"); > > + return -1; > > + }...
2014 Dec 02
0
[PATCH 1/8] New API: btrfs_subvolume_get_default
...n/btrfs.c +++ b/daemon/btrfs.c @@ -545,6 +545,44 @@ do_btrfs_subvolume_set_default (int64_t id, const char *fs) return 0; } +int64_t +do_btrfs_subvolume_get_default (const char *mountpoint) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *fs_buf = NULL; + CLEANUP_FREE char *err = NULL; + CLEANUP_FREE char *out = NULL; + int r; + int64_t ret; + + fs_buf = sysroot_path (mountpoint); + if (fs_buf == NULL) { + reply_with_perror ("malloc"); + return -1; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "sub...
2015 Feb 21
0
[PATCH v2 4/4] New API: btrfs_inspect_internal_logical_resolve
...49,3 +2049,44 @@ do_btrfs_inspect_internal_inode_resolve (int64_t inode, const char *fs) return out; } + +char * +do_btrfs_inspect_internal_logical_resolve (int64_t logical, const char *fs) +{ + const size_t MAX_ARGS = 64; + const char *argv[MAX_ARGS]; + size_t i = 0; + CLEANUP_FREE char *fs_buf = NULL; + CLEANUP_FREE char *err = NULL; + char *out; + size_t len; + int r; + char logical_str[32]; + + fs_buf = sysroot_path (fs); + if (fs_buf == NULL) { + reply_with_perror ("malloc"); + return NULL; + } + + ADD_ARG (argv, i, str_btrfs); + ADD_ARG (argv, i, "inspe...
2013 Feb 12
7
Remaining btrfs patches
...root This is significantly reworked from before. umount is gone as discussed, and variable motion is minimised. [PATCH 2/7] btrfs: Update btrfs_subvolume_list to take Already provisionally ACKed. Previous comment was that cleanup could be tidier. I looked into creating a new cleanup function for fs_buf, but it isn't possible (or simple, anyway) in this case for 2 reasons: 1. You'd need 2 arguments passed to the cleanup function, not one. Without fs->type you don't know whether fs_buf has been mounted or not. 2. You can't catch and report an error. [PATCH 3/7] mountable: Make...
2015 Jan 16
18
[PATCH 00/16] btrfs: add support to btrfs scrub, balance, rescue and inspect
Hi, This series adds new APIs to support btrfs scrub, balance, rescue and inspect. Some of them don't have tests because: - btrfs_scrub and btrfs_balance completes too early before we can test btrfs_scrub_cancel, btrfs_scrub_resume, btrfs_scrub_status, btrfs_balance_pause, btrfs_balance_cancel, btrfs_balance_resume and btrfs_balance_status. - can't
2014 Dec 05
2
Re: [PATCH 1/8] New API: btrfs_subvolume_get_default
On Tue, Dec 02, 2014 at 05:33:31PM +0800, Hu Tao wrote: > + ADD_ARG (argv, i, str_btrfs); > + ADD_ARG (argv, i, "subvolume"); > + ADD_ARG (argv, i, "get-default"); > + ADD_ARG (argv, i, fs_buf); > + ADD_ARG (argv, i, NULL); > + > + r = commandv (&out, &err, argv); > + if (r == -1) { > + reply_with_error ("%s: %s", mountpoint, err); > + return -1; > + } > + r = xstrtol (out + 2, NULL, 10, &ret, NULL); Unfortunately even gnulib'...
2015 Jun 12
1
[PATCH] btrfs: use CLEANUP_FREE_STRING_LIST for list free
...gned-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> --- daemon/btrfs.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 39392f7..fd93d43 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -409,7 +409,7 @@ umount (char *fs_buf, const mountable_t *fs) guestfs_int_btrfssubvolume_list * do_btrfs_subvolume_list (const mountable_t *fs) { - char **lines; + CLEANUP_FREE_STRING_LIST char **lines; size_t i = 0; const size_t MAX_ARGS = 64; const char *argv[MAX_ARGS]; @@ -534,13 +534,11 @@ do_btrfs_subvolume_list (con...