Displaying 20 results from an estimated 89 matches for "nbdkit_parse_bool".
2018 Nov 08
8
[nbdkit PATCH v2 0/5] log appends
v2 turned out to be much more involved, as I ended up fixing
several things along the way that I noticed while debugging a
feature addition.
Eric Blake (5):
maint: Improve ./nbdkit option parsing
main: Saner newline printing during --help
utils: Add nbdkit_parse_bool
main: Use new bool parser for --tls
log: Allow user option of appending to log
docs/nbdkit-plugin.pod | 11 +++++++++++
filters/log/nbdkit-log-filter.pod | 5 +++--
include/nbdkit-common.h | 1 +
src/filters.c | 13 +++++++-----
src/main.c...
2019 Aug 15
3
[nbdkit PATCH] nbd: Another libnbd version bump
...12 @@ nbdplug_config (const char *key, const char *value)
if (strcasecmp (value, "require") == 0 ||
strcasecmp (value, "required") == 0 ||
strcasecmp (value, "force") == 0)
- tls = 2;
+ tls = LIBNBD_TLS_REQUIRE;
else {
- tls = nbdkit_parse_bool (value);
- if (tls == -1)
+ r = nbdkit_parse_bool (value);
+ if (r == -1)
exit (EXIT_FAILURE);
+ tls = r ? LIBNBD_TLS_ALLOW : LIBNBD_TLS_DISABLE;
}
}
else if (strcmp (key, "tls-certificates") == 0) {
@@ -245,8 +246,9 @@ nbdplug_config_complete (void...
2019 Aug 15
0
Re: [nbdkit PATCH] nbd: Another libnbd version bump
...ey, const char *value)
> if (strcasecmp (value, "require") == 0 ||
> strcasecmp (value, "required") == 0 ||
> strcasecmp (value, "force") == 0)
> - tls = 2;
> + tls = LIBNBD_TLS_REQUIRE;
> else {
> - tls = nbdkit_parse_bool (value);
> - if (tls == -1)
> + r = nbdkit_parse_bool (value);
> + if (r == -1)
> exit (EXIT_FAILURE);
> + tls = r ? LIBNBD_TLS_ALLOW : LIBNBD_TLS_DISABLE;
Our feedback was the LIBNBD_TLS_ALLOW was really bad (I'm unconvinced
because I prefer my stuf...
2018 Nov 08
0
[nbdkit PATCH v2 5/5] log: Allow user option of appending to log
Always truncating a log can wipe out useful history. Add an
option to change this.
Signed-off-by: Eric Blake <eblake@redhat.com>
---
v2: tweaks to documentation, rely on nbdkit_parse_bool
filters/log/nbdkit-log-filter.pod | 5 +++--
filters/log/log.c | 12 ++++++++++--
tests/test-log.sh | 6 +++++-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/filters/log/nbdkit-log-filter.pod b/filters/log/nbdkit-log-filter.pod
index 0903329..cf...
2020 Feb 18
2
[nbdkit PATCH v6] vddk: Add re-exec with altered environment
...+ else if (strcmp (key, "reexeced_") == 0) {
+ /* Special name because it is only for internal use. */
+ reexeced = value;
+ }
else if (strcmp (key, "server") == 0) {
server_name = value;
}
else if (strcmp (key, "single-link") == 0) {
- int r = nbdkit_parse_bool (value);
-
+ r = nbdkit_parse_bool (value);
if (r == -1)
return -1;
single_link = r;
@@ -219,8 +226,7 @@ vddk_config (const char *key, const char *value)
transport_modes = value;
}
else if (strcmp (key, "unbuffered") == 0) {
- int r = nbdkit_parse_bool (v...
2020 Aug 18
0
[PATCH nbdkit 8/9] include: Prefix all exports with NBDKIT_DLLEXPORT.
...it_debug (const char *msg, ...)
+ ATTRIBUTE_FORMAT_PRINTF (1, 2);
+extern NBDKIT_DLLEXPORT void nbdkit_vdebug (const char *msg, va_list args)
ATTRIBUTE_FORMAT_PRINTF (1, 0);
-extern char *nbdkit_absolute_path (const char *path);
-extern int64_t nbdkit_parse_size (const char *str);
-extern int nbdkit_parse_bool (const char *str);
-extern int nbdkit_parse_int (const char *what, const char *str,
- int *r);
-extern int nbdkit_parse_unsigned (const char *what, const char *str,
- unsigned *r);
-extern int nbdkit_parse_int8_t (const char *what, const...
2020 Feb 18
4
[nbdkit PATCH v7 0/2] vddk: Drive library loading from libdir parameter.
In v7:
everything should work now! The re-exec code is slightly simplified,
with Rich's suggestion to pass the original LD_LIBRARY_PATH rather
than just the prefix being added, and I've now finished wiring up the
initial dlopen() check into code that correctly computes the right
prefix dir to add to LD_LIBRARY_PATH.
Eric Blake (1):
vddk: Add re-exec with altered environment
Richard
2019 Apr 05
2
[PATCH nbdkit] vddk: Add support for VIXDISKLIB_FLAG_OPEN_SINGLE_LINK
.../* thumbprint */
static const char *transport_modes = NULL; /* transports */
@@ -272,6 +273,13 @@ vddk_config (const char *key, const char *value)
else if (strcmp (key, "vm") == 0) {
vmx_spec = value;
}
+ else if (strcmp (key, "single-link") == 0) {
+ int r = nbdkit_parse_bool (value);
+
+ if (r == -1)
+ return -1;
+ single_link = r;
+ }
else {
nbdkit_error ("unknown parameter '%s'", key);
return -1;
@@ -464,6 +472,8 @@ vddk_open (int readonly)
flags = 0;
if (readonly)
flags |= VIXDISKLIB_FLAG_OPEN_READ_ONLY;
+ if (s...
2019 Aug 03
0
[nbdkit PATCH 3/3] server: Add and use nbdkit_nanosleep
...six_fadvise])
dnl Check whether printf("%m") works
diff --git a/include/nbdkit-common.h b/include/nbdkit-common.h
index 5257d992..e004aa18 100644
--- a/include/nbdkit-common.h
+++ b/include/nbdkit-common.h
@@ -82,6 +82,7 @@ extern int64_t nbdkit_parse_size (const char *str);
extern int nbdkit_parse_bool (const char *str);
extern int nbdkit_read_password (const char *value, char **password);
extern char *nbdkit_realpath (const char *path);
+extern int nbdkit_nanosleep (unsigned sec, unsigned nsec);
struct nbdkit_extents;
extern int nbdkit_add_extent (struct nbdkit_extents *,
diff --git a/filte...
2019 Mar 26
3
nbdkit design: varying the rate limit parameter
Hi Eric,
We may have our first user (Tomas, CC'd) of the rate filter to limit
NBD connections. As you recall it lets you do commands like:
nbdkit --filter=rate memory size=64G rate=10M
to limit network bandwidth to 10 Mbps. However a twist is that he
needs to vary the parameter while nbdkit is running in response to a
UI, and we haven't really thought about that before.
In the
2020 Mar 26
0
[PATCH nbdkit 5/9 patch split 2/5] lib: Move code for parsing, passwords and paths into libnbdkit.so.
...nctions we want plugins and filters to call.
global:
- nbdkit_absolute_path;
- nbdkit_add_extent;
nbdkit_debug;
nbdkit_error;
nbdkit_export_name;
- nbdkit_extents_count;
- nbdkit_extents_free;
- nbdkit_extents_new;
- nbdkit_get_extent;
nbdkit_nanosleep;
- nbdkit_parse_bool;
- nbdkit_parse_int8_t;
- nbdkit_parse_int16_t;
- nbdkit_parse_int32_t;
- nbdkit_parse_int64_t;
- nbdkit_parse_int;
- nbdkit_parse_size;
- nbdkit_parse_uint8_t;
- nbdkit_parse_uint16_t;
- nbdkit_parse_uint32_t;
- nbdkit_parse_uint64_t;
- nbdkit_parse_unsigned;...
2020 May 19
1
[PATCH nbdkit] common/include: Add locale-safe ascii_strcasecmp and ascii_strncasecmp.
...|
- strcasecmp (optarg, "force") == 0)
+ if (ascii_strcasecmp (optarg, "require") == 0 ||
+ ascii_strcasecmp (optarg, "required") == 0 ||
+ ascii_strcasecmp (optarg, "force") == 0)
tls = 2;
else {
tls = nbdkit_parse_bool (optarg);
diff --git a/server/public.c b/server/public.c
index d1925c9f..bcf1a3a2 100644
--- a/server/public.c
+++ b/server/public.c
@@ -52,6 +52,7 @@
#include <sys/socket.h>
#include "ascii-ctype.h"
+#include "ascii-string.h"
#include "get-current-dir-name.h&quo...
2018 Nov 08
0
[nbdkit PATCH v2 4/5] main: Use new bool parser for --tls
...strcasecmp (optarg, "required") == 0 ||
+ strcasecmp (optarg, "force") == 0)
tls = 2;
else {
- fprintf (stderr, "%s: --tls flag must be off|on|require\n",
- program_name);
- exit (EXIT_FAILURE);
+ tls = nbdkit_parse_bool (optarg);
+ if (tls < 0)
+ exit (EXIT_FAILURE);
}
break;
--
2.17.2
2019 Mar 19
0
[PATCH nbdkit 4/9] server: Export nbdkit_extent* symbols.
....syms b/server/nbdkit.syms
index 672abd2..95ef067 100644
--- a/server/nbdkit.syms
+++ b/server/nbdkit.syms
@@ -42,6 +42,10 @@
nbdkit_absolute_path;
nbdkit_debug;
nbdkit_error;
+ nbdkit_extent_add;
+ nbdkit_extents_free;
+ nbdkit_extents_foreach;
+ nbdkit_extents_new;
nbdkit_parse_bool;
nbdkit_parse_size;
nbdkit_read_password;
--
2.20.1
2019 Apr 05
1
[PATCH nbdkit] vddk: Add support for VIXDISKLIB_FLAG_OPEN_UNBUFFERED.
I suppose we may as well implement the only other flag too ...
It's not clear what this does, something like O_DIRECT I imagine.
Rich.
2020 Apr 07
0
Re: [nbdkit PATCH 0/2] stdin/out cleanups
...se that we support using the headers in plugins which are pure
C90 code.
We also test this -- see tests/Makefile.am test-ansi-c-plugin.la --
however it may be that the test doesn't work properly if it didn't
fail after your change.
The solution is quite simple - return an int instead.
Cf. nbdkit_parse_bool
Rich.
> Eric Blake (2):
> server: Add nbdkit_stdio_safe
> server: Sanitize stdin/out before running plugin code
>
> docs/nbdkit-plugin.pod | 23 +++++++++++++++++++-
> plugins/sh/nbdkit-sh-plugin.pod | 4 +++-
> include/nbdkit-common.h | 2 ++
> se...
2020 Aug 08
0
Re: [PATCH nbdkit] plugins: python: Add imageio plugin example
...v = value.lower()
> + if v in ("yes", "true", "1"):
> + return True
> + if v in ("no", "false", 0):
> + return False
> + raise RuntimeError("Invalid boolean value for {}: {!r}".format(key, value))
nbdkit_parse_bool also handles 'on/off'. Should we make that function
more easily available to python plugins, so you aren't having to
reimplement it yourself?
> +
> +
> +def config_complete():
> + """
> + Called when configuration completed.
missing 'is'...
2019 Apr 05
0
Re: [PATCH nbdkit] vddk: Add support for VIXDISKLIB_FLAG_OPEN_SINGLE_LINK
...atic const char *transport_modes = NULL; /* transports */
>@@ -272,6 +273,13 @@ vddk_config (const char *key, const char *value)
> else if (strcmp (key, "vm") == 0) {
> vmx_spec = value;
> }
>+ else if (strcmp (key, "single-link") == 0) {
>+ int r = nbdkit_parse_bool (value);
>+
>+ if (r == -1)
>+ return -1;
>+ single_link = r;
>+ }
> else {
> nbdkit_error ("unknown parameter '%s'", key);
> return -1;
>@@ -464,6 +472,8 @@ vddk_open (int readonly)
> flags = 0;
> if (readonly)
> f...
2018 Nov 12
0
ANNOUNCE: nbdkit 1.8 - an NBD server toolkit with stable plugin API and permissive license
...le’ to inline a file.
- vddk: Use ‘-D vddk.diskinfo=1’ to enable extra debug information.
- tests: Use a helper function to refactor and simplify most tests.
- partition filter: Can handle > 128 GPT partitions.
- nbdkit can be compiled on the Haiku operating system
(François Revol).
- New nbdkit_parse_bool API for parsing boolean parameters (Eric Blake).
- log: Add logappend=[true|false] (Eric Blake).
- ocaml: New set_error and debug calls.
- Analyze code under AddressSanitizer and ThreadSanitizer and fix bugs
(Eric Blake).
- Analyze code under Coverity and fix bugs.
- Tests now run more quick...
2020 Mar 23
0
[PATCH nbdkit 2/3] server: Inject API functions for Windows
...nctions == 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->parse_int16_t = nbdkit_parse_int16_t;
+ functions->parse_uint16_t...