search for: analyze_line

Displaying 20 results from an estimated 29 matches for "analyze_line".

2015 Jun 23
1
[PATCH] Modify the function: analyze_line, make it more flexible
...sertions(+), 7 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 8b5779a..afbd6e6 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -853,11 +853,10 @@ do_btrfs_fsck (const char *device, int64_t superblock, int repair) * returns the next position following \n. */ static char * -analyze_line (char *line, char **key, char **value) +analyze_line (char *line, char **key, char **value, char delimiter) { char *p = line; char *next = NULL; - char delimiter = ':'; char *del_pos = NULL; if (!line || *line == '\0') { @@ -964,7 +963,7 @@ do_btrfs_subvolume_show (c...
2015 Jun 17
3
[PATCH v2 1/2] Modify public function: analyze_line, make it more flexible
...sertions(+), 7 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 39392f7..caa28ca 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -853,11 +853,10 @@ do_btrfs_fsck (const char *device, int64_t superblock, int repair) * returns the next position following \n. */ static char * -analyze_line (char *line, char **key, char **value) +analyze_line (char *line, char **key, char **value, char delimiter) { char *p = line; char *next = NULL; - char delimiter = ':'; char *del_pos = NULL; if (!line || *line == '\0') { @@ -964,7 +963,7 @@ do_btrfs_subvolume_show (c...
2015 Jun 16
2
[PATCH] New API: btrfs_device_stats
Also modified a public function: analyze_line, make it more flexible Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> --- daemon/btrfs.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++----- generator/actions.ml | 12 ++++++++ 2 files changed, 88 insertions(+), 7 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c in...
2015 Jun 17
0
Re: [PATCH v2 1/2] Modify public function: analyze_line, make it more flexible
...a/daemon/btrfs.c b/daemon/btrfs.c > index 39392f7..caa28ca 100644 > --- a/daemon/btrfs.c > +++ b/daemon/btrfs.c > @@ -853,11 +853,10 @@ do_btrfs_fsck (const char *device, int64_t superblock, int repair) > * returns the next position following \n. > */ > static char * > -analyze_line (char *line, char **key, char **value) > +analyze_line (char *line, char **key, char **value, char delimiter) > { > char *p = line; > char *next = NULL; > - char delimiter = ':'; > char *del_pos = NULL; > > if (!line || *line == '\0') { > @...
2015 Jun 19
2
[PATCH v2 1/2] Modify the function: analyze_line, make it more flexible
...sertions(+), 7 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 39392f7..caa28ca 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -853,11 +853,10 @@ do_btrfs_fsck (const char *device, int64_t superblock, int repair) * returns the next position following \n. */ static char * -analyze_line (char *line, char **key, char **value) +analyze_line (char *line, char **key, char **value, char delimiter) { char *p = line; char *next = NULL; - char delimiter = ':'; char *del_pos = NULL; if (!line || *line == '\0') { @@ -964,7 +963,7 @@ do_btrfs_subvolume_show (c...
2015 Jul 13
1
[PATCH] daemon: add a space after func name to fit code-style
...tems' UUID cannot be changed"); r = commandr (NULL, &err, str_btrfstune, "-f", "-u", device, NULL); if (r == -1) { @@ -1063,7 +1063,7 @@ do_btrfs_subvolume_show (const char *subvolume) * snapshots/test3 * */ - p = analyze_line(out, &key, &value, ':'); + p = analyze_line (out, &key, &value, ':'); if (!p) { reply_with_error ("truncated output: %s", out); return NULL; @@ -1083,7 +1083,7 @@ do_btrfs_subvolume_show (const char *subvolume) } /* Read the lines and...
2015 Jun 16
0
Re: [PATCH] New API: btrfs_device_stats
On Tuesday 16 June 2015 17:10:09 Cao jin wrote: > Also modified a public function: analyze_line, make it more flexible The addition of the parameter to analyze_line should be in an own patch. Can you please decouple it? > Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> > --- > daemon/btrfs.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++----- > generator/ac...
2015 Jun 19
3
[PATCH v3 1/2] Modify the function: analyze_line, make it more flexible
...sertions(+), 7 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 39392f7..caa28ca 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -853,11 +853,10 @@ do_btrfs_fsck (const char *device, int64_t superblock, int repair) * returns the next position following \n. */ static char * -analyze_line (char *line, char **key, char **value) +analyze_line (char *line, char **key, char **value, char delimiter) { char *p = line; char *next = NULL; - char delimiter = ':'; char *del_pos = NULL; if (!line || *line == '\0') { @@ -964,7 +963,7 @@ do_btrfs_subvolume_show (c...
2015 Jun 17
2
Re: [PATCH] New API: btrfs_device_stats
Hi, 在 2015年06月16日 20:56, Pino Toscano 写道: > On Tuesday 16 June 2015 17:10:09 Cao jin wrote: >> Also modified a public function: analyze_line, make it more flexible > > The addition of the parameter to analyze_line should be in an own > patch. Can you please decouple it? > OK >> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> >> --- >> daemon/btrfs.c | 83 +++++++++++++++++++++++++++++++++++...
2014 Dec 05
1
Re: [PATCH 2/8] New API: btrfs_subvolume_show
...> > GUESTFSD_EXT_CMD(str_btrfs, btrfs); > GUESTFSD_EXT_CMD(str_btrfstune, btrfstune); > @@ -810,3 +812,186 @@ do_btrfs_fsck (const char *device, int64_t superblock, int repair) > > return 0; > } Ugh. 'btrfs' should have more easily parsable output. > +/* analyze_line: analyze one line contains key:value pair. > + * returns the next position following \n. > + */ > +static char *analyze_line (char *line, char **key, char **value) Can you put the function name on a new line, so: static char * analyze_line (char *line, char **key, char **value) The reas...
2014 Dec 02
0
[PATCH 2/8] New API: btrfs_subvolume_show
...uot; #include "optgroups.h" #include "xstrtol.h" +#include "c-ctype.h" GUESTFSD_EXT_CMD(str_btrfs, btrfs); GUESTFSD_EXT_CMD(str_btrfstune, btrfstune); @@ -810,3 +812,186 @@ do_btrfs_fsck (const char *device, int64_t superblock, int repair) return 0; } + +/* analyze_line: analyze one line contains key:value pair. + * returns the next position following \n. + */ +static char *analyze_line (char *line, char **key, char **value) +{ + char *p = line; + char *next = NULL; + char delimiter = ':'; + char *del_pos = NULL; + + if (!line || *line == '\0'...
2014 Nov 26
7
[PATCH v2 0/5] btrfs support part1: subvolume commands
..._subvolume_show. Other parts will follow. Regards, Hu changes: v2: - add 'once_had_no_optargs = true' for btrfs_subvolume_snapshot and btrfs_subvolume_create - improved documents for btrfs_subvolume_snapshot and btrfs_subvolume_create - coding style change (patch 5) - add analyze_line (patch 5) - rebase Hu Tao (5): btrfs: add optional parameter `ro' to btrfs_subvolume_snapshot btrfs: add optional parameter `qgroupid' to btrfs_subvolume_snapshot btrfs: add optional parameter `qgroupid' to btrfs_subvolume_create New API: btrfs_subvolume_get_default New AP...
2015 Oct 20
0
Re: [PATCH 1/2] New API: vfs_min_size
...olume_size_pattern), >> + "%" SCNd64, &volume_size) != 1) { >> + reply_with_error("Cannot parse volume size"); >> + return -1; >> + } > It sounds like these scans of the lines could be done using the > analyze_line helper in btrfs.c (which would need to be moved as common > code in guestfd.c). This way, the parsing of numbers could use > xstrtoul/xstrtoull (see btrfs.c:do_btrfs_subvolume_list) instead of > sscanf. This is the only place where it could be used for now. Does it worth moving the code?...
2015 Oct 19
5
Re: [PATCH 1/2] New API: vfs_min_size
...if (sscanf (p + strlen(volume_size_pattern), > + "%" SCNd64, &volume_size) != 1) { > + reply_with_error("Cannot parse volume size"); > + return -1; > + } It sounds like these scans of the lines could be done using the analyze_line helper in btrfs.c (which would need to be moved as common code in guestfd.c). This way, the parsing of numbers could use xstrtoul/xstrtoull (see btrfs.c:do_btrfs_subvolume_list) instead of sscanf. > + } > + } > + if (is_full) { > + /* Ceil to cluster size */ > +...
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 19
0
[PATCH v2 2/2] New API: btrfs_device_stats
...0 + * [/dev/sdb].write_io_errs 0 + * [/dev/sdb].read_io_errs 0 + * [/dev/sdb].flush_io_errs 0 + * [/dev/sdb].corruption_errs 0 + * [/dev/sdb].generation_errs 0 + * [/dev/sdc]... + * ... + */ + + /* Read the lines and split into "key: value". */ + p = analyze_line(out, &key, &value, ' '); + while (key) { + if (add_string (&ret, key) == -1) + goto error; + + if (add_string (&ret, value) == -1) + goto error; + + p = analyze_line(p, &key, &value, ' '); + } + + if (end_stringsbuf (&ret) == -1) +...
2015 Jun 19
0
[PATCH v3 2/2] New API: btrfs_device_stats
...0 + * [/dev/sdb].write_io_errs 0 + * [/dev/sdb].read_io_errs 0 + * [/dev/sdb].flush_io_errs 0 + * [/dev/sdb].corruption_errs 0 + * [/dev/sdb].generation_errs 0 + * [/dev/sdc]... + * ... + */ + + /* Read the lines and split into "key: value". */ + p = analyze_line(out, &key, &value, ' '); + while (key) { + if (add_string (&ret, key) == -1) + goto error; + + if (add_string (&ret, value) == -1) + goto error; + + p = analyze_line(p, &key, &value, ' '); + } + + if (end_stringsbuf (&ret) == -1) +...
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):
2014 Nov 24
1
Re: [PATCH 6/6] New API: btrfs_subvolume_show
...d == '\n') { > > > + *pend = '\0'; > > > + pend++; > > > + } > > > > I see this code repeated already; I think it would be better to > > create> > > a small helper function like: > > char *analyze_line (char *p, char **field, char **value) > > > > which would > > - destructively update p (setting null bytes, just like it is done now) > > - return in field the start of the field text > > - return in value, if present, the start of the value (after the colon) > &gt...