search for: split_lin

Displaying 20 results from an estimated 109 matches for "split_lin".

Did you mean: split_len
2015 Jun 17
0
[PATCH 4/4] daemon: add split_lines_sb
Mold split_lines_sb from split_lines, so it returns the strings buffer with the result of the split. This way, we can have the number of lines in the array, with no need to count them again later. split_lines is rewritten to take the ownership of the result of split_lines_sb. --- daemon/daemon.h | 1 + daemo...
2015 Jun 17
4
[PATCH 1/4] daemon: introduce free_stringsbuf
Simple shortcut to easily cleanup a stringsbuf. --- daemon/daemon.h | 1 + daemon/guestfsd.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/daemon/daemon.h b/daemon/daemon.h index 53cb797..bed4dbc 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -92,6 +92,7 @@ extern int add_string (struct stringsbuf *sb, const char *str); extern int add_sprintf (struct stringsbuf *sb, const
2017 Mar 02
2
[PATCH] parted: add more udev_settle calls.
...OMMAND_FLAG_FOLD_STDOUT_ON_STDERR, str_sgdisk, device, "-i", partnum_str, NULL); @@ -674,6 +681,8 @@ sgdisk_info_extract_field (const char *device, int partnum, const char *field, return NULL; } + udev_settle (); + CLEANUP_FREE_STRING_LIST char **lines = split_lines (err); if (lines == NULL) { reply_with_error ("'%s %s -i %i' returned no output", -- 2.9.3
2012 Dec 14
1
[PATCH] daemon: Add sentinel attribute to commandf and commandrf
...er warning to be emitted if you omit the trailing NULL argument. --- daemon/daemon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/daemon.h b/daemon/daemon.h index 8f932d2..df1ba3a 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -100,9 +100,9 @@ extern char **split_lines (char *str); #define COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN 2048 extern int commandf (char **stdoutput, char **stderror, int flags, - const char *name, ...); + const char *name, ...) __attribute__((sentinel)); extern int commandrf (char **stdoutput, ch...
2016 Sep 29
4
a proposed script to help with test-suite programs that output _lots_ of FP numbers
...seems to be down over the past few minutes. Regards, Abe test-suite/tools/count_and_sum_floats.py ---------------------------------------- #!/usr/bin/python import math, sys try_for_more = True count = 0 total = 0.0 while try_for_more: line = sys.stdin.readline() if line: split_line = line.split() # handles ASCII horizontal tabs as well as ASCII horizontal spaces as_floats = [float(x) for x in split_line] for the_float in as_floats: if not ( math.isinf(the_float) or math.isnan(the_float) ): count = count + 1 total = total + the_float else...
2015 Oct 14
1
[PATCH v2] New API: resize2fs_P
...size_t i; + char *p; + int64_t ret; + const char *pattern = "Estimated minimum size of the filesystem: "; + + r = command (&out, &err, str_resize2fs, "-P", device, NULL); + if (r == -1) { + reply_with_error ("%s", err); + return -1; + } + + lines = split_lines (out); + if (lines == NULL) + return -1; + + for (i = 0; lines[i] != NULL; ++i) { + if (verbose) + fprintf (stderr, "resize2fs_P: lines[%zu] = \"%s\"\n", i, lines[i]); + + if ((p = strstr (lines[i], pattern))) { + if (sscanf (p + strlen(pattern), "%&q...
2015 Jun 11
2
[PATCH] New API: btrfs_filesystem_show_all
...RG (argv, i, str_btrfs); + ADD_ARG (argv, i, "filesystem"); + ADD_ARG (argv, i, "show"); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s", err); + free(out); + return NULL; + } + + lines = split_lines (out); + if (!lines) + return NULL; + + size_t nlines = count_strings (lines); + for (i = 0; i < nlines; i++) + if (strstr(lines[i], "\tdevid")) + nr_filesystem_show++; + + guestfs_int_btrfsfsshow_list *ret = NULL; + ret = malloc(sizeof *ret); + if (ret == NULL) {...
2013 Jan 24
5
[PATCH] btrfs: Fix btrfs_subvolume_list on F18
The output of btrfs subvolume list has changed in F18 to include generation, which breaks the parsing in btrfs_subvolume_list. This change replaces sscanf with a more robust regular expression. The new regular expression should also handle the addition of future unexpected columns. Fixes RHBZ#903620 --- daemon/Makefile.am | 6 +++-- daemon/btrfs.c | 67
2015 Oct 16
4
[PATCH 0/2] Introduce get_min_size API to get minimum filesystem size.
Tried to make it in accordance with your comments. Maybe you can suggest a better name for API? Maxim Perevedentsev (2): New API: get_min_size Include resize2fs_P into get_min_size. daemon/Makefile.am | 1 + daemon/daemon.h | 2 ++ daemon/ext2.c | 37 ++++++++++++++++++++++++---- daemon/fs-min-size.c | 49 +++++++++++++++++++++++++++++++++++++ daemon/ntfs.c | 68
2015 Feb 02
5
[PATCH 1/2] New API: btrfs_balance_status
...+ ADD_ARG (argv, i, "balance"); + ADD_ARG (argv, i, "status"); + ADD_ARG (argv, i, path_buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + return NULL; + } + + lines = split_lines (out); + if (!lines) + return NULL; + + ret = malloc(sizeof *ret); + if (ret == NULL) { + reply_with_perror ("malloc"); + goto error; + } + memset (ret, 0, sizeof(*ret)); + + /* Output of `btrfs balance status' is like: + * + * running: + * + * Balance on ...
2015 Oct 13
4
[PATCH] New API: resize2fs_P
...; + size_t i; + char *p; + int64_t ret; + char pattern[] = "Estimated minimum size of the filesystem: "; + + r = command (&out, &err, str_resize2fs, "-P", device, NULL); + if (r == -1) { + reply_with_error ("%s", err); + return -1; + } + + lines = split_lines (out); + if (lines == NULL) + return -1; + + for (i = 0; lines[i] != NULL; ++i) { + if (verbose) + fprintf (stderr, "resize2fs-P: lines[%zu] = \"%s\"\n", i, lines[i]); + + if ((p = strstr (lines[i], pattern))) { + if (sscanf (p + strlen(pattern), "%&q...
2012 Jan 24
14
[PATCH 00/14] Run the daemon under valgrind and fix resultant errors.
This patch series lets you run the daemon under valgrind. Many errors were found and fixed. With the complete series applied, valgrind doesn't show any errors.
2015 Oct 19
5
Re: [PATCH 1/2] New API: vfs_min_size
...ern = "Current volume size:"; > + int is_full = 0; > + int32_t cluster_size = 0; > + > + /* FS may be marked for check, so force ntfsresize */ > + r = command (&out, &err, str_ntfsresize, "--info", "-ff", device, NULL); > + > + lines = split_lines (out); > + if (lines == NULL) > + return -1; > + > + if (verbose) { > + for (i = 0; lines[i] != NULL; ++i) > + fprintf (stderr, "ntfs_min_size: lines[%zu] = \"%s\"\n", i, lines[i]); > + } > + > + if (r == -1) { > + /* If volume i...
2015 Mar 17
4
[PATCH] New API: part_get_part_type for showing partition type
...part_type; + } + + /* machine parseable output by 'parted -m' did not provide + * partition type info. + * Use traditional style. + */ + CLEANUP_FREE char *out = print_partition_table (device, PARTED_NO_M); + if (!out) + return NULL; + + CLEANUP_FREE_STRING_LIST char **lines = split_lines (out); + + if (!lines) + return NULL; + + size_t start = 0, end = 0, row; + + for (row = 0; lines[row] != NULL; ++row) + if (STRPREFIX (lines[row], "Number")) { + start = row + 1; + break; + } + + if (start == 0) { + reply_with_error ("parted output has no...
2015 Jun 11
0
Re: [PATCH] New API: btrfs_filesystem_show_all
...esystem"); > + ADD_ARG (argv, i, "show"); > + ADD_ARG (argv, i, NULL); > + > + r = commandv (&out, &err, argv); > + if (r == -1) { > + reply_with_error ("%s", err); > + free(out); > + return NULL; > + } > + > + lines = split_lines (out); > + if (!lines) > + return NULL; > + > + size_t nlines = count_strings (lines); > + for (i = 0; i < nlines; i++) > + if (strstr(lines[i], "\tdevid")) > + nr_filesystem_show++; The logic here should match what is being done later, i.e. usin...
2020 Feb 20
0
[PATCH] daemon: Translate device names if Linux device ordering is unstable (RHBZ#1804207).
...ULL; + size_t i, n; + int r; + + device_name_translation_free (); + + r = command (&out, &err, "ls", "-1v", by_path, NULL); + if (r == -1) + error (EXIT_FAILURE, 0, + "failed to initialize device name translation cache: %s", err); + + lines = split_lines (out); + if (lines == NULL) + error (EXIT_FAILURE, errno, "split_lines"); + + /* Delete entries for partitions. */ + for (i = 0; lines[i] != NULL; ++i) { + if (strstr (lines[i], "-part")) { + n = guestfs_int_count_strings (&lines[i+1]); + memmove (&l...
2014 Dec 11
1
Re: [PATCH v2 01/11] daemon: btrfs: add helper functions mount and umount
...fs_subvolume_list (const mountable_t *fs) > fprintf (stderr, "malloc: %m"); > } > reply_with_error ("%s: %s", fs_desc ? fs_desc : "malloc", errout); > - goto cmderror; > + return NULL; > } > > lines = split_lines (out); > -- > 1.9.3 > > _______________________________________________ > Libguestfs mailing list > Libguestfs@redhat.com > https://www.redhat.com/mailman/listinfo/libguestfs -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programm...
2009 Aug 10
2
daemon/ warnings
...nt_shell_quote): Mark each "info" parameter as unused. --- daemon/guestfsd.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 07a1c5e..07a952f 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -718,7 +718,7 @@ split_lines (char *str) */ static int print_shell_quote (FILE *stream, - const struct printf_info *info, + const struct printf_info *info ATTRIBUTE_UNUSED, const void *const *args) { #define SAFE(c) (isalnum((c)) || \ @@ -751,7 +751,7 @@ print...
2011 Dec 03
1
[PATCH] NEW API: add blkid command to print the attributes of the device
...*blkid[] = {"blkid", "-p", "-i", "-o", "export", device, NULL}; + r = commandv(&out, &err, blkid); + if (r == -1) { + reply_with_error("%s", err); + goto error; + } + + /* Split the command output into lines */ + lines = split_lines(out); + if (lines == NULL) { + reply_with_perror("malloc"); + goto error; + } + + /* Parse the output of blkid -p -i -o export: + * UUID=b6d83437-c6b4-4bf0-8381-ef3fc3578590 + * VERSION=1.0 + * TYPE=ext2 + * USAGE=filesystem + * MINIMUM_IO_SIZE=512 + * PHYSICAL_SECT...
2012 Jul 31
1
[PATCH] xfs: add new api xfs-growfs
...ADD_ARG (argv, i, "-m"); + ADD_ARG (argv, i, maxpct_s); + } + + ADD_ARG (argv, i, buf); + ADD_ARG (argv, i, NULL); + + r = commandv (&out, &err, argv); + free (buf); + if (r == -1) { + reply_with_error ("%s: %s", path, err); + goto error; + } + + lines = split_lines (out); + if (lines == NULL) + goto error; + + ret = parse_xfs_info (lines); + +error: + if (buf) free (buf); + if (err) free (err); + if (out) free (out); + if (lines) free_strings (lines); + return ret; +} diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml ind...