Displaying 9 results from an estimated 9 matches for "reflection_config".
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.
...RTNAME,
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
reflection_config (const char *key, const char *value)
{
@@ -73,9 +89,14 @@ reflection_config (const char *key, const char *value)
return -1;
#endif
}
- else if (strcasecmp (value, "address") == 0) {
+ else if (strcasecmp (value, "address") == 0)
mode = MODE_ADDRESS;
-...
2019 Sep 28
0
[PATCH nbdkit v2 2/4] Rename nbdkit-reflection-plugin to nbdkit-info-plugin.
...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 *value)
return 0;
}
-#define r...
2019 Sep 16
2
Re: [PATCH nbdkit 1/4] Add reflection plugin.
...ode. */
> +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 *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?
> + mode = MODE_EXPORTNAME;
>...
2019 Sep 17
0
Re: [PATCH nbdkit 1/4] Add reflection plugin.
...t;,
> > +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?
Hmmm true :-/ Will remove it.
> > +static int
> > +reflection_config (const char *key, const 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.
>...
2019 Sep 15
0
[PATCH nbdkit 1/4] Add reflection plugin.
...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 if (strcasecmp (value, "base64exportname") == 0) {
+#ifdef HAVE_BASE64
+ mode = MODE_BASE6...
2019 Sep 15
0
[PATCH nbdkit 4/4] reflection: Enhance plugin to support client address mode.
...+#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;
+ }
else {
nbdkit_error ("unknown mode: '%s'", value);
return -1;
@@ -137,6 +144,74 @@ decode_base6...
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 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.