Add fixes for 32 bit platforms i686 and armv7.

This commit is contained in:
Richard W.M. Jones 2018-07-15 17:36:29 +01:00
parent e84c5f9b82
commit 1490385403
13 changed files with 385 additions and 10 deletions

View File

@ -1,7 +1,7 @@
From ef13e7db5d9d8e5ff6977821c3e798bb6c7725d9 Mon Sep 17 00:00:00 2001 From ef13e7db5d9d8e5ff6977821c3e798bb6c7725d9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 10 Jul 2018 10:28:44 +0100 Date: Tue, 10 Jul 2018 10:28:44 +0100
Subject: [PATCH 01/10] bash: Don't define bashcompdir twice. Subject: [PATCH 01/12] bash: Don't define bashcompdir twice.
--- ---
bash/Makefile.am | 1 - bash/Makefile.am | 1 -

View File

@ -1,7 +1,7 @@
From 9fb8c7b550cddb6504386a8776e0abaeac4c1f20 Mon Sep 17 00:00:00 2001 From 9fb8c7b550cddb6504386a8776e0abaeac4c1f20 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 14 Jul 2018 21:25:13 +0100 Date: Sat, 14 Jul 2018 21:25:13 +0100
Subject: [PATCH 02/10] xz: Minor rewrites to improve the flow of the man page. Subject: [PATCH 02/12] xz: Minor rewrites to improve the flow of the man page.
--- ---
plugins/xz/nbdkit-xz-plugin.pod | 26 ++++++++++++++------------ plugins/xz/nbdkit-xz-plugin.pod | 26 ++++++++++++++------------

View File

@ -1,7 +1,7 @@
From 166be40fa335649caf2615b384cc006d92bc5170 Mon Sep 17 00:00:00 2001 From 166be40fa335649caf2615b384cc006d92bc5170 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 11:14:49 +0100 Date: Sun, 15 Jul 2018 11:14:49 +0100
Subject: [PATCH 03/10] streaming: Add illustrations to the man page. Subject: [PATCH 03/12] streaming: Add illustrations to the man page.
Also improve the flow of the language and provide cross-reference to Also improve the flow of the language and provide cross-reference to
captive nbdkit. captive nbdkit.

View File

@ -1,7 +1,7 @@
From bc3b8c27b40165af6d7dcca15dfae98cbf7566e8 Mon Sep 17 00:00:00 2001 From bc3b8c27b40165af6d7dcca15dfae98cbf7566e8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 11:51:39 +0100 Date: Sun, 15 Jul 2018 11:51:39 +0100
Subject: [PATCH 04/10] tests: Put test.lua into alphabetical order in the Subject: [PATCH 04/12] tests: Put test.lua into alphabetical order in the
list. list.
Fixes commit ff2b304e9c5ddef01081b9aef113bf0cf6dfabac. Fixes commit ff2b304e9c5ddef01081b9aef113bf0cf6dfabac.

View File

@ -1,7 +1,7 @@
From 0a9205dc8c3b5d5703bd71bc58db503c05b0063b Mon Sep 17 00:00:00 2001 From 0a9205dc8c3b5d5703bd71bc58db503c05b0063b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 7 Jul 2018 13:30:32 +0100 Date: Sat, 7 Jul 2018 13:30:32 +0100
Subject: [PATCH 05/10] Add pattern plugin. Subject: [PATCH 05/12] Add pattern plugin.
This generates a simple, fixed test pattern which can be used to test This generates a simple, fixed test pattern which can be used to test
nbdkit filters (especially nbdkit-offset-filter), and also NBD nbdkit filters (especially nbdkit-offset-filter), and also NBD

View File

@ -1,7 +1,7 @@
From 97a5e57037aa0130a1e46aa6162171d941a58d62 Mon Sep 17 00:00:00 2001 From 97a5e57037aa0130a1e46aa6162171d941a58d62 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 7 Jul 2018 14:10:11 +0100 Date: Sat, 7 Jul 2018 14:10:11 +0100
Subject: [PATCH 06/10] tests: Add a second test of the offset filter. 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 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. that nbdkit can handle virtual disks which are ~ 2^63 bits in size.

View File

@ -1,7 +1,7 @@
From 4e1a521228115c04cc7c5a2f625218a9bbd5101f Mon Sep 17 00:00:00 2001 From 4e1a521228115c04cc7c5a2f625218a9bbd5101f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 11:46:12 +0100 Date: Sun, 15 Jul 2018 11:46:12 +0100
Subject: [PATCH 07/10] tests: Test largest possible plugin size. Subject: [PATCH 07/12] tests: Test largest possible plugin size.
This test is incomplete because it is too large for qemu to open. This test is incomplete because it is too large for qemu to open.
However at least we are testing that nbdkit works. However at least we are testing that nbdkit works.

View File

@ -1,7 +1,7 @@
From 4c3ea9514184958c356ff6f613d43b896cb26b0e Mon Sep 17 00:00:00 2001 From 4c3ea9514184958c356ff6f613d43b896cb26b0e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 15:15:44 +0100 Date: Sun, 15 Jul 2018 15:15:44 +0100
Subject: [PATCH 08/10] docs: Fix broken cross-reference in man page. Subject: [PATCH 08/12] docs: Fix broken cross-reference in man page.
--- ---
docs/nbdkit-filter.pod.in | 2 +- docs/nbdkit-filter.pod.in | 2 +-

View File

@ -1,7 +1,7 @@
From cf495ffb975d4557a6092a19f382a9a69b457300 Mon Sep 17 00:00:00 2001 From cf495ffb975d4557a6092a19f382a9a69b457300 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 16:26:18 +0100 Date: Sun, 15 Jul 2018 16:26:18 +0100
Subject: [PATCH 09/10] docs: Break up some over-long lines in documentation. 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 We will enforce a limit of 76 chars (in most cases) in a future
commit. commit.

View File

@ -1,7 +1,7 @@
From 24a0a8ced608395b614ad42ae550588e08d3c636 Mon Sep 17 00:00:00 2001 From 24a0a8ced608395b614ad42ae550588e08d3c636 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 15 Jul 2018 14:13:53 +0100 Date: Sun, 15 Jul 2018 14:13:53 +0100
Subject: [PATCH 10/10] docs: Add podwrapper from libguestfs. Subject: [PATCH 10/12] docs: Add podwrapper from libguestfs.
Use podwrapper from libguestfs to generate man pages instead of Use podwrapper from libguestfs to generate man pages instead of
pod2man. This allows finer control over how man pages are generated, pod2man. This allows finer control over how man pages are generated,

View File

@ -0,0 +1,230 @@
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

@ -0,0 +1,142 @@
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

@ -44,6 +44,8 @@ Patch0007: 0007-tests-Test-largest-possible-plugin-size.patch
Patch0008: 0008-docs-Fix-broken-cross-reference-in-man-page.patch Patch0008: 0008-docs-Fix-broken-cross-reference-in-man-page.patch
Patch0009: 0009-docs-Break-up-some-over-long-lines-in-documentation.patch Patch0009: 0009-docs-Break-up-some-over-long-lines-in-documentation.patch
Patch0010: 0010-docs-Add-podwrapper-from-libguestfs.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
%global patches_touch_autotools 1 %global patches_touch_autotools 1
%if 0%{patches_touch_autotools} %if 0%{patches_touch_autotools}
@ -778,6 +780,7 @@ popd
* Sun Jul 15 2018 Richard W.M. Jones <rjones@redhat.com> - 1.5.0-3 * Sun Jul 15 2018 Richard W.M. Jones <rjones@redhat.com> - 1.5.0-3
- Add all upstream patches since 1.5.0. - Add all upstream patches since 1.5.0.
- New pattern plugin. - New pattern plugin.
- Add fixes for 32 bit platforms i686 and armv7.
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-2 * Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild