[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH nbdkit v2 2/3] sh: Pass export name as an extra parameter to the open method.



In nbdkit API v3 we will probably add the export name as an extra
parameter, but while we are using API v2 we can get the same effect by
calling nbdkit_export_name().
---
 plugins/sh/nbdkit-sh-plugin.pod | 6 ++++--
 plugins/sh/sh.c                 | 6 +++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/plugins/sh/nbdkit-sh-plugin.pod b/plugins/sh/nbdkit-sh-plugin.pod
index 5789908..a088838 100644
--- a/plugins/sh/nbdkit-sh-plugin.pod
+++ b/plugins/sh/nbdkit-sh-plugin.pod
@@ -237,9 +237,11 @@ with status C<1>; unrecognized output is ignored.
 
 =item C<open>
 
- /path/to/script open <readonly>
+ /path/to/script open <readonly> <exportname>
 
-The C<readonly> parameter will be C<true> or C<false>.
+The C<readonly> parameter will be C<true> or C<false>.  The
+C<exportname> parameter, if present, is the export name passed to the
+server from the client.
 
 On success this should print the handle (any string) on stdout and
 exit with code C<0>.  If the handle ends with a newline character then
diff --git a/plugins/sh/sh.c b/plugins/sh/sh.c
index e0d370d..56d30ca 100644
--- a/plugins/sh/sh.c
+++ b/plugins/sh/sh.c
@@ -324,7 +324,11 @@ sh_open (int readonly)
 {
   char *h = NULL;
   size_t hlen;
-  const char *args[] = { script, "open", readonly ? "true" : "false", NULL };
+  const char *args[] =
+    { script, "open",
+      readonly ? "true" : "false",
+      nbdkit_export_name () ? : "",
+      NULL };
 
   /* We store the string returned by open in the handle. */
   switch (call_read (&h, &hlen, args)) {
-- 
2.23.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]