On Fri, Aug 16, 2019 at 12:08:10PM -0500, Eric Blake wrote:
Implementing extents requires some coordination for the Rust code to call back into libnbdkit; I'm not familiar with Rust enough to do that. But with placeholders for those slots, implementing can_cache/cache is trivial. This improves the situation mentioned in commit 031fae85.
Signed-off-by: Eric Blake <eblake@redhat.com> --- plugins/rust/nbdkit-rust-plugin.pod | 10 ++++++++++ plugins/rust/src/lib.rs | 13 +++++++++++++ 2 files changed, 23 insertions(+)
diff --git a/plugins/rust/nbdkit-rust-plugin.pod b/plugins/rust/nbdkit-rust-plugin.pod index db2a55ee..930829cc 100644 --- a/plugins/rust/nbdkit-rust-plugin.pod +++ b/plugins/rust/nbdkit-rust-plugin.pod @@ -90,6 +90,16 @@ thread models, see L<nbdkit-plugin(3)/THREADS>.
=back
+=head2 Missing callbacks + +=over 4 + +=item Missing: C<can_extents> and C<extents> + +These are not yet supported. + +=back + =head1 SEE ALSO
L<nbdkit(1)>, diff --git a/plugins/rust/src/lib.rs b/plugins/rust/src/lib.rs index a3dbf43e..25af2fe6 100644 --- a/plugins/rust/src/lib.rs +++ b/plugins/rust/src/lib.rs @@ -93,6 +93,15 @@ pub struct Plugin { pub magic_config_key: *const c_char,
pub can_multi_conn: Option<extern fn (h: *mut c_void) -> c_int>, + + // Slots for extents functions, which needs more integration. + _can_extents: Option<extern fn ()>, + _extents: Option<extern fn ()>, + + pub can_cache: Option<extern fn (h: *mut c_void) -> c_int>, + pub cache: Option<extern fn (h: *mut c_void, + count: u32, offset: u64, + flags: u32) -> c_int>, }
pub enum ThreadModel { @@ -146,6 +155,10 @@ impl Plugin { zero: None, magic_config_key: std::ptr::null(), can_multi_conn: None, + _can_extents: None, + _extents: None, + can_cache: None, + cache: None, } } }
This one seems straightforward, so ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top