search for: mode_exportname

Displaying 12 results from an estimated 12 matches for "mode_exportname".

2019 Sep 15
13
[PATCH nbdkit 0/4] Reflection plugin, peer name.
This series is based on my blog posting here: https://rwmj.wordpress.com/2019/09/13/nbdkit-supports-exportnames/ It depends on the fix for realloc: https://www.redhat.com/archives/libguestfs/2019-September/thread.html#00103 This series adds a fun plugin, and also an semi-related feature I've long thought to be desirable. You can consider patches 1 & 4, and patches 2 & 3 as forming
2019 Sep 15
0
[PATCH nbdkit 1/4] Add reflection plugin.
...t; +#include <stdlib.h> +#include <string.h> + +#if defined(HAVE_GNUTLS) && defined(HAVE_GNUTLS_BASE64_DECODE2) +#include <gnutls/gnutls.h> +#define HAVE_BASE64 1 +#endif + +#define NBDKIT_API_VERSION 2 + +#include <nbdkit-plugin.h> + +/* The mode. */ +enum mode { + MODE_EXPORTNAME, + MODE_BASE64EXPORTNAME, +}; +static enum mode mode = MODE_EXPORTNAME; + +static int +reflection_config (const char *key, const char *value) +{ + if (strcmp (key, "mode") == 0) { + if (strcasecmp (value, "exportname") == 0) { + mode = MODE_EXPORTNAME; + } + else...
2019 Sep 16
2
Re: [PATCH nbdkit 1/4] Add reflection plugin.
..., > +L<nbdkit-data-plugin(1)>, > +L<nbdkit-memory-plugin(1)/Preloading small amounts of data>. Except that nbdkit-memory-plugin points only to nbdkit-data-plugin, so is this link helping? > +++ b/plugins/reflection/reflection.c > +/* The mode. */ > +enum mode { > + MODE_EXPORTNAME, > + MODE_BASE64EXPORTNAME, > +}; > +static enum mode mode = MODE_EXPORTNAME; Explicit assignment to a 0 value, instead of relying on .bss; but I'm okay with it (it's not as obvious as =0 or =false). > + > +static int > +reflection_config (const char *key, const char *v...
2019 Sep 28
2
[PATCH nbdkit 1/2] common/include: Add function for subtracting struct timeval.
--- common/include/test-tvdiff.c | 75 +++++++++++++++++++++++++++++------- common/include/tvdiff.h | 13 ++++++- 2 files changed, 74 insertions(+), 14 deletions(-) diff --git a/common/include/test-tvdiff.c b/common/include/test-tvdiff.c index 9cbcfc0..abefb2e 100644 --- a/common/include/test-tvdiff.c +++ b/common/include/test-tvdiff.c @@ -36,7 +36,6 @@ #include <stdlib.h> #include
2019 Sep 28
0
[PATCH nbdkit 2/2] reflection: Add mode for reflecting server time.
...<string.h> +#include <sys/time.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -48,14 +49,29 @@ #include <nbdkit-plugin.h> +#include "byte-swapping.h" +#include "tvdiff.h" + /* The mode. */ enum mode { MODE_EXPORTNAME, MODE_BASE64EXPORTNAME, MODE_ADDRESS, + MODE_TIME, + MODE_UPTIME, + MODE_CONNTIME, }; static enum mode mode = MODE_EXPORTNAME; +/* Plugin load time. */ +static struct timeval load_t; + +static void +reflection_load (void) +{ + gettimeofday (&load_t, NULL); +} + static int reflec...
2019 Sep 28
0
[PATCH nbdkit v2 3/4] info: Add mode for sending back server time.
...<string.h> +#include <sys/time.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -48,14 +49,29 @@ #include <nbdkit-plugin.h> +#include "byte-swapping.h" +#include "tvdiff.h" + /* The mode. */ enum mode { MODE_EXPORTNAME, MODE_BASE64EXPORTNAME, MODE_ADDRESS, + MODE_TIME, + MODE_UPTIME, + MODE_CONNTIME, }; static enum mode mode = MODE_EXPORTNAME; +/* Plugin load time. */ +static struct timeval load_t; + +static void +info_load (void) +{ + gettimeofday (&load_t, NULL); +} + static int info_config...
2019 Sep 15
0
[PATCH nbdkit 4/4] reflection: Enhance plugin to support client address mode.
...tdio.h> #include <stdlib.h> #include <string.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> #if defined(HAVE_GNUTLS) && defined(HAVE_GNUTLS_BASE64_DECODE2) #include <gnutls/gnutls.h> @@ -49,6 +52,7 @@ enum mode { MODE_EXPORTNAME, MODE_BASE64EXPORTNAME, + MODE_ADDRESS, }; static enum mode mode = MODE_EXPORTNAME; @@ -67,6 +71,9 @@ reflection_config (const char *key, const char *value) return -1; #endif } + else if (strcasecmp (value, "address") == 0) { + mode = MODE_ADDRESS; + }...
2019 Sep 15
0
Re: [PATCH nbdkit 0/4] Reflection plugin, peer name.
...return (int64_t) h->len; } -/* Read-only plugin so multi-conn is safe. */ static int reflection_can_multi_conn (void *handle) { - return 1; + switch (mode) { + /* Safe for exportname modes since clients should only request + * multi-conn with the same export name. + */ + case MODE_EXPORTNAME: + case MODE_BASE64EXPORTNAME: + return 1; + /* Unsafe for mode=address because all multi-conn connections + * won't necessarily originate from the same client address. + */ + case MODE_ADDRESS: + return 0; + } } /* Cache. */ Rich. -- Richard Jones, Virtualization Gr...
2019 Sep 17
0
Re: [PATCH nbdkit 1/4] Add reflection plugin.
...onst char *value) > > +{ > > + if (strcmp (key, "mode") == 0) { > > + if (strcasecmp (value, "exportname") == 0) { > > Do we want to be nice and allow 'export-name' as an [undocumented] > alternative spelling? OK. > > + mode = MODE_EXPORTNAME; > > + } > > + else if (strcasecmp (value, "base64exportname") == 0) { > > similarly for 'base64-export-name' OK. > > > +#define reflection_config_help \ > > + "mode=MODE Plugin mode." > > + > > Worth listing th...
2019 Sep 28
9
[PATCH nbdkit v2 0/4] info: Add mode for sending back server time.
v1 was: https://www.redhat.com/archives/libguestfs/2019-September/thread.html#00361 v2: - Adds a patch to rename the reflection plugin to the info plugin. - Adds tests. Rich.
2019 Sep 28
0
[PATCH nbdkit v2 2/4] Rename nbdkit-reflection-plugin to nbdkit-info-plugin.
...a/plugins/reflection/reflection.c b/plugins/info/info.c similarity index 91% rename from plugins/reflection/reflection.c rename to plugins/info/info.c index 6fd1962..4807287 100644 --- a/plugins/reflection/reflection.c +++ b/plugins/info/info.c @@ -57,7 +57,7 @@ enum mode { static enum mode mode = MODE_EXPORTNAME; static int -reflection_config (const char *key, const char *value) +info_config (const char *key, const char *value) { if (strcmp (key, "mode") == 0) { if (strcasecmp (value, "exportname") == 0 || @@ -89,15 +89,15 @@ reflection_config (const char *key, const char *v...
2020 May 19
1
[PATCH nbdkit] common/include: Add locale-safe ascii_strcasecmp and ascii_strncasecmp.
...(key, "mode") == 0) { - if (strcasecmp (value, "exportname") == 0 || - strcasecmp (value, "export-name") == 0) { + if (ascii_strcasecmp (value, "exportname") == 0 || + ascii_strcasecmp (value, "export-name") == 0) { mode = MODE_EXPORTNAME; } - else if (strcasecmp (value, "base64exportname") == 0 || - strcasecmp (value, "base64-export-name") == 0) { + else if (ascii_strcasecmp (value, "base64exportname") == 0 || + ascii_strcasecmp (value, "base64-export-name")...