The NBD protocol is adding an extension to let servers advertise
initialization state to the client: whether the image contains holes,
and whether it is known to read as all zeroes. For Rust, the changes
are just copy-and-paste, but I wasn't sure how to test them beyond a
successful build.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
plugins/rust/nbdkit-rust-plugin.pod | 2 +-
plugins/rust/src/lib.rs | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/plugins/rust/nbdkit-rust-plugin.pod b/plugins/rust/nbdkit-rust-plugin.pod
index 77eb0c4..5fcd7ff 100644
--- a/plugins/rust/nbdkit-rust-plugin.pod
+++ b/plugins/rust/nbdkit-rust-plugin.pod
@@ -103,7 +103,7 @@ C<nbdkit::ThreadModel::Parallel>.
=over 4
-=item Missing: C<can_extents> and C<extents>
+=item Missing: C<can_extents>, C<extents>, C<preconnect>.
These are not yet supported.
diff --git a/plugins/rust/src/lib.rs b/plugins/rust/src/lib.rs
index 2d691e7..58bbc62 100644
--- a/plugins/rust/src/lib.rs
+++ b/plugins/rust/src/lib.rs
@@ -107,6 +107,12 @@ pub struct Plugin {
pub thread_model: Option<extern fn () -> ThreadModel>,
pub can_fast_zero: Option<extern fn (h: *mut c_void) -> c_int>,
+
+ // Slot for preconnect function, which needs more integration.
+ _preconnect: Option<extern fn ()>,
+
+ pub init_sparse: Option<extern fn (h: *mut c_void) -> c_int>,
+ pub init_zero: Option<extern fn (h: *mut c_void) -> c_int>,
}
#[repr(C)]
@@ -166,6 +172,9 @@ impl Plugin {
cache: None,
thread_model: None,
can_fast_zero: None,
+ _preconnect: None,
+ init_sparse: None,
+ init_zero: None,
}
}
}
--
2.24.1