[PATCH 0/6] dib: various improvements
by Pino Toscano
Hi,
this series improves virt-dib, adding some upstream changes, and
refactoring the handling of output formats.
Thanks,
Pino Toscano (6):
dib: clear up "already provided" message
dib: add --checksum
dib: pass custom mkfs options after the filesystem type
dib: refactor output formats handling
dib: clarify "output:" lines in --machine-readable documentation
dib: add tgz output format
dib/Makefile.am | 14 +++-
dib/cmdline.ml | 62 +++++++---------
dib/cmdline.mli | 6 +-
dib/dib.ml | 148 +++++++++++++++++++------------------
dib/elements.ml | 28 +++++--
dib/output_format.ml | 176 ++++++++++++++++++++++++++++++++++++++++++++
dib/output_format.mli | 122 ++++++++++++++++++++++++++++++
dib/output_format_docker.ml | 56 ++++++++++++++
dib/output_format_qcow2.ml | 55 ++++++++++++++
dib/output_format_raw.ml | 31 ++++++++
dib/output_format_tar.ml | 34 +++++++++
dib/output_format_tgz.ml | 35 +++++++++
dib/output_format_vhd.ml | 47 ++++++++++++
dib/virt-dib.pod | 25 ++++++-
14 files changed, 718 insertions(+), 121 deletions(-)
create mode 100644 dib/output_format.ml
create mode 100644 dib/output_format.mli
create mode 100644 dib/output_format_docker.ml
create mode 100644 dib/output_format_qcow2.ml
create mode 100644 dib/output_format_raw.ml
create mode 100644 dib/output_format_tar.ml
create mode 100644 dib/output_format_tgz.ml
create mode 100644 dib/output_format_vhd.ml
--
2.9.3
7 years, 9 months
[PATCH v2 0/3] library: improve handling of external tools
by Pino Toscano
Hi,
the libguestfs library uses a number of external tools; for some of
them, we search for them at build time, enabling some feature only if
found, and later on assuming at runtime they are installed. However,
the situation is more complex than that:
- hardcoding the full path means that there is an incoherency in the
way some of the tools are used, as some other tools (e.g. qemu-img)
are just run as assumed to be in $PATH; also hardcoding means
libguestfs cannot use different versions of those tools
- some of the tools are actually optional, and their runtime lack can
be handled gracefully instead of throwing a "failed to execute" error
The chosen approach is to build a process-wide cache in the libguestfs
library of paths of tools searched, even in case they are not available:
this way it is easier to just skip something at runtime if a program is
not there. The patch series applies it for the libdb tools, and for
the tools used to extract icons from guests.
Thanks,
Pino Toscano (3):
lib: add internal cache for external application
lib: improve libdb tools handling at runtime (RHBZ#1409024)
inspect: make netpbm and icoutils really optional runtime tools
lib/Makefile.am | 1 +
lib/external-apps.c | 190 +++++++++++++++++++++++++++++++++++++++++++++
lib/guestfs-internal.h | 3 +
lib/inspect-apps.c | 14 +++-
lib/inspect-icon.c | 54 +++++++------
m4/guestfs-find-db-tool.m4 | 2 +-
m4/guestfs_progs.m4 | 24 ------
7 files changed, 237 insertions(+), 51 deletions(-)
create mode 100644 lib/external-apps.c
--
2.9.3
7 years, 9 months
[PATCH v6 0/3] Import directly from OVA tar archive if possible
by Tomáš Golembiovský
v6:
- just rebase
v5:
- rebase, patches 1,3,5 were merged
- 1/3: we still need to discuss whether to detect compressed discs
- 2/3:
- renamed argument noempty to keep_empty
- tests were not run
- 3/3:
- using JSON module to generate JSON (as suggested by Pino)
- all the other comments raised by Pino
v4:
- rebase to more recent master
- 1/6: using just "quote" instead of "Filename.quote"
- 2/6: reformated block of code according to Richards suggestion
- 4/6: added tests for nsplit
v3: Addressed Pino's comments, namely:
- input_ova.ml
- untar takes list of paths
- renamed untar_partial to untar_metadata
- replaced uggly regex with nsplit
- tests
- test changes are part of the main commit
- renamed test-data/guestfs-hashsums.sh to test-data/test-utils.sh
- renamed qemu_version to qemu_is_version and moved it to
test-data/test-utils.sh
- normalize paths in expect files
v2:
- rewritten the tar invocations, the output processing is now done in
OcaML rather than with a shell code; it turned out to be easier and
more readable than I have feared.
- added QEMU version check
- addressed Pino's comments
- changed tests; the expected result is now based on the QEMU used
during testing
This series is related to the problem of inefficient import of OVA
files. The needed enhancements of QEMU were merged into the codebase and
should be available in QEMU 2.8. From there we can use 'size' and
'offset' options in raw driver to tell QEMU to use only subset of a file
as an image.
The patch set is more or less complete. The only outstanding issue is
the missing detection of sparse files inside tar. But this can be done
in a separate patch. As pointed out before I didn't find a way how to
detect that by using the tar tool only and would probably require use of
some external library.
Tomáš Golembiovský (3):
v2v: ova: don't detect compressed disks, read the OVF instead
mllib: modify nsplit to take optional noempty and count arguments
v2v: ova: don't extract files from OVA if it's not needed
mllib/common_utils.ml | 13 ++-
mllib/common_utils.mli | 12 +-
mllib/common_utils_tests.ml | 30 +++++
test-data/test-utils.sh | 20 ++++
v2v/Makefile.am | 2 +
v2v/input_ova.ml | 198 +++++++++++++++++++++++++++++---
v2v/test-v2v-i-ova-formats.sh | 5 +-
v2v/test-v2v-i-ova-gz.ovf | 2 +-
v2v/test-v2v-i-ova-subfolders.expected2 | 18 +++
v2v/test-v2v-i-ova-subfolders.sh | 13 ++-
v2v/test-v2v-i-ova-tar.expected | 18 +++
v2v/test-v2v-i-ova-tar.expected2 | 18 +++
v2v/test-v2v-i-ova-tar.ovf | 138 ++++++++++++++++++++++
v2v/test-v2v-i-ova-tar.sh | 72 ++++++++++++
v2v/test-v2v-i-ova-two-disks.expected2 | 19 +++
v2v/test-v2v-i-ova-two-disks.sh | 13 ++-
16 files changed, 561 insertions(+), 30 deletions(-)
create mode 100644 v2v/test-v2v-i-ova-subfolders.expected2
create mode 100644 v2v/test-v2v-i-ova-tar.expected
create mode 100644 v2v/test-v2v-i-ova-tar.expected2
create mode 100644 v2v/test-v2v-i-ova-tar.ovf
create mode 100755 v2v/test-v2v-i-ova-tar.sh
create mode 100644 v2v/test-v2v-i-ova-two-disks.expected2
--
2.11.0
7 years, 9 months
[PATCH] v2v: Further increase memory allocated to the appliance (RHBZ#1418283).
by Richard W.M. Jones
In commit 08f82f2e3d6975b72340dd59f438862e152a15ef we increased the
memory size to 800MB (on x86) so that the semodule command would work.
However it has been discovered that another SELinux command takes
large amounts of RAM (setfiles during the SELinux relabel step).
Therefore increase the memory size again, this time to 2000MB.
---
v2v/v2v.ml | 2 +-
v2v/virt-v2v.pod | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index e85e96f..a711121 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -75,7 +75,7 @@ let rec main () =
);
let g = open_guestfs ~identifier:"v2v" () in
- g#set_memsize (g#get_memsize () * 8 / 5);
+ g#set_memsize (g#get_memsize () * 20 / 5);
(* The network is only used by the unconfigure_vmware () function. *)
g#set_network true;
(match conversion_mode with
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index 4614888..88bfd7f 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -1634,7 +1634,7 @@ alleviate this.
Virt-v2v is not especially compute or RAM intensive. If you are
running many parallel conversions, then you may consider allocating
-one CPU core and between 512 MB and 1 GB of RAM per running instance.
+one CPU core and 2 GB of RAM per running instance.
Virt-v2v can be run in a virtual machine.
--
2.10.2
7 years, 9 months
[nbdkit PATCH] tests: Test in-tree rather than installed header
by Eric Blake
The previous commit broke the build during 'make check'; we want
to test the in-tree header, not some (potentially stale or missing)
installed header.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
tests/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c2d473a..9076d6b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -103,7 +103,7 @@ check_PROGRAMS += \
test_cxx_SOURCES = test-cxx.cpp
test_cxx_CXXFLAGS = \
- $(WARNINGS_CFLAGS)
+ -I ../include $(WARNINGS_CFLAGS)
endif
# In-depth tests need libguestfs, since that is a convenient way to
--
2.9.3
7 years, 9 months
[PATCH] Really fix C++ support in the <nbdkit-plugin.h> header file (RHBZ#1418328).
by Richard W.M. Jones
Fixes commit 3647fe831a5c6d12832c4e48d1337489fd44fa59.
---
.gitignore | 1 -
include/nbdkit-plugin.h | 15 +++--
tests/Makefile.am | 39 ++++++++----
tests/test-cxx-plugin.cpp | 155 ++++++++++++++++++++++++++++++++++++++++++++++
tests/test-cxx.cpp | 44 -------------
tests/test-cxx.sh | 38 ++++++++++++
6 files changed, 230 insertions(+), 62 deletions(-)
create mode 100644 tests/test-cxx-plugin.cpp
delete mode 100644 tests/test-cxx.cpp
create mode 100755 tests/test-cxx.sh
diff --git a/.gitignore b/.gitignore
index 0f4e574..59e9510 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,7 +43,6 @@ Makefile.in
/tests/disk.xz
/tests/file-data
/tests/test-connect
-/tests/test-cxx
/tests/test-file
/tests/test-gzip
/tests/test-newstyle
diff --git a/include/nbdkit-plugin.h b/include/nbdkit-plugin.h
index 9b3a5c9..568aaf5 100644
--- a/include/nbdkit-plugin.h
+++ b/include/nbdkit-plugin.h
@@ -36,13 +36,13 @@
#ifndef NBDKIT_PLUGIN_H
#define NBDKIT_PLUGIN_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <stdarg.h>
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS 0
#define NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS 1
#define NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS 2
@@ -108,7 +108,14 @@ extern void nbdkit_vdebug (const char *msg, va_list args);
extern char *nbdkit_absolute_path (const char *path);
extern int64_t nbdkit_parse_size (const char *str);
+#ifdef __cplusplus
+#define NBDKIT_CXX_LANG_C extern "C"
+#else
+#define NBDKIT_CXX_LANG_C /* nothing */
+#endif
+
#define NBDKIT_REGISTER_PLUGIN(plugin) \
+ NBDKIT_CXX_LANG_C \
struct nbdkit_plugin * \
plugin_init (void) \
{ \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c2d473a..daf1d2a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -71,6 +71,12 @@ check-valgrind:
# Basic server command line and start-up tests.
+check_PROGRAMS =
+check_DATA =
+check_SCRIPTS =
+check_LTLIBRARIES =
+noinst_LTLIBRARIES =
+
TESTS = \
test-help.sh \
test-help-plugin.sh \
@@ -86,24 +92,34 @@ TESTS = \
test-ipv4.sh \
test-socket-activation
-check_PROGRAMS = \
+check_PROGRAMS += \
test-socket-activation
test_socket_activation_SOURCES = test-socket-activation.c
test_socket_activation_CFLAGS = $(WARNINGS_CFLAGS)
if HAVE_CXX
-# Test we can include the <nbdkit-plugin.h> header file from C++.
-# The test does nothing interesting, we're only interested if
-# it builds.
+# This builds a plugin using the C++ compiler. The plugin
+# doesn't do anything interesting when run.
TESTS += \
- test-cxx
-check_PROGRAMS += \
- test-cxx
+ test-cxx.sh
+# check_LTLIBRARIES won't build a shared library (see automake manual).
+# So we have to do this and add a dependency.
+noinst_LTLIBRARIES += \
+ test-cxx-plugin.la
+test-cxx.sh: test-cxx-plugin.la
-test_cxx_SOURCES = test-cxx.cpp
-test_cxx_CXXFLAGS = \
+test_cxx_plugin_la_SOURCES = \
+ test-cxx-plugin.cpp \
+ $(top_srcdir)/include/nbdkit-plugin.h
+test_cxx_plugin_la_CPPFLAGS = \
+ -I$(top_srcdir)/include
+test_cxx_plugin_la_CXXFLAGS = \
$(WARNINGS_CFLAGS)
+# For use of the -rpath option, see:
+# https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
+test_cxx_plugin_la_LDFLAGS = \
+ -module -avoid-version -shared -rpath /nowhere
endif
# In-depth tests need libguestfs, since that is a convenient way to
@@ -120,13 +136,10 @@ TESTS_ENVIRONMENT = \
LD_LIBRARY_PATH=../plugins/ocaml/.libs
# Common test library.
-check_LTLIBRARIES = libtest.la
+check_LTLIBRARIES += libtest.la
libtest_la_SOURCES = test.c test.h
libtest_la_CFLAGS = $(WARNINGS_CFLAGS)
-check_DATA =
-check_SCRIPTS =
-
# Basic connection test.
check_PROGRAMS += test-connect
TESTS += test-connect.sh
diff --git a/tests/test-cxx-plugin.cpp b/tests/test-cxx-plugin.cpp
new file mode 100644
index 0000000..43f441e
--- /dev/null
+++ b/tests/test-cxx-plugin.cpp
@@ -0,0 +1,155 @@
+/* nbdkit
+ * Copyright (C) 2013-2017 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.
+ */
+
+#ifndef __cplusplus
+#error "this test should be compiled with a C++ compiler"
+#endif
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <nbdkit-plugin.h>
+
+/* This looks like a 100MB disk with one empty partition. */
+static unsigned char bootsector[512] = {
+ 0xfa, 0xb8, 0x00, 0x10, 0x8e, 0xd0, 0xbc, 0x00,
+ 0xb0, 0xb8, 0x00, 0x00, 0x8e, 0xd8, 0x8e, 0xc0,
+ 0xfb, 0xbe, 0x00, 0x7c, 0xbf, 0x00, 0x06, 0xb9,
+ 0x00, 0x02, 0xf3, 0xa4, 0xea, 0x21, 0x06, 0x00,
+ 0x00, 0xbe, 0xbe, 0x07, 0x38, 0x04, 0x75, 0x0b,
+ 0x83, 0xc6, 0x10, 0x81, 0xfe, 0xfe, 0x07, 0x75,
+ 0xf3, 0xeb, 0x16, 0xb4, 0x02, 0xb0, 0x01, 0xbb,
+ 0x00, 0x7c, 0xb2, 0x80, 0x8a, 0x74, 0x01, 0x8b,
+ 0x4c, 0x02, 0xcd, 0x13, 0xea, 0x00, 0x7c, 0x00,
+ 0x00, 0xeb, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xe1, 0x5b, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x03, 0x00, 0x83, 0xbc, 0x31, 0x0c, 0x80, 0x00,
+ 0x00, 0x00, 0x01, 0x1f, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0xaa
+};
+static unsigned char data[104857600];
+
+static void
+cxx_load (void)
+{
+ memcpy (data, bootsector, sizeof bootsector);
+}
+
+static void *
+cxx_open (int readonly)
+{
+ return data;
+}
+
+static int64_t
+cxx_get_size (void *handle)
+{
+ return (int64_t) sizeof (data);
+}
+
+#define THREAD_MODEL NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS
+
+static int
+cxx_pread (void *handle, void *buf, uint32_t count, uint64_t offset)
+{
+ memcpy (buf, data+offset, count);
+ return 0;
+}
+
+static struct nbdkit_plugin plugin = {};
+static void init_plugin_struct (void) __attribute__((constructor));
+static void
+init_plugin_struct (void)
+{
+ plugin.name = "cxx";
+ plugin.version = PACKAGE_VERSION;
+ plugin.load = cxx_load;
+ plugin.open = cxx_open;
+ plugin.get_size = cxx_get_size;
+ plugin.pread = cxx_pread;
+}
+
+NBDKIT_REGISTER_PLUGIN(plugin)
diff --git a/tests/test-cxx.cpp b/tests/test-cxx.cpp
deleted file mode 100644
index a78c4a3..0000000
--- a/tests/test-cxx.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/* nbdkit
- * Copyright (C) 2017 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.
- */
-
-#ifndef __cplusplus
-#error "this test should be compiled with a C++ compiler"
-#endif
-
-#include "nbdkit-plugin.h"
-
-int
-main (int argc, char *argv[])
-{
- return 0;
-}
diff --git a/tests/test-cxx.sh b/tests/test-cxx.sh
new file mode 100755
index 0000000..1b86167
--- /dev/null
+++ b/tests/test-cxx.sh
@@ -0,0 +1,38 @@
+#!/bin/bash -
+# nbdkit
+# Copyright (C) 2017 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.
+
+set -e
+
+# We only really care that the plugin compiled, so we don't
+# need to run it properly.
+$VG ../src/nbdkit ./.libs/test-cxx-plugin.so --version
--
2.10.2
7 years, 9 months
[nbdkit PATCH] tls: Fix build on RHEL 5
by Eric Blake
Don't assume that errno will be implicitly available.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/tls.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/tls.c b/src/tls.c
index 5d380e3..0e9ea11 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -38,6 +38,7 @@
#include <string.h>
#include <unistd.h>
#include <assert.h>
+#include <errno.h>
#include <pthread.h>
--
2.9.3
7 years, 9 months