search for: parse_size

Displaying 20 results from an estimated 62 matches for "parse_size".

2015 Jul 13
2
[PATCH 1/2] utils: import parse_size from libguestfs
...f --git a/src/utils.ml b/src/utils.ml index 3e81c21..7ae24bd 100644 --- a/src/utils.ml +++ b/src/utils.ml @@ -204,3 +204,24 @@ let compare_architecture a1 a2 = exit 1 in compare (index_of_architecture a1) (index_of_architecture a2) + +(* Parse a size field, eg. "10G". *) +let parse_size = + let const_re = Str.regexp "^\\([.0-9]+\\)\\([bKMG]\\)$" in + fun field -> + let matches rex = Str.string_match rex field 0 in + let sub i = Str.matched_group i field in + let size_scaled f = function + | "b" -> Int64.of_float f + | "K" -&...
2008 Sep 18
2
dovecot 1.1.3 coredump
I found imap core in coredump dir: (gdb) bt #0 0x00000000004abdea in message_parse_header_next (ctx=0x79c150, hdr_r=0x7fffffffe478) at message-header-parser.c:114 #1 0x00000000004a8193 in read_header (mstream=0x795330) at istream-header-filter.c:162 #2 0x00000000004a84e7 in i_stream_header_filter_read (stream=0x795330) at istream-header-filter.c:288 #3 0x00000000004bc216 in i_stream_read
2019 Apr 12
0
[supermin PATCH 5/5] utils: remove unused 'compare_architecture' function
...; 64 - | "alpha" -> 64 - | a -> - error "missing support for architecture '%s'\nIt may need to be added to supermin." - a - in - compare (index_of_architecture a1) (index_of_architecture a2) - (* Parse a size field, eg. "10G". *) let parse_size = let const_re = Str.regexp "^\\([.0-9]+\\)\\([bKMG]\\)$" in diff --git a/src/utils.mli b/src/utils.mli index 7837dbb..b86586a 100644 --- a/src/utils.mli +++ b/src/utils.mli @@ -86,9 +86,6 @@ val filter_map : ('a -> 'b option) -> 'a list -> 'b list val compare...
2019 Jan 16
1
Re: [PATCH 3/5] mltools: add simple tests for external_command
...l ~printer:(fun x -> "(" ^ (String.concat ";" (List.map string_of_int x)) ^ ")") > +let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")") > > (* Test Tools_utils.parse_size and Tools_utils.parse_resize. *) > let test_parse_resize ctx = > @@ -156,6 +157,26 @@ let test_run_commands ctx = > end; > () > > +let test_external_command ctx = > + assert_equal_stringlist [] (external_command "true"); > + assert_equal_stringlist [&quo...
2017 Sep 21
18
[PATCH v2 00/18] Replace many more uses of the Str module with PCRE.
v1 was here: https://www.redhat.com/archives/libguestfs/2017-September/msg00135.html This is a more complete evolution of the earlier patch. It replaces most important uses of Str with PCRE throughout the code. It also extends the bindings with some useful features like case-insensitive regexps. The main places I *didn't* touch are the generator (GObject uses Str extensively); and
2017 Sep 22
27
[PATCH v3 00/22] Replace almost all uses of the Str module with PCRE.
v1: https://www.redhat.com/archives/libguestfs/2017-September/msg00135.html v2: https://www.redhat.com/archives/libguestfs/2017-September/msg00158.html v3 is almost identical to v2, but I have added 4 extra commits to almost finish the job of replacing Str everywhere possible (note it's not possible to replace Str in common/mlstdutils or the generator because those are pure OCaml). As
2020 Mar 23
6
[PATCH nbdkit 0/3] msys2 support for review
I pushed a few of the msys2 patches upstream. I changed the way that $(SHARED_LDFLAGS) works so it's more to my liking, and the others were pushed unchanged. Three patches remain which I'm posting on the mailing list for proper review. Rich.
2015 Jul 02
0
[PATCH] Fix various -Wformat problems.
...if (printf ("%ju:%ju", + (uintmax_t) major (dev), (uintmax_t) minor (dev)) < 0) { perror ("printf"); exit (EXIT_FAILURE); } diff --git a/fish/alloc.c b/fish/alloc.c index b40284a..9f41915 100644 --- a/fish/alloc.c +++ b/fish/alloc.c @@ -97,7 +97,7 @@ parse_size (const char *str, off_t *size_rtn) xerr = xstrtoull (str, NULL, 0, &size, "0kKMGTPEZY"); if (xerr != LONGINT_OK) { fprintf (stderr, - _("%s: invalid integer parameter (%s returned %d)\n"), + _("%s: invalid integer parameter (%s returne...
2015 Jul 02
0
[PATCH v2] Fix various -Wformat problems.
...if (printf ("%ju:%ju", + (uintmax_t) major (dev), (uintmax_t) minor (dev)) < 0) { perror ("printf"); exit (EXIT_FAILURE); } diff --git a/fish/alloc.c b/fish/alloc.c index b40284a..9f41915 100644 --- a/fish/alloc.c +++ b/fish/alloc.c @@ -97,7 +97,7 @@ parse_size (const char *str, off_t *size_rtn) xerr = xstrtoull (str, NULL, 0, &size, "0kKMGTPEZY"); if (xerr != LONGINT_OK) { fprintf (stderr, - _("%s: invalid integer parameter (%s returned %d)\n"), + _("%s: invalid integer parameter (%s returne...
2019 Apr 12
6
[supermin PATCH 0/5] rpm: fix package selection w/ multilib
This patch series fixes the way supermin sorts the list of installed packages when resolving a name, picking the right package for the host architecture. Pino Toscano (5): rpm: do not unpack parameters rpm: fix version comparison rpm: query the RPM architecture rpm: fix package sorting (RHBZ#1696822) utils: remove unused 'compare_architecture' function src/librpm-c.c | 10
2010 Nov 16
2
[Btrfs-Progs] Update for lzo support
...[-t size] <file>|<dir> [<file>|<dir>...]\n" "Defragment a file or a directory." }, { do_set_default_subvol, 2, diff --git a/btrfs_cmds.c b/btrfs_cmds.c index 8031c58..14f0ffd 100644 --- a/btrfs_cmds.c +++ b/btrfs_cmds.c @@ -142,10 +142,21 @@ static u64 parse_size(char *s) return atoll(s) * mult; } +static int parse_compress_type(char *s) +{ + if (strcmp(optarg, "zlib") == 0) + return BTRFS_COMPRESS_ZLIB; + else if (strcmp(optarg, "lzo") == 0) + return BTRFS_COMPRESS_LZO; + else { + fprintf(stderr, "Unknown compress type %s\n...
2020 Mar 23
0
[PATCH nbdkit 1/3] include: Function indirection for PE DLL
...har *msg, va_list args) + ATTRIBUTE_FORMAT_PRINTF (1, 0); +static void nbdkit_vdebug (const char *msg, va_list args) +{ + _nbdkit_functions.vdebug (msg, args); +} + +static char *nbdkit_absolute_path (const char *path) +{ + return _nbdkit_functions.absolute_path (path); +} +static int64_t nbdkit_parse_size (const char *str) +{ + return _nbdkit_functions.parse_size (str); +} +static int nbdkit_parse_bool (const char *str) +{ + return _nbdkit_functions.parse_bool (str); +} +static int nbdkit_parse_int (const char *what, const char *str, + int *r) +{ + return _nbdkit_functi...
2013 Jun 26
6
[PROGS PATCH] Import btrfs-extent-same
Originally from https://github.com/markfasheh/duperemove/blob/master/btrfs-extent-same.c Signed-off-by: Gabriel de Perthuis <g2p.code+btrfs@gmail.com> --- .gitignore | 1 + Makefile | 2 +- btrfs-extent-same.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 btrfs-extent-same.c diff
2019 Jan 16
0
[PATCH 3/5] mltools: add simple tests for external_command
...t = assert_equal ~printer:(fun x -> "(" ^ (String.concat ";" (List.map string_of_int x)) ^ ")") +let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")") (* Test Tools_utils.parse_size and Tools_utils.parse_resize. *) let test_parse_resize ctx = @@ -156,6 +157,26 @@ let test_run_commands ctx = end; () +let test_external_command ctx = + assert_equal_stringlist [] (external_command "true"); + assert_equal_stringlist ["out"] (external_command "ech...
2020 Mar 23
0
[PATCH nbdkit 2/3] server: Inject API functions for Windows
...ons () +{ + functions = malloc (sizeof *functions); + if (functions == NULL) { + perror ("malloc"); + exit (EXIT_FAILURE); + } + functions->verror = nbdkit_verror; + functions->vdebug = nbdkit_vdebug; + functions->absolute_path = nbdkit_absolute_path; + functions->parse_size = nbdkit_parse_size; + functions->parse_bool = nbdkit_parse_bool; + functions->parse_int = nbdkit_parse_int; + functions->parse_unsigned = nbdkit_parse_unsigned; + functions->parse_int8_t = nbdkit_parse_int8_t; + functions->parse_uint8_t = nbdkit_parse_uint8_t; + functions->...
2015 Jan 22
3
[PATCH 1/2] configure: look for the oUnit OCaml module
It will be used for the OCaml unit tests. --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index e0fb481..e360bbb 100644 --- a/configure.ac +++ b/configure.ac @@ -1120,6 +1120,7 @@ AS_IF([test "x$OCAMLC" != "xno"],[ ]) OCAML_PKG_gettext=no +OCAML_PKG_oUnit=no AS_IF([test "x$OCAMLC" != "xno"],[ #
2019 Aug 28
0
ANNOUNCE: libnbd 1.0 & nbdkit 1.14 - high performance NBD client and server
...he delay and rate filter) which sleep no longer cause long delays when the server is shut down (Eric Blake). Multiple fixes to the ‘rust’ plugin (Martin Kletzander). Multiple enhancements and clean ups to the test suite which should make tests better and more reliable. OCaml plugins can now use ‘parse_size’, ‘parse_bool’, ‘read_password’ calls, and there is also a new example plugin. On platforms which lack atomic O_CLOEXEC support the most serialized thread model is always selected to avoid leaking file descriptors (Eric Blake). -- Richard Jones, Virtualization Group, Red Hat http://people.redh...
2016 Feb 18
0
[PATCH 3/3] Add and use an helper error function
...bad_mode (); mode := Some Build and bad_mode () = - eprintf "supermin: you must use --prepare or --build to select the mode\n"; - exit 1 + error "you must use --prepare or --build to select the mode" in let set_size arg = size := Some (parse_size arg) in let error_supermin_5 () = - eprintf "supermin: *** error: This is supermin version 5.\n"; - eprintf "supermin: *** It looks like you are looking for supermin version 4.\n"; - eprintf "\n"; - eprintf "This version of supermin will...
2013 May 16
0
[PATCH] btrfs-progs: mkfs: add -O option to specify fs features
...gnized filesystem feature ''%s''\n", + tmp); + free(orig); + exit(1); + } + free(orig); + if (features & BTRFS_FEATURE_LIST_ALL) { + list_all_fs_features(); + exit(0); + } + break; + } case ''s'': sectorsize = parse_size(optarg); break; @@ -1521,21 +1624,22 @@ raid_groups: super = root->fs_info->super_copy; flags = btrfs_super_incompat_flags(super); + /* + * FS features that can be set by other means than -O + * just set the bit here + */ if (mixed) - flags |= BTRFS_FEATURE_INCOMPAT_MIXED_GRO...
2008 Oct 16
2
dovecot 1.1.4 maildir imap segfault in message_parse_header_next
...full #0 0x080c8d41 in message_parse_header_next (ctx=0x8774fa0, hdr_r=0xbfa438e0) at message-header-parser.c:114 msg = (const unsigned char *) 0x0 i = <value optimized out> size = 0 startpos = <value optimized out> colon_pos = 4294967295 parse_size = 0 value_pos = <value optimized out> ret = -2 continued = false continues = <value optimized out> crlf_newline = false #1 0x080c62f5 in read_header (mstream=0x877d6d0) at istream-header-filter.c:163 hdr = (struct message_header_line *) 0...