Rebase to nbdkit 1.46.1
Backport nbdkit_name from nbdkit 1.47. resolves: RHEL-111242 Test and document that VDDK 9.0.1.0 works resolves: RHEL-140615
This commit is contained in:
parent
70c47311c0
commit
f06a5d96be
@ -1,4 +1,4 @@
|
||||
From 8d82d6228a25693bbf65c50ecd32953f48dcba9e Mon Sep 17 00:00:00 2001
|
||||
From 5610d1a4cc6da743e99973bded79cf7761ee612f Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Mon, 5 Jan 2026 10:43:46 -0600
|
||||
Subject: [PATCH] blocksize-policy: Fix assertion failure on unaligned block
|
||||
@ -1,4 +1,4 @@
|
||||
From 5db5982dc9b801fe37c0d4086724abc330656609 Mon Sep 17 00:00:00 2001
|
||||
From fcda6008ff61253a2415194b85b43328be5e1910 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Wed, 7 Jan 2026 20:25:56 +0000
|
||||
Subject: [PATCH] file: Don't advertise minimum_io_size > 64K (the max
|
||||
@ -1,4 +1,4 @@
|
||||
From 5d257a1ef7c742ac90f292c2dd5d74594e3d28ec Mon Sep 17 00:00:00 2001
|
||||
From ca21ff4ca62b26028a7792b51189188fd5049f65 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 8 Jan 2026 21:05:23 +0000
|
||||
Subject: [PATCH] todo: Add note about problems with file plugin block_size
|
||||
@ -1,4 +1,4 @@
|
||||
From 07cbf8b7a1e94079946c36ab83c1ae75ac175d4e Mon Sep 17 00:00:00 2001
|
||||
From 6a0ec916add4d66f1dd94a97b627a09321dda0d8 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 8 Jan 2026 21:38:36 +0000
|
||||
Subject: [PATCH] file: Change calculations of block size hints for block
|
||||
@ -0,0 +1,55 @@
|
||||
From 121dc9e9d576bba22731dcc89fdc6b9b21a3f742 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 12 Jan 2026 14:08:25 +0000
|
||||
Subject: [PATCH] qcow2dec: Don't pass flags from .extents through to .pread
|
||||
|
||||
Using the qcow2dec filter could pass the flags parameter from the
|
||||
.extents callback through to the .pread callback. Since pread flags
|
||||
should always be 0, but extents can contain flags, this could cause
|
||||
the following failure:
|
||||
|
||||
nbdkit: backend.c:666: backend_pread: Assertion `flags == 0' failed.
|
||||
|
||||
This failure especially happened when the client was qemu-img convert
|
||||
since that client uses req_one. It did not happen for nbdcopy.
|
||||
|
||||
The relevant section of the stack trace was:
|
||||
|
||||
#7 0x0000555555556440 in backend_pread (c=0x7ffff0000f70, buf=0x7ffff00ba3c0,
|
||||
count=65536, offset=262144, flags=4, err=0x7ffff6cb6810)
|
||||
at /home/rjones/d/nbdkit/server/backend.c:666
|
||||
#8 0x00007ffff753a436 in read_l2_entry (next=next@entry=0x7ffff0000f70,
|
||||
offset=offset@entry=0, flags=flags@entry=4,
|
||||
l2_present=l2_present@entry=0x7ffff6cb664f,
|
||||
l2_entry=l2_entry@entry=0x7ffff6cb6650, err=err@entry=0x7ffff6cb6810)
|
||||
at /home/rjones/d/nbdkit/filters/qcow2dec/qcow2dec.c:611
|
||||
#9 0x00007ffff753af83 in qcow2dec_extents (next=0x7ffff0000f70,
|
||||
handle=<optimized out>, count32=<optimized out>, offset=0, flags=4,
|
||||
extents=0x7ffff00775d0, err=0x7ffff6cb6810)
|
||||
at /home/rjones/d/nbdkit/filters/qcow2dec/qcow2dec.c:927
|
||||
|
||||
Fixes: commit 4c5e65c9a14f2f923d56877f041023682d13e2ea
|
||||
(cherry picked from commit 2f176e58c13e42d3d32ef2e42ff81fb3e74df83b)
|
||||
---
|
||||
filters/qcow2dec/qcow2dec.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/filters/qcow2dec/qcow2dec.c b/filters/qcow2dec/qcow2dec.c
|
||||
index 02769b69..0349cd11 100644
|
||||
--- a/filters/qcow2dec/qcow2dec.c
|
||||
+++ b/filters/qcow2dec/qcow2dec.c
|
||||
@@ -924,7 +924,10 @@ qcow2dec_extents (nbdkit_next *next,
|
||||
uint64_t file_offset;
|
||||
struct nbdkit_extent e = { .offset = offset, .length = cluster_size };
|
||||
|
||||
- if (read_l2_entry (next, offset, flags, &l2_present, &l2_entry, err) == -1)
|
||||
+ /* Note: Don't pass flags here, since this is expecting pread
|
||||
+ * flags (always 0).
|
||||
+ */
|
||||
+ if (read_l2_entry (next, offset, 0, &l2_present, &l2_entry, err) == -1)
|
||||
return -1;
|
||||
|
||||
/* L2 table is unallocated. */
|
||||
--
|
||||
2.47.3
|
||||
|
||||
30
0008-vddk-Test-with-VDDK-9.0.1.0.patch
Normal file
30
0008-vddk-Test-with-VDDK-9.0.1.0.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From cb6383e611a070e180200e05980e5efd4f72ec3b Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 12 Jan 2026 19:54:31 +0000
|
||||
Subject: [PATCH] vddk: Test with VDDK 9.0.1.0
|
||||
|
||||
There are almost no changes in this version compared to 9.0.0.0.
|
||||
|
||||
Reported-by: Ajay Victor
|
||||
Fixes: https://issues.redhat.com/browse/RHEL-140615
|
||||
(cherry picked from commit e43f9aab6bba2d31dd365f14fddc653926c662d7)
|
||||
---
|
||||
plugins/vddk/nbdkit-vddk-plugin.pod | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
|
||||
index 4685ba6b..2d34fe14 100644
|
||||
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
|
||||
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
|
||||
@@ -439,7 +439,7 @@ This is also the first version that supported the
|
||||
C<VixDiskLib_QueryAllocatedBlocks> API. This is used to provide
|
||||
sparseness (extent) information over NBD.
|
||||
|
||||
-=item VDDK 9.0.0.0 (released Jun 2025)
|
||||
+=item VDDK 9.0.1.0 (released Sep 2025)
|
||||
|
||||
This is the latest version of VDDK that we have tested at the time of
|
||||
writing, but the plugin should work with future versions.
|
||||
--
|
||||
2.47.3
|
||||
|
||||
30
0009-configure.ac-Remove-use-of-which-command.patch
Normal file
30
0009-configure.ac-Remove-use-of-which-command.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 70346d26c037809c1cf1ac35c45ac95d0840389f Mon Sep 17 00:00:00 2001
|
||||
From: Christopher Byrne <salah.coronya@gmail.com>
|
||||
Date: Wed, 14 Jan 2026 18:50:03 -0600
|
||||
Subject: [PATCH] configure.ac: Remove use of "which" command
|
||||
|
||||
It's not a required command, use "command -v" which is POSIX shell
|
||||
compliant. See https://bugs.gentoo.org/646588 .
|
||||
|
||||
Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
|
||||
(cherry picked from commit 59e0f6d4537b67c37d0f9fc7c8d819208ce72929)
|
||||
---
|
||||
configure.ac | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 64aa44a5..7a19fb95 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -205,7 +205,7 @@ AC_PROG_RANLIB
|
||||
dnl Bash must be at least version 4. If it is too old, fail hard
|
||||
dnl with a good diagnostic. Note macOS ships an ancient version
|
||||
dnl of bash (https://gitlab.com/nbdkit/nbdkit/-/issues/21)
|
||||
-bash=`which bash`
|
||||
+bash=$(command -v bash)
|
||||
AC_MSG_CHECKING([for the major version of $bash])
|
||||
bash_major=`bash -c 'echo ${BASH_VERSINFO:-0}'`
|
||||
AC_MSG_RESULT([$bash_major])
|
||||
--
|
||||
2.47.3
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
From 0282cc8d29c789a0872eaa7f364fa948167cfb8f Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 17 Jan 2026 20:57:22 +0000
|
||||
Subject: [PATCH] map: Fix documentation about changing the size of the disk
|
||||
|
||||
Since map-size was implemented in commit 058710d26c ("map: Implement
|
||||
map-size feature") this filter can in fact change the size of the
|
||||
disk. However using nbdkit-truncate-filter is still better.
|
||||
|
||||
Fixes: commit 058710d26c94904535135a9b85f788cd9bcc0477
|
||||
(cherry picked from commit 84edd687b0080e693aafc97592efb18947b7a8ab)
|
||||
---
|
||||
filters/map/nbdkit-map-filter.pod | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/filters/map/nbdkit-map-filter.pod b/filters/map/nbdkit-map-filter.pod
|
||||
index 8fce70ce..92e4a92f 100644
|
||||
--- a/filters/map/nbdkit-map-filter.pod
|
||||
+++ b/filters/map/nbdkit-map-filter.pod
|
||||
@@ -10,11 +10,12 @@ nbdkit-map-filter - remap disk blocks
|
||||
=head1 DESCRIPTION
|
||||
|
||||
C<nbdkit-map-filter> is an L<nbdkit(1)> filter which can remap parts
|
||||
-of the underlying plugin, such as moving a sector or partition. To
|
||||
-select part of a disk, use L<nbdkit-offset-filter(1)> instead. To
|
||||
-select a partition, use L<nbdkit-partition-filter(1)>. This filter
|
||||
-cannot change the size of the disk, use L<nbdkit-truncate-filter(1)>
|
||||
-to do that.
|
||||
+of the underlying plugin, such as moving a sector or partition.
|
||||
+
|
||||
+To select part of a disk, use L<nbdkit-offset-filter(1)> instead. To
|
||||
+select a partition, use L<nbdkit-partition-filter(1)>. Although this
|
||||
+filter can change the size of the disk, L<nbdkit-truncate-filter(1)>
|
||||
+is easier to use.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
--
|
||||
2.47.3
|
||||
|
||||
40
0011-common-utils-utils.h-Add-C-boilerplate.patch
Normal file
40
0011-common-utils-utils.h-Add-C-boilerplate.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From b3502c4e9294ba5b760ca54312b1cc73eab1883d Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 18 Jan 2026 18:33:38 +0000
|
||||
Subject: [PATCH] common/utils/utils.h: Add C++ boilerplate
|
||||
|
||||
Allow these utility functions to be called from internal plugins
|
||||
written in C++.
|
||||
|
||||
(cherry picked from commit 3db92f66452525309422329304f25f61fa807709)
|
||||
---
|
||||
common/utils/utils.h | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/common/utils/utils.h b/common/utils/utils.h
|
||||
index 20cf0abc..3f9e4512 100644
|
||||
--- a/common/utils/utils.h
|
||||
+++ b/common/utils/utils.h
|
||||
@@ -33,6 +33,10 @@
|
||||
#ifndef NBDKIT_UTILS_H
|
||||
#define NBDKIT_UTILS_H
|
||||
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
#include <stdbool.h>
|
||||
|
||||
extern void shell_quote (const char *str, FILE *fp);
|
||||
@@ -54,4 +58,8 @@ extern ssize_t full_pwrite (int fd, const void *buf, size_t count,
|
||||
extern int64_t device_size (int fd, const struct stat *statbuf);
|
||||
#endif
|
||||
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#endif /* NBDKIT_UTILS_H */
|
||||
--
|
||||
2.47.3
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
From b2305c7e16e37869c6c649444ac257298e6addc2 Mon Sep 17 00:00:00 2001
|
||||
From 4a492dc14d14a68bd4500c95be5dca442d448b65 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 30 Dec 2025 15:24:13 +0000
|
||||
Subject: [PATCH] server: Add nbdkit_debug_hexdiff function
|
||||
@ -1,4 +1,4 @@
|
||||
From 99153ed5592c9a08c5d5c393a625c54a5a0ea0c0 Mon Sep 17 00:00:00 2001
|
||||
From e9eed2a484ee659eeec11db6b066973435d99110 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 30 Dec 2025 17:09:07 +0000
|
||||
Subject: [PATCH] checkwrite: Display differences if -D checkwrite.showdiffs=1
|
||||
@ -1,4 +1,4 @@
|
||||
From abb8c973c47797fb8cdf0081fff3f20e28ce0862 Mon Sep 17 00:00:00 2001
|
||||
From 66b5fdc13d30025daf9e7b953eaa2f83670d094e Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 30 Dec 2025 21:59:24 +0000
|
||||
Subject: [PATCH] docs/nbdkit_debug_hexdump.pod: Document when hexdiff was
|
||||
@ -1,4 +1,4 @@
|
||||
From 8dc9b3df1c2ff32a73b8dfd179b84b50de792d95 Mon Sep 17 00:00:00 2001
|
||||
From 0296eb8b718bfd5345027c307bc9df69c25fc8b4 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 30 Dec 2025 22:01:04 +0000
|
||||
Subject: [PATCH] docs/nbdkit_debug_hexdump.pod: Add a link back to
|
||||
407
0016-Add-new-nbdkit_name-function.patch
Normal file
407
0016-Add-new-nbdkit_name-function.patch
Normal file
@ -0,0 +1,407 @@
|
||||
From c3092c8ff0d1cd7056103f1bc855f8ab9bccc1d8 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 15 Jan 2026 12:07:40 +0000
|
||||
Subject: [PATCH] Add new nbdkit_name() function
|
||||
|
||||
In nbdkit 1.46 we added a --name parameter to name nbdkit instances.
|
||||
This was only used in debug and error messages. For a forthcoming
|
||||
feature it would be nice if the plugin could get the instance name.
|
||||
|
||||
The new nbdkit_name() function is very simple. It returns the string
|
||||
set through the nbdkit --name parameter, or NULL if it was not set.
|
||||
|
||||
NULL does not indicate an error. I thought it was better to return
|
||||
NULL as a distinct "not set" value rather than using a default like
|
||||
"nbdkit" or PACKAGE_NAME, so the plugin can decide what to do.
|
||||
|
||||
RHEL:
|
||||
Cherry picked from commit 5c24949959ccf8cf9f1093adf81336009df23f2d
|
||||
and added a note about being backported in RHEL 10.2.
|
||||
---
|
||||
.gitignore | 1 +
|
||||
docs/Makefile.am | 7 ++++
|
||||
docs/nbdkit-plugin.pod | 1 +
|
||||
docs/nbdkit.pod | 2 +-
|
||||
docs/nbdkit_name.pod | 45 ++++++++++++++++++++
|
||||
include/nbdkit-common.h | 1 +
|
||||
server/nbdkit.syms | 1 +
|
||||
server/public.c | 6 +++
|
||||
tests/Makefile.am | 25 +++++++++++
|
||||
tests/test-name-plugin.c | 88 +++++++++++++++++++++++++++++++++++++++
|
||||
tests/test-name-plugin.sh | 60 ++++++++++++++++++++++++++
|
||||
11 files changed, 236 insertions(+), 1 deletion(-)
|
||||
create mode 100644 docs/nbdkit_name.pod
|
||||
create mode 100644 tests/test-name-plugin.c
|
||||
create mode 100755 tests/test-name-plugin.sh
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index 3562a665..55d971e6 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -33,6 +33,7 @@ docs/nbdkit_error.3
|
||||
docs/nbdkit_export_name.3
|
||||
docs/nbdkit-filter.3
|
||||
docs/nbdkit_is_tls.3
|
||||
+docs/nbdkit_name.3
|
||||
docs/nbdkit_nanosleep.3
|
||||
docs/nbdkit_parse_bool.3
|
||||
docs/nbdkit_parse_delay.3
|
||||
diff --git a/docs/Makefile.am b/docs/Makefile.am
|
||||
index 4ee6994c..a43b13ed 100644
|
||||
--- a/docs/Makefile.am
|
||||
+++ b/docs/Makefile.am
|
||||
@@ -44,6 +44,7 @@ EXTRA_DIST = \
|
||||
nbdkit-filter.pod \
|
||||
nbdkit_is_tls.pod \
|
||||
nbdkit-loop.pod \
|
||||
+ nbdkit_name.pod \
|
||||
nbdkit_nanosleep.pod \
|
||||
nbdkit_parse_bool.pod \
|
||||
nbdkit_parse_delay.pod \
|
||||
@@ -134,6 +135,7 @@ generated_mans = \
|
||||
nbdkit-filter.3 \
|
||||
nbdkit_is_tls.3 \
|
||||
nbdkit-loop.1 \
|
||||
+ nbdkit_name.3 \
|
||||
nbdkit_nanosleep.3 \
|
||||
nbdkit_parse_bool.3 \
|
||||
nbdkit_parse_delay.3 \
|
||||
@@ -241,6 +243,11 @@ nbdkit-loop.1: nbdkit-loop.pod $(top_builddir)/podwrapper.pl
|
||||
--html $(top_builddir)/html/$@.html \
|
||||
$<
|
||||
|
||||
+nbdkit_name.3: nbdkit_name.pod $(top_builddir)/podwrapper.pl
|
||||
+ $(PODWRAPPER) --section=3 --man $@ \
|
||||
+ --html $(top_builddir)/html/$@.html \
|
||||
+ $<
|
||||
+
|
||||
nbdkit_nanosleep.3: nbdkit_nanosleep.pod $(top_builddir)/podwrapper.pl
|
||||
$(PODWRAPPER) --section=3 --man $@ \
|
||||
--html $(top_builddir)/html/$@.html \
|
||||
diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod
|
||||
index 308364d4..41f65908 100644
|
||||
--- a/docs/nbdkit-plugin.pod
|
||||
+++ b/docs/nbdkit-plugin.pod
|
||||
@@ -1630,6 +1630,7 @@ L<nbdkit_disconnect(3)>,
|
||||
L<nbdkit_error(3)>,
|
||||
L<nbdkit_export_name(3)>,
|
||||
L<nbdkit_is_tls(3)>,
|
||||
+L<nbdkit_name(3)>,
|
||||
L<nbdkit_nanosleep(3)>,
|
||||
L<nbdkit_parse_bool(3)>,
|
||||
L<nbdkit_parse_delay(3)>,
|
||||
diff --git a/docs/nbdkit.pod b/docs/nbdkit.pod
|
||||
index e8ff9438..3104d751 100644
|
||||
--- a/docs/nbdkit.pod
|
||||
+++ b/docs/nbdkit.pod
|
||||
@@ -356,7 +356,7 @@ Name this nbdkit instance. This allows you to associate names with
|
||||
nbdkit processes, if you have several. The name appears in error and
|
||||
debug messages, but is otherwise unused by nbdkit. The name can be
|
||||
any string, but usually a short string containing only letters,
|
||||
-numbers and common punctuation is best.
|
||||
+numbers and common punctuation is best. See also L<nbdkit_name(3)>.
|
||||
|
||||
=item B<-n>
|
||||
|
||||
diff --git a/docs/nbdkit_name.pod b/docs/nbdkit_name.pod
|
||||
new file mode 100644
|
||||
index 00000000..210c7d2f
|
||||
--- /dev/null
|
||||
+++ b/docs/nbdkit_name.pod
|
||||
@@ -0,0 +1,45 @@
|
||||
+=head1 NAME
|
||||
+
|
||||
+nbdkit_name - get the name of the nbdkit instance
|
||||
+
|
||||
+=head1 SYNOPSIS
|
||||
+
|
||||
+ #include <nbdkit-plugin.h>
|
||||
+
|
||||
+ const char *nbdkit_name (void);
|
||||
+
|
||||
+=head1 DESCRIPTION
|
||||
+
|
||||
+C<nbdkit_name> returns the name of the nbdkit instance. This is the
|
||||
+string which was set through the nbdkit I<--name> parameter. If the
|
||||
+name was not set, this returns C<NULL>.
|
||||
+
|
||||
+=head1 RETURN VALUE
|
||||
+
|
||||
+The function returns a constant string, valid for the lifetime of the
|
||||
+process, or C<NULL>. Note that returning C<NULL> is not an error.
|
||||
+
|
||||
+=begin comment
|
||||
+
|
||||
+=head1 LANGUAGE BINDINGS
|
||||
+
|
||||
+=end comment
|
||||
+
|
||||
+=head1 HISTORY
|
||||
+
|
||||
+C<nbdkit_name> was added in nbdkit 1.48
|
||||
+(and backported to RHEL 10.2).
|
||||
+
|
||||
+=head1 SEE ALSO
|
||||
+
|
||||
+L<nbdkit(1)>,
|
||||
+L<nbdkit-plugin(3)>,
|
||||
+L<nbdkit-filter(3)>.
|
||||
+
|
||||
+=head1 AUTHORS
|
||||
+
|
||||
+Richard W.M. Jones
|
||||
+
|
||||
+=head1 COPYRIGHT
|
||||
+
|
||||
+Copyright Red Hat
|
||||
diff --git a/include/nbdkit-common.h b/include/nbdkit-common.h
|
||||
index d23fedb0..4b42c9d7 100644
|
||||
--- a/include/nbdkit-common.h
|
||||
+++ b/include/nbdkit-common.h
|
||||
@@ -204,6 +204,7 @@ NBDKIT_EXTERN_DECL (char *, nbdkit_peer_tls_issuer_dn,
|
||||
(void) NBDKIT_ATTRIBUTE_MALLOC (free));
|
||||
NBDKIT_EXTERN_DECL (void, nbdkit_shutdown, (void));
|
||||
NBDKIT_EXTERN_DECL (void, nbdkit_disconnect, (int force));
|
||||
+NBDKIT_EXTERN_DECL (const char *, nbdkit_name, (void));
|
||||
|
||||
NBDKIT_EXTERN_DECL (const char *, nbdkit_strdup_intern,
|
||||
(const char *str)
|
||||
diff --git a/server/nbdkit.syms b/server/nbdkit.syms
|
||||
index c22356fb..bf6bb378 100644
|
||||
--- a/server/nbdkit.syms
|
||||
+++ b/server/nbdkit.syms
|
||||
@@ -60,6 +60,7 @@
|
||||
nbdkit_get_export;
|
||||
nbdkit_get_extent;
|
||||
nbdkit_is_tls;
|
||||
+ nbdkit_name;
|
||||
nbdkit_nanosleep;
|
||||
nbdkit_next_context_close;
|
||||
nbdkit_next_context_open;
|
||||
diff --git a/server/public.c b/server/public.c
|
||||
index e1a45ed0..d08930dd 100644
|
||||
--- a/server/public.c
|
||||
+++ b/server/public.c
|
||||
@@ -1220,3 +1220,9 @@ nbdkit_disconnect (int force)
|
||||
conn->close (SHUT_WR);
|
||||
}
|
||||
}
|
||||
+
|
||||
+NBDKIT_DLL_PUBLIC const char *
|
||||
+nbdkit_name (void)
|
||||
+{
|
||||
+ return process_name;
|
||||
+}
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index beeb0fc3..f0665926 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -272,6 +272,7 @@ TESTS += \
|
||||
test-version-filter.sh \
|
||||
test-name.sh \
|
||||
test-no-name.sh \
|
||||
+ test-name-plugin.sh \
|
||||
test-dump-plugin-example1.sh \
|
||||
test-dump-plugin.sh \
|
||||
test-dump-plugin-example2.sh \
|
||||
@@ -385,6 +386,7 @@ EXTRA_DIST += \
|
||||
test-log-to-file-append.sh \
|
||||
test-long-name.sh \
|
||||
test-name.sh \
|
||||
+ test-name-plugin.sh \
|
||||
test-nbd-client-tls.sh \
|
||||
test-nbd-client.sh \
|
||||
test-nbdkit-backend-debug.sh \
|
||||
@@ -578,6 +580,29 @@ test_debug_hexdiff_plugin_la_LDFLAGS = \
|
||||
$(NULL)
|
||||
test_debug_hexdiff_plugin_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
|
||||
|
||||
+# check_LTLIBRARIES won't build a shared library (see automake manual).
|
||||
+# So we have to do this and add a dependency.
|
||||
+noinst_LTLIBRARIES += \
|
||||
+ test-name-plugin.la \
|
||||
+ $(NULL)
|
||||
+test-name-plugin.sh: test-name-plugin.la
|
||||
+
|
||||
+test_name_plugin_la_SOURCES = \
|
||||
+ test-name-plugin.c \
|
||||
+ $(top_srcdir)/include/nbdkit-plugin.h \
|
||||
+ $(NULL)
|
||||
+test_name_plugin_la_CPPFLAGS = \
|
||||
+ -I$(top_srcdir)/include \
|
||||
+ -I$(top_builddir)/include \
|
||||
+ $(NULL)
|
||||
+test_name_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
|
||||
+# For use of the -rpath option, see:
|
||||
+# https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
|
||||
+test_name_plugin_la_LDFLAGS = \
|
||||
+ -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) -rpath /nowhere \
|
||||
+ $(NULL)
|
||||
+test_name_plugin_la_LIBADD = $(IMPORT_LIBRARY_ON_WINDOWS)
|
||||
+
|
||||
endif HAVE_PLUGINS
|
||||
|
||||
# Test the header files can be included on their own.
|
||||
diff --git a/tests/test-name-plugin.c b/tests/test-name-plugin.c
|
||||
new file mode 100644
|
||||
index 00000000..a4f8073b
|
||||
--- /dev/null
|
||||
+++ b/tests/test-name-plugin.c
|
||||
@@ -0,0 +1,88 @@
|
||||
+/* nbdkit
|
||||
+ * Copyright Red Hat
|
||||
+ *
|
||||
+ * 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.
|
||||
+ */
|
||||
+
|
||||
+/* This plugin reflects the nbdkit --name parameter back through the
|
||||
+ * content of the plugin. If not set, the content is "NONE" (4 bytes).
|
||||
+ *
|
||||
+ * The corresponding test is 'test-name-plugin.sh'.
|
||||
+ */
|
||||
+
|
||||
+#include <config.h>
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#define NBDKIT_API_VERSION 2
|
||||
+#include <nbdkit-plugin.h>
|
||||
+
|
||||
+static const char *name;
|
||||
+
|
||||
+static void
|
||||
+name_load (void)
|
||||
+{
|
||||
+ /* The API can return NULL, it's not an error. */
|
||||
+ name = nbdkit_name () ? : "NONE";
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+flush_open (int readonly)
|
||||
+{
|
||||
+ return NBDKIT_HANDLE_NOT_NEEDED;
|
||||
+}
|
||||
+
|
||||
+static int64_t
|
||||
+flush_get_size (void *handle)
|
||||
+{
|
||||
+ return strlen (name);
|
||||
+}
|
||||
+
|
||||
+#define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL
|
||||
+
|
||||
+static int
|
||||
+flush_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
|
||||
+ uint32_t flags)
|
||||
+{
|
||||
+ memcpy (buf, &name[offset], count);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct nbdkit_plugin plugin = {
|
||||
+ .name = "name",
|
||||
+ .version = PACKAGE_VERSION,
|
||||
+ .load = name_load,
|
||||
+ .open = flush_open,
|
||||
+ .get_size = flush_get_size,
|
||||
+ .pread = flush_pread,
|
||||
+};
|
||||
+
|
||||
+NBDKIT_REGISTER_PLUGIN (plugin)
|
||||
diff --git a/tests/test-name-plugin.sh b/tests/test-name-plugin.sh
|
||||
new file mode 100755
|
||||
index 00000000..842d0da7
|
||||
--- /dev/null
|
||||
+++ b/tests/test-name-plugin.sh
|
||||
@@ -0,0 +1,60 @@
|
||||
+#!/usr/bin/env bash
|
||||
+# nbdkit
|
||||
+# Copyright Red Hat
|
||||
+#
|
||||
+# 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 nbdkit_name () API.
|
||||
+
|
||||
+source ./functions.sh
|
||||
+set -e
|
||||
+set -x
|
||||
+set -u
|
||||
+
|
||||
+requires_run
|
||||
+requires_nbdcopy
|
||||
+
|
||||
+plugin=.libs/test-name-plugin.$SOEXT
|
||||
+requires test -f $plugin
|
||||
+
|
||||
+out=name-plugin.out
|
||||
+cleanup_fn rm -f "$out"
|
||||
+rm -f "$out"
|
||||
+
|
||||
+# nbdkit with --name parameter.
|
||||
+export out
|
||||
+nbdkit --name TEST "$plugin" --run 'nbdcopy "$uri" "$out"'
|
||||
+test "$(cat "$out")" = "TEST"
|
||||
+
|
||||
+nbdkit --name "" "$plugin" --run 'nbdcopy "$uri" "$out"'
|
||||
+test "$(cat "$out")" = ""
|
||||
+
|
||||
+# nbdkit without --name parameter.
|
||||
+nbdkit "$plugin" --run 'nbdcopy "$uri" "$out"'
|
||||
+test "$(cat "$out")" = "NONE"
|
||||
--
|
||||
2.47.3
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
From 67ce065641e4da313e54b80352c6d7a8599d08ab Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 15 Jan 2026 15:02:53 +0000
|
||||
Subject: [PATCH] server/test-public.c: Add process_name dummy variable
|
||||
|
||||
This is required for the test to link correctly:
|
||||
|
||||
libtool: link: gcc -Wall -Wshadow -Wvla -Werror -g -O2 -o test-public test_public-test-public.o test_public-public.o test_public-exports.o test_public-extents.o ../common/utils/.libs/libutils.a -lpthread -lz ../common/replacements/.libs/libcompat.a -lm -pthread
|
||||
/usr/bin/ld: test_public-public.o: in function `nbdkit_name':
|
||||
/builds/nbdkit/nbdkit/server/public.c:1228:(.text+0x1e53): undefined reference to `process_name'
|
||||
|
||||
(cherry picked from commit 038e79802d5872a7a5e9079bdfee9fe1caa5459b)
|
||||
---
|
||||
server/test-public.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/server/test-public.c b/server/test-public.c
|
||||
index 65b17d59..3ef530ff 100644
|
||||
--- a/server/test-public.c
|
||||
+++ b/server/test-public.c
|
||||
@@ -71,6 +71,7 @@ bool listen_stdin;
|
||||
bool configured;
|
||||
bool verbose;
|
||||
int tls;
|
||||
+const char *process_name;
|
||||
|
||||
volatile int quit;
|
||||
#ifndef WIN32
|
||||
--
|
||||
2.47.3
|
||||
|
||||
31
nbdkit.spec
31
nbdkit.spec
@ -55,7 +55,7 @@
|
||||
|
||||
Name: nbdkit
|
||||
Version: 1.46.1
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: NBD server
|
||||
|
||||
License: BSD-3-Clause
|
||||
@ -82,14 +82,21 @@ Source3: copy-patches.sh
|
||||
# Patches.
|
||||
Patch0001: 0001-python-Link-to-C-man-pages-for-module-functions.patch
|
||||
Patch0002: 0002-python-Sort-documentation-for-module-functions-in-or.patch
|
||||
Patch0003: 0003-server-Add-nbdkit_debug_hexdiff-function.patch
|
||||
Patch0004: 0004-checkwrite-Display-differences-if-D-checkwrite.showd.patch
|
||||
Patch0005: 0005-docs-nbdkit_debug_hexdump.pod-Document-when-hexdiff-.patch
|
||||
Patch0006: 0006-docs-nbdkit_debug_hexdump.pod-Add-a-link-back-to-nbd.patch
|
||||
Patch0007: 0007-blocksize-policy-Fix-assertion-failure-on-unaligned-.patch
|
||||
Patch0008: 0008-file-Don-t-advertise-minimum_io_size-64K-the-max-sup.patch
|
||||
Patch0009: 0009-todo-Add-note-about-problems-with-file-plugin-block_.patch
|
||||
Patch0010: 0010-file-Change-calculations-of-block-size-hints-for-blo.patch
|
||||
Patch0003: 0003-blocksize-policy-Fix-assertion-failure-on-unaligned-.patch
|
||||
Patch0004: 0004-file-Don-t-advertise-minimum_io_size-64K-the-max-sup.patch
|
||||
Patch0005: 0005-todo-Add-note-about-problems-with-file-plugin-block_.patch
|
||||
Patch0006: 0006-file-Change-calculations-of-block-size-hints-for-blo.patch
|
||||
Patch0007: 0007-qcow2dec-Don-t-pass-flags-from-.extents-through-to-..patch
|
||||
Patch0008: 0008-vddk-Test-with-VDDK-9.0.1.0.patch
|
||||
Patch0009: 0009-configure.ac-Remove-use-of-which-command.patch
|
||||
Patch0010: 0010-map-Fix-documentation-about-changing-the-size-of-the.patch
|
||||
Patch0011: 0011-common-utils-utils.h-Add-C-boilerplate.patch
|
||||
Patch0012: 0012-server-Add-nbdkit_debug_hexdiff-function.patch
|
||||
Patch0013: 0013-checkwrite-Display-differences-if-D-checkwrite.showd.patch
|
||||
Patch0014: 0014-docs-nbdkit_debug_hexdump.pod-Document-when-hexdiff-.patch
|
||||
Patch0015: 0015-docs-nbdkit_debug_hexdump.pod-Add-a-link-back-to-nbd.patch
|
||||
Patch0016: 0016-Add-new-nbdkit_name-function.patch
|
||||
Patch0017: 0017-server-test-public.c-Add-process_name-dummy-variable.patch
|
||||
|
||||
# For automatic RPM Provides generation.
|
||||
# See: https://rpm-software-management.github.io/rpm/manual/dependency_generators.html
|
||||
@ -1597,9 +1604,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jan 12 2026 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-2
|
||||
* Tue Jan 20 2026 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-3
|
||||
- Rebase to nbdkit 1.46.1
|
||||
- Backport nbdkit_debug_hexdiff from nbdkit 1.47.
|
||||
- Backport nbdkit_debug_hexdiff and nbdkit_name from nbdkit 1.47.
|
||||
resolves: RHEL-111242
|
||||
- Synchronize spec file with Fedora.
|
||||
- vddk: Don't use FNM_PATHNAME when matching export parameter
|
||||
@ -1607,6 +1614,8 @@ fi
|
||||
- Fix assertion failure in blocksize-policy filter
|
||||
- Fix v2v conversion failure when minimum_io_size > 64K
|
||||
resolves: RHEL-139390
|
||||
- Test and document that VDDK 9.0.1.0 works
|
||||
resolves: RHEL-140615
|
||||
|
||||
* Wed Jul 09 2025 Richard W.M. Jones <rjones@redhat.com> - 1.44.1-2
|
||||
- Rebase to nbdkit 1.44.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user