[Libguestfs] [PATCH nbdkit v3 4/6] split: Make the file= parameter(s) into a magic config key.

Richard W.M. Jones rjones at redhat.com
Mon Sep 10 15:28:01 UTC 2018


---
 plugins/split/nbdkit-split-plugin.pod | 9 +++++++--
 plugins/split/split.c                 | 3 ++-
 tests/test-split.c                    | 3 ++-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/plugins/split/nbdkit-split-plugin.pod b/plugins/split/nbdkit-split-plugin.pod
index 6a6a01a..6f62eb3 100644
--- a/plugins/split/nbdkit-split-plugin.pod
+++ b/plugins/split/nbdkit-split-plugin.pod
@@ -4,12 +4,12 @@ nbdkit-split-plugin - nbdkit plugin to concatenate split files into one disk
 
 =head1 SYNOPSIS
 
- nbdkit split file=file1 [file=file2 file=file3 ...]
+ nbdkit split [file=]file1 [[file=]file2 [file=]file3 ...]
 
 =head1 DESCRIPTION
 
 C<nbdkit-split-plugin> is a file plugin for L<nbdkit(1)>.  One or more
-filenames may be given using the C<file=FILENAME> parameter.  These
+filenames may be given using the C<FILENAME> parameter.  These
 files are logically concatenated into a single disk image.
 
 =head2 Differences from nbdkit-file-plugin
@@ -62,6 +62,11 @@ the order they appear on the command line.
 
 This parameter must appear at least once.
 
+In nbdkit E<ge> 1.8, C<file=> may be omitted.  To ensure that the
+filename does not end up being parsed accidentally as C<key=value>,
+prefix relative paths with C<./> (absolute paths do not need
+modification).
+
 =back
 
 =head1 SEE ALSO
diff --git a/plugins/split/split.c b/plugins/split/split.c
index bdcdcf7..7572316 100644
--- a/plugins/split/split.c
+++ b/plugins/split/split.c
@@ -1,5 +1,5 @@
 /* nbdkit
- * Copyright (C) 2017 Red Hat Inc.
+ * Copyright (C) 2017-2018 Red Hat Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -286,6 +286,7 @@ static struct nbdkit_plugin plugin = {
   .unload            = split_unload,
   .config            = split_config,
   .config_help       = split_config_help,
+  .magic_config_key  = "file",
   .open              = split_open,
   .close             = split_close,
   .get_size          = split_get_size,
diff --git a/tests/test-split.c b/tests/test-split.c
index f20e64b..c4f2a74 100644
--- a/tests/test-split.c
+++ b/tests/test-split.c
@@ -53,7 +53,8 @@ main (int argc, char *argv[])
   size_t i, size;
 
   if (test_start_nbdkit ("split",
-                         "file=split1", "file=split2", "file=split3",
+                         "split1", "split2",
+                         "file=split3" /* leave file= to test */,
                          NULL) == -1)
     exit (EXIT_FAILURE);
 
-- 
2.18.0




More information about the Libguestfs mailing list