New upstream version 1.5.1.

Remove patches, all upstream in this version.
This commit is contained in:
Richard W.M. Jones 2018-07-20 14:53:36 +01:00
parent 948daff1f0
commit 4a0a6e00e3
14 changed files with 7 additions and 5543 deletions

View File

@ -1,24 +0,0 @@
From ef13e7db5d9d8e5ff6977821c3e798bb6c7725d9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 10 Jul 2018 10:28:44 +0100
Subject: [PATCH 01/12] bash: Don't define bashcompdir twice.
---
bash/Makefile.am | 1 -
1 file changed, 1 deletion(-)
diff --git a/bash/Makefile.am b/bash/Makefile.am
index f38b7a1..e46784c 100644
--- a/bash/Makefile.am
+++ b/bash/Makefile.am
@@ -36,7 +36,6 @@ EXTRA_DIST = README
if HAVE_BASH_COMPLETION
-bashcompdir = @bashcompdir@
dist_bashcomp_DATA = nbdkit
endif
--
2.17.1

View File

@ -1,60 +0,0 @@
From 9fb8c7b550cddb6504386a8776e0abaeac4c1f20 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 14 Jul 2018 21:25:13 +0100
Subject: [PATCH 02/12] xz: Minor rewrites to improve the flow of the man page.
---
plugins/xz/nbdkit-xz-plugin.pod | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/plugins/xz/nbdkit-xz-plugin.pod b/plugins/xz/nbdkit-xz-plugin.pod
index 75cb881..7d8332a 100644
--- a/plugins/xz/nbdkit-xz-plugin.pod
+++ b/plugins/xz/nbdkit-xz-plugin.pod
@@ -24,29 +24,31 @@ find out how many streams and blocks are in an xz file by doing:
$ xz --list winxp.img.xz
Strms Blocks Compressed Uncompressed Ratio Check Filename
1 1 2,100.0 MiB 6,144.0 MiB 0.342 CRC64 winxp.img.xz
- =============
+ ↑↑↑ ↑↑↑
+ streams blocks
xz files are seekable on block boundaries only. Seeking is done by
-seeking directly to the lower block boundary, then (slowly)
-uncompressing data until the precise byte is reached.
-
-B<To get best random access performance, you must prepare your xz
+seeking directly to the lower block boundary, then uncompressing data
+until the precise byte is reached. As uncompressing xz data is slow,
+B<to get best random access performance, you must prepare your xz
files with many small blocks.>
-To do this, use the I<--block-size> option with a small-ish block
-size. For example the same image as above compressed with a 16 MB
-block size:
+Use the I<--block-size> option with a small-ish block size. For
+example this is the same image compressed with a 16 MB block size:
$ xz --best --block-size=16777216 winxp.img
+ ─────────────────────
$ xz --list winxp.img.xz
Strms Blocks Compressed Uncompressed Ratio Check Filename
1 384 2,120.1 MiB 6,144.0 MiB 0.345 CRC64 winxp.img.xz
+ ↑↑↑
+ blocks
-This file can be accessed randomly, and at most 16 MB of compressed
-data will have to be uncompressed to seek to any byte.
+This file can be accessed randomly. At most 16 MB will have to be
+uncompressed to seek to any byte.
-Note as you would expect, xz cannot compress quite as efficiently when
-using a small block size. The space penalty in the above example is
+As you would expect, xz cannot compress as efficiently when using a
+smaller block size. The space penalty in the above example is
S<E<lt> 1%> of the compressed file size.
=head1 PARAMETERS
--
2.17.1

View File

@ -1,56 +0,0 @@
From 166be40fa335649caf2615b384cc006d92bc5170 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 11:14:49 +0100
Subject: [PATCH 03/12] streaming: Add illustrations to the man page.
Also improve the flow of the language and provide cross-reference to
captive nbdkit.
---
plugins/streaming/nbdkit-streaming-plugin.pod | 25 ++++++++++++++++---
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/plugins/streaming/nbdkit-streaming-plugin.pod b/plugins/streaming/nbdkit-streaming-plugin.pod
index a4a9714..98e8337 100644
--- a/plugins/streaming/nbdkit-streaming-plugin.pod
+++ b/plugins/streaming/nbdkit-streaming-plugin.pod
@@ -18,16 +18,33 @@ end of the disk without seeking backwards, then this plugin will turn
the resulting disk image into a stream of data which is written to the
named C<pipe> parameter.
-Typical usage is with qemu tools. For example:
+ ┌───────────┐
+ client │ nbdkit │ plugin streams
+ writes ──────▶│ streaming │──────▶ data to pipe
+ │ plugin │
+ └───────────┘
- qemu-img convert input -O raw output
+Typical usage is with qemu tools. The following command will I<not>
+work because the output is a pipe or socket:
-does I<not> work if C<output> is a pipe. However this does:
+ qemu-img convert input -O raw pipe
- nbdkit -U /tmp/nbd.sock streaming pipe=output --run '
+However this will work:
+
+ nbdkit -U - streaming pipe=pipe --run '
qemu-img convert -n input -O raw $nbd
'
+ ┌───────────┐ ┌───────────┐
+ reads │ qemu-img │ │ nbdkit │ plugin streams
+ input ──────▶│ convert │──────▶│ streaming │──────▶ data to pipe
+ file │ command │ │ plugin │
+ └───────────┘ ↑└───────────┘
+ Unix domain socket (-U -)
+
+For use of the I<--run> and I<-U -> options, see
+L<nbdkit(1)/CAPTIVE NBDKIT>.
+
=head1 PARAMETERS
=over 4
--
2.17.1

View File

@ -1,28 +0,0 @@
From bc3b8c27b40165af6d7dcca15dfae98cbf7566e8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 11:51:39 +0100
Subject: [PATCH 04/12] tests: Put test.lua into alphabetical order in the
list.
Fixes commit ff2b304e9c5ddef01081b9aef113bf0cf6dfabac.
---
tests/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 58d24fc..5f21e75 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -57,8 +57,8 @@ EXTRA_DIST = \
test-help-plugin.sh \
test-ip.sh \
test-log.sh \
- test-nozero.sh \
test.lua \
+ test-nozero.sh \
test_ocaml_plugin.ml \
test-ocaml.c \
test-parallel-file.sh \
--
2.17.1

View File

@ -1,548 +0,0 @@
From 0a9205dc8c3b5d5703bd71bc58db503c05b0063b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 7 Jul 2018 13:30:32 +0100
Subject: [PATCH 05/12] Add pattern plugin.
This generates a simple, fixed test pattern which can be used to test
nbdkit filters (especially nbdkit-offset-filter), and also NBD
clients.
---
common-rules.mk | 1 +
configure.ac | 1 +
plugins/null/nbdkit-null-plugin.pod | 1 +
plugins/pattern/Makefile.am | 60 ++++++++++
plugins/pattern/nbdkit-pattern-plugin.pod | 99 ++++++++++++++++
plugins/pattern/pattern.c | 134 ++++++++++++++++++++++
plugins/random/nbdkit-random-plugin.pod | 1 +
plugins/zero/nbdkit-zero-plugin.pod | 1 +
tests/Makefile.am | 4 +
tests/test-pattern.sh | 121 +++++++++++++++++++
10 files changed, 423 insertions(+)
create mode 100644 plugins/pattern/Makefile.am
create mode 100644 plugins/pattern/nbdkit-pattern-plugin.pod
create mode 100644 plugins/pattern/pattern.c
create mode 100755 tests/test-pattern.sh
diff --git a/common-rules.mk b/common-rules.mk
index 5877907..01beff5 100644
--- a/common-rules.mk
+++ b/common-rules.mk
@@ -46,6 +46,7 @@ plugins = \
nbd \
null \
ocaml \
+ pattern \
perl \
python \
random \
diff --git a/configure.ac b/configure.ac
index 6e8d3e2..6304ac8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -610,6 +610,7 @@ AC_CONFIG_FILES([Makefile
plugins/nbd/Makefile
plugins/null/Makefile
plugins/ocaml/Makefile
+ plugins/pattern/Makefile
plugins/perl/Makefile
plugins/python/Makefile
plugins/random/Makefile
diff --git a/plugins/null/nbdkit-null-plugin.pod b/plugins/null/nbdkit-null-plugin.pod
index 7bd7278..55affb8 100644
--- a/plugins/null/nbdkit-null-plugin.pod
+++ b/plugins/null/nbdkit-null-plugin.pod
@@ -33,6 +33,7 @@ This parameter is required.
L<nbdkit(1)>,
L<nbdkit-plugin(3)>,
+L<nbdkit-pattern-plugin(1)>,
L<nbdkit-random-plugin(1)>.
L<nbdkit-zero-plugin(1)>.
diff --git a/plugins/pattern/Makefile.am b/plugins/pattern/Makefile.am
new file mode 100644
index 0000000..da092db
--- /dev/null
+++ b/plugins/pattern/Makefile.am
@@ -0,0 +1,60 @@
+# nbdkit
+# Copyright (C) 2017-2018 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+include $(top_srcdir)/common-rules.mk
+
+EXTRA_DIST = nbdkit-pattern-plugin.pod
+
+plugin_LTLIBRARIES = nbdkit-pattern-plugin.la
+
+nbdkit_pattern_plugin_la_SOURCES = \
+ pattern.c \
+ $(top_srcdir)/include/nbdkit-plugin.h
+
+nbdkit_pattern_plugin_la_CPPFLAGS = \
+ -I$(top_srcdir)/include
+nbdkit_pattern_plugin_la_CFLAGS = \
+ $(WARNINGS_CFLAGS)
+nbdkit_pattern_plugin_la_LDFLAGS = \
+ -module -avoid-version -shared
+
+if HAVE_POD2MAN
+
+man_MANS = nbdkit-pattern-plugin.1
+CLEANFILES += $(man_MANS)
+
+nbdkit-pattern-plugin.1: nbdkit-pattern-plugin.pod
+ $(POD2MAN) $(POD2MAN_ARGS) --section=1 --name=`basename $@ .1` $< $@.t && \
+ if grep 'POD ERROR' $@.t; then rm $@.t; exit 1; fi && \
+ mv $@.t $@
+
+endif
diff --git a/plugins/pattern/nbdkit-pattern-plugin.pod b/plugins/pattern/nbdkit-pattern-plugin.pod
new file mode 100644
index 0000000..7a6b498
--- /dev/null
+++ b/plugins/pattern/nbdkit-pattern-plugin.pod
@@ -0,0 +1,99 @@
+=encoding utf8
+
+=head1 NAME
+
+nbdkit-pattern-plugin - plugin to serve a fixed pattern of data for testing
+
+=head1 SYNOPSIS
+
+ nbdkit pattern size=SIZE
+
+=head1 DESCRIPTION
+
+C<nbdkit-pattern-plugin> is a plugin for L<nbdkit(1)> which serves a
+fixed pattern of data, read only. This is used for testing nbdkit
+filters and NBD clients.
+
+The fixed pattern is the offset, as a 64 bit big endian integer, every
+8 bytes. In hexadecimal this looks like:
+
+ offset data
+ 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08
+ 0010: 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 18
+ 0020: 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 28
+ └──────────┬──────────┘
+ 64 bit big endian int which encodes the offset of
+ the first byte of this int in the file
+
+The size of the virtual disk must be specified using the C<size>
+parameter. If the size is not a multiple of 8 then the last 8 byte
+offset in the pattern is truncated.
+
+=head1 PARAMETERS
+
+=over 4
+
+=item B<size=SIZE>
+
+Specify the virtual size of the disk image.
+
+This parameter is required.
+
+=back
+
+=head1 SEE ALSO
+
+L<nbdkit(1)>,
+L<nbdkit-plugin(3)>,
+L<nbdkit-null-plugin(1)>,
+L<nbdkit-offset-filter(1)>,
+L<nbdkit-random-plugin(1)>,
+L<nbdkit-zero-plugin(1)>.
+
+=head1 AUTHORS
+
+Richard W.M. Jones
+
+=head1 COPYRIGHT
+
+Copyright (C) 2018 Red Hat Inc.
+
+=head1 LICENSE
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+=over 4
+
+=item *
+
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+=item *
+
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+=item *
+
+Neither the name of Red Hat nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+=back
+
+THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/plugins/pattern/pattern.c b/plugins/pattern/pattern.c
new file mode 100644
index 0000000..e1dc798
--- /dev/null
+++ b/plugins/pattern/pattern.c
@@ -0,0 +1,134 @@
+/* nbdkit
+ * Copyright (C) 2017-2018 Red Hat Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Red Hat nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <inttypes.h>
+#include <string.h>
+#include <errno.h>
+#include <time.h>
+
+#define NBDKIT_API_VERSION 2
+#include <nbdkit-plugin.h>
+
+/* The size of disk in bytes (initialized by size=<SIZE> parameter). */
+static size_t size = 0;
+
+static int
+pattern_config (const char *key, const char *value)
+{
+ int64_t r;
+
+ if (strcmp (key, "size") == 0) {
+ r = nbdkit_parse_size (value);
+ if (r == -1)
+ return -1;
+ if (r > SIZE_MAX) {
+ nbdkit_error ("size > SIZE_MAX");
+ return -1;
+ }
+ size = (ssize_t) r;
+ }
+ else {
+ nbdkit_error ("unknown parameter '%s'", key);
+ return -1;
+ }
+
+ return 0;
+}
+
+#define pattern_config_help \
+ "size=<SIZE> (required) Size of the backing disk"
+
+#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL
+
+/* No meaning, just used as the address for the handle. */
+static int ph;
+
+/* Create the per-connection handle. */
+static void *
+pattern_open (int readonly)
+{
+ return &ph;
+}
+
+/* Get the disk size. */
+static int64_t
+pattern_get_size (void *handle)
+{
+ return (int64_t) size;
+}
+
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+/* Read data. */
+static int
+pattern_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
+ uint32_t flags)
+{
+ char *b = buf;
+ uint64_t d;
+ uint64_t o;
+ size_t n;
+
+ while (count > 0) {
+ d = htobe64 (offset & ~7);
+ o = offset & 7;
+ n = MIN (count, 8-o);
+ memcpy (b, (char *)&d + o, n);
+ b += 8-o;
+ offset += 8-o;
+ count -= n;
+ }
+
+ return 0;
+}
+
+static struct nbdkit_plugin plugin = {
+ .name = "pattern",
+ .version = PACKAGE_VERSION,
+ .config = pattern_config,
+ .config_help = pattern_config_help,
+ .open = pattern_open,
+ .get_size = pattern_get_size,
+ .pread = pattern_pread,
+ /* In this plugin, errno is preserved properly along error return
+ * paths from failed system calls.
+ */
+ .errno_is_preserved = 1,
+};
+
+NBDKIT_REGISTER_PLUGIN(plugin)
diff --git a/plugins/random/nbdkit-random-plugin.pod b/plugins/random/nbdkit-random-plugin.pod
index e746699..6539d61 100644
--- a/plugins/random/nbdkit-random-plugin.pod
+++ b/plugins/random/nbdkit-random-plugin.pod
@@ -44,6 +44,7 @@ If not specified then a random seed is chosen.
L<nbdkit(1)>,
L<nbdkit-plugin(3)>,
L<nbdkit-null-plugin(1)>,
+L<nbdkit-pattern-plugin(1)>,
L<nbdkit-zero-plugin(1)>.
=head1 AUTHORS
diff --git a/plugins/zero/nbdkit-zero-plugin.pod b/plugins/zero/nbdkit-zero-plugin.pod
index 67763da..015c70a 100644
--- a/plugins/zero/nbdkit-zero-plugin.pod
+++ b/plugins/zero/nbdkit-zero-plugin.pod
@@ -21,6 +21,7 @@ protocol and NBD clients.
L<nbdkit(1)>,
L<nbdkit-plugin(3)>,
L<nbdkit-null-plugin(1)>,
+L<nbdkit-pattern-plugin(1)>,
L<nbdkit-random-plugin(1)>.
=head1 AUTHORS
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5f21e75..354c12c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -63,6 +63,7 @@ EXTRA_DIST = \
test-ocaml.c \
test-parallel-file.sh \
test-parallel-nbd.sh \
+ test-pattern.sh \
test-python-exception.sh \
test.pl \
test.py \
@@ -315,6 +316,9 @@ test_memory_SOURCES = test-memory.c test.h
test_memory_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
test_memory_LDADD = libtest.la $(LIBGUESTFS_LIBS)
+# pattern plugin test.
+TESTS += test-pattern.sh
+
# nbd plugin test.
LIBGUESTFS_TESTS += test-nbd
diff --git a/tests/test-pattern.sh b/tests/test-pattern.sh
new file mode 100755
index 0000000..2db4e0c
--- /dev/null
+++ b/tests/test-pattern.sh
@@ -0,0 +1,121 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2018 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+# Test the pattern plugin.
+#
+# Note we don't have any client which can issue misaligned NBD
+# requests. qemu-io will issue 512-byte aligned requests no matter
+# what read parameters we give it. Hence these tests are rather
+# limited. (XXX)
+
+set -e
+
+files="pattern.out pattern.pid pattern.sock"
+rm -f $files
+
+# Test that qemu-io works
+if ! qemu-io --help >/dev/null; then
+ echo "$0: missing or broken qemu-io"
+ exit 77
+fi
+
+# Run nbdkit with pattern plugin.
+nbdkit -P pattern.pid -U pattern.sock pattern size=1G
+
+# We may have to wait a short time for the pid file to appear.
+for i in `seq 1 10`; do
+ if test -f pattern.pid; then
+ break
+ fi
+ sleep 1
+done
+if ! test -f pattern.pid; then
+ echo "$0: PID file was not created"
+ exit 1
+fi
+
+pid="$(cat pattern.pid)"
+
+# Kill the nbdkit process on exit.
+cleanup ()
+{
+ status=$?
+
+ kill $pid
+ rm -f $files
+
+ exit $status
+}
+trap cleanup INT QUIT TERM EXIT ERR
+
+qemu-io -r -f raw 'nbd+unix://?socket=pattern.sock' \
+ -c 'r -v 0 512' | grep -E '^[[:xdigit:]]+:' > pattern.out
+if [ "$(cat pattern.out)" != "00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 ................
+00000010: 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 18 ................
+00000020: 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 28 ................
+00000030: 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 38 .......0.......8
+00000040: 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 48 ...............H
+00000050: 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 58 .......P.......X
+00000060: 00 00 00 00 00 00 00 60 00 00 00 00 00 00 00 68 ...............h
+00000070: 00 00 00 00 00 00 00 70 00 00 00 00 00 00 00 78 .......p.......x
+00000080: 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 88 ................
+00000090: 00 00 00 00 00 00 00 90 00 00 00 00 00 00 00 98 ................
+000000a0: 00 00 00 00 00 00 00 a0 00 00 00 00 00 00 00 a8 ................
+000000b0: 00 00 00 00 00 00 00 b0 00 00 00 00 00 00 00 b8 ................
+000000c0: 00 00 00 00 00 00 00 c0 00 00 00 00 00 00 00 c8 ................
+000000d0: 00 00 00 00 00 00 00 d0 00 00 00 00 00 00 00 d8 ................
+000000e0: 00 00 00 00 00 00 00 e0 00 00 00 00 00 00 00 e8 ................
+000000f0: 00 00 00 00 00 00 00 f0 00 00 00 00 00 00 00 f8 ................
+00000100: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 08 ................
+00000110: 00 00 00 00 00 00 01 10 00 00 00 00 00 00 01 18 ................
+00000120: 00 00 00 00 00 00 01 20 00 00 00 00 00 00 01 28 ................
+00000130: 00 00 00 00 00 00 01 30 00 00 00 00 00 00 01 38 .......0.......8
+00000140: 00 00 00 00 00 00 01 40 00 00 00 00 00 00 01 48 ...............H
+00000150: 00 00 00 00 00 00 01 50 00 00 00 00 00 00 01 58 .......P.......X
+00000160: 00 00 00 00 00 00 01 60 00 00 00 00 00 00 01 68 ...............h
+00000170: 00 00 00 00 00 00 01 70 00 00 00 00 00 00 01 78 .......p.......x
+00000180: 00 00 00 00 00 00 01 80 00 00 00 00 00 00 01 88 ................
+00000190: 00 00 00 00 00 00 01 90 00 00 00 00 00 00 01 98 ................
+000001a0: 00 00 00 00 00 00 01 a0 00 00 00 00 00 00 01 a8 ................
+000001b0: 00 00 00 00 00 00 01 b0 00 00 00 00 00 00 01 b8 ................
+000001c0: 00 00 00 00 00 00 01 c0 00 00 00 00 00 00 01 c8 ................
+000001d0: 00 00 00 00 00 00 01 d0 00 00 00 00 00 00 01 d8 ................
+000001e0: 00 00 00 00 00 00 01 e0 00 00 00 00 00 00 01 e8 ................
+000001f0: 00 00 00 00 00 00 01 f0 00 00 00 00 00 00 01 f8 ................" ]
+then
+ echo "$0: unexpected pattern:"
+ cat pattern.out
+ exit 1
+fi
+
+# The cleanup() function is called implicitly on exit.
--
2.17.1

View File

@ -1,166 +0,0 @@
From 97a5e57037aa0130a1e46aa6162171d941a58d62 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 7 Jul 2018 14:10:11 +0100
Subject: [PATCH 06/12] tests: Add a second test of the offset filter.
This tests that the offset filter works for non-aligned offsets and
that nbdkit can handle virtual disks which are ~ 2^63 bits in size.
Implemented using the pattern plugin.
---
tests/Makefile.am | 3 ++
tests/test-offset2.sh | 121 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 124 insertions(+)
create mode 100755 tests/test-offset2.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 354c12c..6c3a5a6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -61,6 +61,7 @@ EXTRA_DIST = \
test-nozero.sh \
test_ocaml_plugin.ml \
test-ocaml.c \
+ test-offset2.sh \
test-parallel-file.sh \
test-parallel-nbd.sh \
test-pattern.sh \
@@ -539,6 +540,8 @@ test_offset_SOURCES = test-offset.c test.h
test_offset_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
test_offset_LDADD = libtest.la $(LIBGUESTFS_LIBS)
+TESTS += test-offset2.sh
+
# partition filter test.
LIBGUESTFS_TESTS += test-partition
diff --git a/tests/test-offset2.sh b/tests/test-offset2.sh
new file mode 100755
index 0000000..a4f44cc
--- /dev/null
+++ b/tests/test-offset2.sh
@@ -0,0 +1,121 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2018 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+# Additional test of the offset filter using the pattern plugin.
+
+set -e
+set -x
+
+files="offset2.out offset2.pid offset2.sock"
+rm -f $files
+
+# Test that qemu-io works
+if ! qemu-io --help >/dev/null; then
+ echo "$0: missing or broken qemu-io"
+ exit 77
+fi
+
+# Run nbdkit with pattern plugin and offset filter in front.
+# 8070450532247927809 = 7E - 1023
+nbdkit -P offset2.pid -U offset2.sock \
+ --filter=offset \
+ pattern size=7E \
+ offset=8070450532247927809 range=512
+
+# We may have to wait a short time for the pid file to appear.
+for i in `seq 1 10`; do
+ if test -f offset2.pid; then
+ break
+ fi
+ sleep 1
+done
+if ! test -f offset2.pid; then
+ echo "$0: PID file was not created"
+ exit 1
+fi
+
+pid="$(cat offset2.pid)"
+
+# Kill the nbdkit process on exit.
+cleanup ()
+{
+ status=$?
+
+ kill $pid
+ rm -f $files
+
+ exit $status
+}
+trap cleanup INT QUIT TERM EXIT ERR
+
+qemu-io -r -f raw 'nbd+unix://?socket=offset2.sock' \
+ -c 'r -v 0 512' | grep -E '^[[:xdigit:]]+:' > offset2.out
+if [ "$(cat offset2.out)" != "00000000: ff ff ff ff ff fc 00 6f ff ff ff ff ff fc 08 6f .......o.......o
+00000010: ff ff ff ff ff fc 10 6f ff ff ff ff ff fc 18 6f .......o.......o
+00000020: ff ff ff ff ff fc 20 6f ff ff ff ff ff fc 28 6f .......o.......o
+00000030: ff ff ff ff ff fc 30 6f ff ff ff ff ff fc 38 6f ......0o......8o
+00000040: ff ff ff ff ff fc 40 6f ff ff ff ff ff fc 48 6f .......o......Ho
+00000050: ff ff ff ff ff fc 50 6f ff ff ff ff ff fc 58 6f ......Po......Xo
+00000060: ff ff ff ff ff fc 60 6f ff ff ff ff ff fc 68 6f .......o......ho
+00000070: ff ff ff ff ff fc 70 6f ff ff ff ff ff fc 78 6f ......po......xo
+00000080: ff ff ff ff ff fc 80 6f ff ff ff ff ff fc 88 6f .......o.......o
+00000090: ff ff ff ff ff fc 90 6f ff ff ff ff ff fc 98 6f .......o.......o
+000000a0: ff ff ff ff ff fc a0 6f ff ff ff ff ff fc a8 6f .......o.......o
+000000b0: ff ff ff ff ff fc b0 6f ff ff ff ff ff fc b8 6f .......o.......o
+000000c0: ff ff ff ff ff fc c0 6f ff ff ff ff ff fc c8 6f .......o.......o
+000000d0: ff ff ff ff ff fc d0 6f ff ff ff ff ff fc d8 6f .......o.......o
+000000e0: ff ff ff ff ff fc e0 6f ff ff ff ff ff fc e8 6f .......o.......o
+000000f0: ff ff ff ff ff fc f0 6f ff ff ff ff ff fc f8 6f .......o.......o
+00000100: ff ff ff ff ff fd 00 6f ff ff ff ff ff fd 08 6f .......o.......o
+00000110: ff ff ff ff ff fd 10 6f ff ff ff ff ff fd 18 6f .......o.......o
+00000120: ff ff ff ff ff fd 20 6f ff ff ff ff ff fd 28 6f .......o.......o
+00000130: ff ff ff ff ff fd 30 6f ff ff ff ff ff fd 38 6f ......0o......8o
+00000140: ff ff ff ff ff fd 40 6f ff ff ff ff ff fd 48 6f .......o......Ho
+00000150: ff ff ff ff ff fd 50 6f ff ff ff ff ff fd 58 6f ......Po......Xo
+00000160: ff ff ff ff ff fd 60 6f ff ff ff ff ff fd 68 6f .......o......ho
+00000170: ff ff ff ff ff fd 70 6f ff ff ff ff ff fd 78 6f ......po......xo
+00000180: ff ff ff ff ff fd 80 6f ff ff ff ff ff fd 88 6f .......o.......o
+00000190: ff ff ff ff ff fd 90 6f ff ff ff ff ff fd 98 6f .......o.......o
+000001a0: ff ff ff ff ff fd a0 6f ff ff ff ff ff fd a8 6f .......o.......o
+000001b0: ff ff ff ff ff fd b0 6f ff ff ff ff ff fd b8 6f .......o.......o
+000001c0: ff ff ff ff ff fd c0 6f ff ff ff ff ff fd c8 6f .......o.......o
+000001d0: ff ff ff ff ff fd d0 6f ff ff ff ff ff fd d8 6f .......o.......o
+000001e0: ff ff ff ff ff fd e0 6f ff ff ff ff ff fd e8 6f .......o.......o
+000001f0: ff ff ff ff ff fd f0 6f ff ff ff ff ff fd f8 6f .......o.......o" ]
+then
+ echo "$0: unexpected pattern:"
+ cat offset2.out
+ exit 1
+fi
+
+# The cleanup() function is called implicitly on exit.
--
2.17.1

View File

@ -1,169 +0,0 @@
From 4e1a521228115c04cc7c5a2f625218a9bbd5101f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 11:46:12 +0100
Subject: [PATCH 07/12] tests: Test largest possible plugin size.
This test is incomplete because it is too large for qemu to open.
However at least we are testing that nbdkit works.
Implemented using the pattern plugin.
---
plugins/pattern/nbdkit-pattern-plugin.pod | 13 +++
tests/Makefile.am | 3 +-
tests/test-pattern-largest.sh | 99 +++++++++++++++++++++++
3 files changed, 114 insertions(+), 1 deletion(-)
create mode 100755 tests/test-pattern-largest.sh
diff --git a/plugins/pattern/nbdkit-pattern-plugin.pod b/plugins/pattern/nbdkit-pattern-plugin.pod
index 7a6b498..425cae6 100644
--- a/plugins/pattern/nbdkit-pattern-plugin.pod
+++ b/plugins/pattern/nbdkit-pattern-plugin.pod
@@ -29,6 +29,19 @@ The size of the virtual disk must be specified using the C<size>
parameter. If the size is not a multiple of 8 then the last 8 byte
offset in the pattern is truncated.
+=head2 Largest possible size
+
+nbdkit itself limits plugins to S<2⁶³-1> bytes
+(S<decimal: 9223372036854775807>,
+S<hexadecimal: 0x7fff_ffff_ffff_ffff>).
+
+To test if NBD clients are free of bugs (not to mention nbdkit itself)
+you can use:
+
+ nbdkit pattern size=9223372036854775807
+
+Note this is too large for qemu to open.
+
=head1 PARAMETERS
=over 4
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6c3a5a6..9dd451d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -65,6 +65,7 @@ EXTRA_DIST = \
test-parallel-file.sh \
test-parallel-nbd.sh \
test-pattern.sh \
+ test-pattern-largest.sh \
test-python-exception.sh \
test.pl \
test.py \
@@ -318,7 +319,7 @@ test_memory_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
test_memory_LDADD = libtest.la $(LIBGUESTFS_LIBS)
# pattern plugin test.
-TESTS += test-pattern.sh
+TESTS += test-pattern.sh test-pattern-largest.sh
# nbd plugin test.
LIBGUESTFS_TESTS += test-nbd
diff --git a/tests/test-pattern-largest.sh b/tests/test-pattern-largest.sh
new file mode 100755
index 0000000..5ff891f
--- /dev/null
+++ b/tests/test-pattern-largest.sh
@@ -0,0 +1,99 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2018 Red Hat Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+# Test the pattern plugin with the largest possible size supported
+# by nbdkit.
+
+set -e
+
+files="pattern-largest.out pattern-largest.pid pattern-largest.sock"
+rm -f $files
+
+# Test that qemu-io works
+if ! qemu-io --help >/dev/null; then
+ echo "$0: missing or broken qemu-io"
+ exit 77
+fi
+
+# Run nbdkit with pattern plugin.
+# size = 2^63-1
+nbdkit -P pattern-largest.pid -U pattern-largest.sock \
+ pattern size=9223372036854775807
+
+# We may have to wait a short time for the pid file to appear.
+for i in `seq 1 10`; do
+ if test -f pattern-largest.pid; then
+ break
+ fi
+ sleep 1
+done
+if ! test -f pattern-largest.pid; then
+ echo "$0: PID file was not created"
+ exit 1
+fi
+
+pid="$(cat pattern-largest.pid)"
+
+# Kill the nbdkit process on exit.
+cleanup ()
+{
+ status=$?
+
+ kill $pid
+ rm -f $files
+
+ exit $status
+}
+trap cleanup INT QUIT TERM EXIT ERR
+
+# qemu cannot open this image!
+#
+# can't open device nbd+unix://?socket=pattern-largest.sock: Could not get image size: File too large
+#
+# Therefore we skip the remainder of this test (in effect, testing
+# only that nbdkit can create the file).
+exit 77
+
+# XXX Unfortunately qemu-io can only issue 512-byte aligned requests,
+# and the final block is only 511 bytes, so we have to request the 512
+# bytes before that block.
+qemu-io -r -f raw 'nbd+unix://?socket=pattern-largest.sock' \
+ -c 'r -v 9223372036854774784 512' | grep -E '^[[:xdigit:]]+:' > pattern-largest.out
+if [ "$(cat pattern-largest.out)" != "XXX EXPECTED PATTERN HERE" ]
+then
+ echo "$0: unexpected pattern:"
+ cat pattern-largest.out
+ exit 1
+fi
+
+# The cleanup() function is called implicitly on exit.
--
2.17.1

View File

@ -1,25 +0,0 @@
From 4c3ea9514184958c356ff6f613d43b896cb26b0e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 15:15:44 +0100
Subject: [PATCH 08/12] docs: Fix broken cross-reference in man page.
---
docs/nbdkit-filter.pod.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/nbdkit-filter.pod.in b/docs/nbdkit-filter.pod.in
index 4621106..16be2c7 100644
--- a/docs/nbdkit-filter.pod.in
+++ b/docs/nbdkit-filter.pod.in
@@ -591,7 +591,7 @@ which defines C<$(NBDKIT_FILTERDIR)> in automake-generated Makefiles.
=head1 SEE ALSO
L<nbdkit(1)>,
-L<nbdkit-plugin(1)>.
+L<nbdkit-plugin(3)>.
Standard filters provided by nbdkit:
--
2.17.1

View File

@ -1,103 +0,0 @@
From cf495ffb975d4557a6092a19f382a9a69b457300 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 16:26:18 +0100
Subject: [PATCH 09/12] docs: Break up some over-long lines in documentation.
We will enforce a limit of 76 chars (in most cases) in a future
commit.
---
plugins/ext2/nbdkit-ext2-plugin.pod | 3 ++-
plugins/lua/nbdkit-lua-plugin.pod | 3 ++-
plugins/perl/nbdkit-perl-plugin.pod | 3 ++-
plugins/python/nbdkit-python-plugin.pod | 3 ++-
plugins/ruby/nbdkit-ruby-plugin.pod | 3 ++-
plugins/tcl/nbdkit-tcl-plugin.pod | 3 ++-
6 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/plugins/ext2/nbdkit-ext2-plugin.pod b/plugins/ext2/nbdkit-ext2-plugin.pod
index 29c76aa..7479ebe 100644
--- a/plugins/ext2/nbdkit-ext2-plugin.pod
+++ b/plugins/ext2/nbdkit-ext2-plugin.pod
@@ -2,7 +2,8 @@
=head1 NAME
-nbdkit-ext2-plugin - Read and write files inside ext2, ext3 or ext4 filesystems
+nbdkit-ext2-plugin - Read and write files inside ext2, ext3 or
+ext4 filesystems
=head1 SYNOPSIS
diff --git a/plugins/lua/nbdkit-lua-plugin.pod b/plugins/lua/nbdkit-lua-plugin.pod
index 385a0e4..dfeef4f 100644
--- a/plugins/lua/nbdkit-lua-plugin.pod
+++ b/plugins/lua/nbdkit-lua-plugin.pod
@@ -260,7 +260,8 @@ partial, your function should call C<error>.
=over 4
-=item Missing: C<load>, C<unload>, C<name>, C<version>, C<longname>, C<description>, C<config_help>, C<can_zero>, C<can_fua>
+=item Missing: C<load>, C<unload>, C<name>, C<version>, C<longname>,
+C<description>, C<config_help>, C<can_zero>, C<can_fua>
These are not yet supported.
diff --git a/plugins/perl/nbdkit-perl-plugin.pod b/plugins/perl/nbdkit-perl-plugin.pod
index 0fc7f93..ce8bb51 100644
--- a/plugins/perl/nbdkit-perl-plugin.pod
+++ b/plugins/perl/nbdkit-perl-plugin.pod
@@ -339,7 +339,8 @@ C<Nbdkit::set_error(POSIX::EOPNOTSUPP)>.
These are not needed because you can just use regular Perl C<BEGIN>
and C<END> constructs.
-=item Missing: C<name>, C<version>, C<longname>, C<description>, C<config_help>
+=item Missing: C<name>, C<version>, C<longname>, C<description>,
+C<config_help>
These are not yet supported.
diff --git a/plugins/python/nbdkit-python-plugin.pod b/plugins/python/nbdkit-python-plugin.pod
index e54df1f..c80af9b 100644
--- a/plugins/python/nbdkit-python-plugin.pod
+++ b/plugins/python/nbdkit-python-plugin.pod
@@ -258,7 +258,8 @@ use C<nbdkit.set_error(errno.EOPNOTSUPP)>.
These are not needed because you can just use ordinary Python
constructs.
-=item Missing: C<name>, C<version>, C<longname>, C<description>, C<config_help>
+=item Missing: C<name>, C<version>, C<longname>, C<description>,
+C<config_help>
These are not yet supported.
diff --git a/plugins/ruby/nbdkit-ruby-plugin.pod b/plugins/ruby/nbdkit-ruby-plugin.pod
index 505af69..29d072a 100644
--- a/plugins/ruby/nbdkit-ruby-plugin.pod
+++ b/plugins/ruby/nbdkit-ruby-plugin.pod
@@ -273,7 +273,8 @@ use C<Nbdkit.set_error(Errno::EOPNOTSUPP)>.
These are not needed because you can just use ordinary Ruby
constructs.
-=item Missing: C<name>, C<version>, C<longname>, C<description>, C<config_help>
+=item Missing: C<name>, C<version>, C<longname>, C<description>,
+C<config_help>
These are not yet supported.
diff --git a/plugins/tcl/nbdkit-tcl-plugin.pod b/plugins/tcl/nbdkit-tcl-plugin.pod
index 434233d..17b5c5f 100644
--- a/plugins/tcl/nbdkit-tcl-plugin.pod
+++ b/plugins/tcl/nbdkit-tcl-plugin.pod
@@ -266,7 +266,8 @@ partial, your function should call C<error>.
=over 4
-=item Missing: C<load>, C<unload>, C<name>, C<version>, C<longname>, C<description>, C<config_help>, C<can_zero>, C<can_fua>
+=item Missing: C<load>, C<unload>, C<name>, C<version>, C<longname>,
+C<description>, C<config_help>, C<can_zero>, C<can_fua>
These are not yet supported.
--
2.17.1

File diff suppressed because it is too large Load Diff

View File

@ -1,230 +0,0 @@
From 730f8388467426bfd061151205d93391c942b86a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 17:26:59 +0100
Subject: [PATCH 11/12] Rework README file.
---
README | 119 +++++++++++++++++++++++++++++++--------------------------
1 file changed, 65 insertions(+), 54 deletions(-)
diff --git a/README b/README
index 685b41f..5114b31 100644
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
-NBD is a protocol for accessing Block Devices (hard disks and
-disk-like things) over a Network.
+NBD — Network Block Device — is a protocol for accessing Block Devices
+(hard disks and disk-like things) over a Network.
-'nbdkit' is a toolkit for creating NBD servers.
+nbdkit is a toolkit for creating NBD servers.
The key features are:
@@ -13,24 +13,39 @@ The key features are:
libraries or included in proprietary code.
* Well-documented, simple plugin API with a stable ABI guarantee.
- Lets you export "unconventional" block devices easily.
+ Lets you export “unconventional” block devices easily.
* You can write plugins in C, Lua, Perl, Python, OCaml, Ruby or Tcl.
-For documentation, see the docs/ directory.
+ * Filters can be stacked in front of plugins to transform the output.
-For plugins and examples, see the plugins/ directory.
+For documentation, see the docs/ directory.
-License
--------
+For plugins, examples and filters, see the plugins/ and filters/
+directories.
+
+LICENSE
+=======
This software is copyright (C) Red Hat Inc. and licensed under a BSD
-license. See LICENSE for details.
+license. See LICENSE for details.
-Building from source
---------------------
+BUILDING FROM SOURCE
+====================
-By default nbdkit needs nothing except Linux and reasonably recent gcc.
+Requirements
+------------
+
+To build the basic server and some plugins nbdkit needs nothing except
+Linux and reasonably recent gcc.
+
+Although it is possible to build without it, its recommended to
+enable TLS support for which you will need:
+
+ - gnutls >= 3.3.0
+
+Optional dependencies
+---------------------
To build the man pages, you will optionally need to install:
@@ -38,13 +53,6 @@ To build the man pages, you will optionally need to install:
- Pod::Man and Pod::Simple (perl library)
-There are some *optional* libraries you may want to install for
-plugins or extra features.
-
-For TLS support:
-
- - gnutls >= 3.3.0
-
For the gzip plugin:
- zlib
@@ -79,19 +87,22 @@ For the VDDK plugin:
For the Perl, example4 and tar plugins:
+ - perl interpreter
+
- perl development libraries
- perl module ExtUtils::Embed
For the Python plugin:
- - python development libraries
+ - python interpreter
(either version 2 or 3 may be used)
+ - python development libraries
+
For the OCaml plugin:
- - OCaml >= 4.02.2 which has support for shared libraries, see:
- http://caml.inria.fr/mantis/view.php?id=6693
+ - OCaml >= 4.02.2
For the Tcl plugin:
@@ -109,81 +120,81 @@ To run the test suite:
- bash
-To test for memory leaks ('make check-valgrind'):
+To test for memory leaks (make check-valgrind):
- valgrind program and development headers
For non-essential enhancements to the test suite:
+ - qemu-io (usually shipped with qemu)
+
- socat
- ss (from iproute package)
-After installing any dependencies:
+Building
+--------
- To build from tarball: To build from git:
- ---------------------- ------------------
- autoreconf -i
- ./configure ./configure
- make make
- make check make check
+ To build from tarball: To build from git:
+ ---------------------- ------------------
+ autoreconf -i
+ ./configure ./configure
+ make make
+ make check make check
To run nbdkit from the source directory, use the top level ./nbdkit
script. It will run nbdkit and plugins from the locally compiled
directory:
- $ ./nbdkit example1 -f -v
- ./src/nbdkit ./plugins/example1/.libs/nbdkit-example1-plugin.so -f -v
- [etc]
+ $ ./nbdkit example1 -f -v
+ ./src/nbdkit ./plugins/example1/.libs/nbdkit-example1-plugin.so -f -v
+ [etc]
Optionally run this command as root to install everything:
- make install
+ make install
Python
------
By default nbdkit uses the Python version of the Python interpreter
-called "python" on the current $PATH. To use another version of
+called “python” on the current $PATH. To use another version of
Python you may need to set the PYTHON variable when configuring. For
example:
- ./configure PYTHON=/usr/bin/python3
+ ./configure PYTHON=/usr/bin/python3
-Tests
------
+Running the tests
+-----------------
You will need to install libguestfs to run most of the test suite:
- make check
+ make check
The test suite is fairly comprehensive. It runs the newly built
nbdkit + plugins as a captive process, and tests them using
libguestfs. If there is a failure, look at the corresponding
-tests/*.log file for debug information.
+tests/*.log file for debug information.
-Developers
-----------
+DOWNLOAD TARBALLS
+=================
+
+Tarballs are available from:
+http://libguestfs.org/download/nbdkit
+
+DEVELOPERS
+==========
Install the valgrind program and development headers.
Use:
- ./configure --enable-gcc-warnings --enable-valgrind
+ ./configure --enable-gcc-warnings --enable-valgrind
When testing use:
- make check
- make check-valgrind
-
-Packager information
---------------------
-
-Tarballs are available from:
-http://libguestfs.org/download/nbdkit
-
-Developer information
----------------------
+ make check
+ make check-valgrind
For development ideas, see the TODO file.
--
2.17.1

View File

@ -1,142 +0,0 @@
From 0c710f36c5e686ae0f02c67dc6b19e1622e23d8a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 17:32:22 +0100
Subject: [PATCH 12/12] null, pattern, random: Make these plugins work on 32
bit machines.
These plugins had copied code from the nbdkit-memory-plugin. The
memory plugin needs to store actual data in an array so uses size_t.
However these other plugins don't have to store anything and so shoule
use int64_t, enabling them to work on 32 bit platforms.
---
plugins/null/null.c | 10 +++-------
plugins/pattern/pattern.c | 12 ++++--------
plugins/random/random.c | 12 ++++--------
3 files changed, 11 insertions(+), 23 deletions(-)
diff --git a/plugins/null/null.c b/plugins/null/null.c
index 905cc64..1daafac 100644
--- a/plugins/null/null.c
+++ b/plugins/null/null.c
@@ -44,7 +44,7 @@
#include <nbdkit-plugin.h>
/* The size of disk in bytes (initialized by size=<SIZE> parameter). */
-static size_t size = 0;
+static int64_t size = 0;
static int
null_config (const char *key, const char *value)
@@ -55,11 +55,7 @@ null_config (const char *key, const char *value)
r = nbdkit_parse_size (value);
if (r == -1)
return -1;
- if (r > SIZE_MAX) {
- nbdkit_error ("size > SIZE_MAX");
- return -1;
- }
- size = (ssize_t) r;
+ size = r;
}
else {
nbdkit_error ("unknown parameter '%s'", key);
@@ -108,7 +104,7 @@ null_close (void *handle)
static int64_t
null_get_size (void *handle)
{
- return (int64_t) size;
+ return size;
}
/* Read data. */
diff --git a/plugins/pattern/pattern.c b/plugins/pattern/pattern.c
index e1dc798..11b258d 100644
--- a/plugins/pattern/pattern.c
+++ b/plugins/pattern/pattern.c
@@ -45,7 +45,7 @@
#include <nbdkit-plugin.h>
/* The size of disk in bytes (initialized by size=<SIZE> parameter). */
-static size_t size = 0;
+static int64_t size = 0;
static int
pattern_config (const char *key, const char *value)
@@ -56,11 +56,7 @@ pattern_config (const char *key, const char *value)
r = nbdkit_parse_size (value);
if (r == -1)
return -1;
- if (r > SIZE_MAX) {
- nbdkit_error ("size > SIZE_MAX");
- return -1;
- }
- size = (ssize_t) r;
+ size = r;
}
else {
nbdkit_error ("unknown parameter '%s'", key);
@@ -89,7 +85,7 @@ pattern_open (int readonly)
static int64_t
pattern_get_size (void *handle)
{
- return (int64_t) size;
+ return size;
}
#define MIN(a, b) ((a) < (b) ? (a) : (b))
@@ -102,7 +98,7 @@ pattern_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
char *b = buf;
uint64_t d;
uint64_t o;
- size_t n;
+ uint32_t n;
while (count > 0) {
d = htobe64 (offset & ~7);
diff --git a/plugins/random/random.c b/plugins/random/random.c
index 185609d..8adc26e 100644
--- a/plugins/random/random.c
+++ b/plugins/random/random.c
@@ -45,7 +45,7 @@
#include <nbdkit-plugin.h>
/* The size of disk in bytes (initialized by size=<SIZE> parameter). */
-static size_t size = 0;
+static int64_t size = 0;
/* Seed. */
static uint32_t seed;
@@ -95,11 +95,7 @@ random_config (const char *key, const char *value)
r = nbdkit_parse_size (value);
if (r == -1)
return -1;
- if (r > SIZE_MAX) {
- nbdkit_error ("size > SIZE_MAX");
- return -1;
- }
- size = (ssize_t) r;
+ size = r;
}
else {
nbdkit_error ("unknown parameter '%s'", key);
@@ -129,7 +125,7 @@ random_open (int readonly)
static int64_t
random_get_size (void *handle)
{
- return (int64_t) size;
+ return size;
}
/* Read data. */
@@ -137,7 +133,7 @@ static int
random_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
uint32_t flags)
{
- size_t i;
+ uint32_t i;
unsigned char *b = buf;
uint32_t s;
--
2.17.1

View File

@ -26,8 +26,8 @@
%global source_directory 1.5-development
Name: nbdkit
Version: 1.5.0
Release: 3%{?dist}
Version: 1.5.1
Release: 1%{?dist}
Summary: NBD server
License: BSD
@ -40,18 +40,6 @@ Source1: http://libguestfs.org/download/nbdkit/%{source_directory}/%{name
Source2: libguestfs.keyring
%endif
Patch0001: 0001-bash-Don-t-define-bashcompdir-twice.patch
Patch0002: 0002-xz-Minor-rewrites-to-improve-the-flow-of-the-man-pag.patch
Patch0003: 0003-streaming-Add-illustrations-to-the-man-page.patch
Patch0004: 0004-tests-Put-test.lua-into-alphabetical-order-in-the-li.patch
Patch0005: 0005-Add-pattern-plugin.patch
Patch0006: 0006-tests-Add-a-second-test-of-the-offset-filter.patch
Patch0007: 0007-tests-Test-largest-possible-plugin-size.patch
Patch0008: 0008-docs-Fix-broken-cross-reference-in-man-page.patch
Patch0009: 0009-docs-Break-up-some-over-long-lines-in-documentation.patch
Patch0010: 0010-docs-Add-podwrapper-from-libguestfs.patch
Patch0011: 0011-Rework-README-file.patch
Patch0012: 0012-null-pattern-random-Make-these-plugins-work-on-32-bi.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool
%endif
@ -781,6 +769,9 @@ popd
%changelog
* Fri Jul 20 2018 Richard W.M. Jones <rjones@redhat.com> - 1.5.1-1
- New upstream version 1.5.1.
- Remove patches, all upstream in this version.
- Small refactorings in the spec file.
* Sun Jul 15 2018 Richard W.M. Jones <rjones@redhat.com> - 1.5.0-3

View File

@ -1,2 +1,2 @@
SHA512 (nbdkit-1.5.0.tar.gz) = a3fa45d3d01137eb641f724a3d4ddcd85bc42bbf3776a1494cd91e25a9122b188943d0cb3f0ac65b1cd27faf7c540eed71e5a70421548d133b769f85dbb6bb59
SHA512 (nbdkit-1.5.0.tar.gz.sig) = 82b811053d69290d82a2804d67ceb3af8c18ba670d83aa4a9ac224a29e1f030bccad7d827af8de03ffab3fd5daa5e1a6344f6702b33ca8ed5ab5e0d6f0b01221
SHA512 (nbdkit-1.5.1.tar.gz) = 7011b59fe36271281831b00122a90003408fd9ab1cbf5b41d836a2e339650e7c0753efff29fe0f13117a16f4fa2848f5fe31611033532e34f2f671c299963f2c
SHA512 (nbdkit-1.5.1.tar.gz.sig) = 8cc16bb9cba6ba77bffeba6b12e0135ce87f0b88fc09f8d8fa0a4477b5755d260dce5a010143e9497837a5ca80f366797f6ed2e784747c85211c68465de52ffe