search for: _not_used

Displaying 5 results from an estimated 5 matches for "_not_used".

Did you mean: not_used
2019 Aug 16
0
[nbdkit PATCH 2/2] rust: Add support for dynamic .thread_model
...odel defaults to +C<nbdkit::ThreadModel::Parallel>. =over 4 diff --git a/plugins/rust/examples/ramdisk.rs b/plugins/rust/examples/ramdisk.rs index 9d0af0ee..e9462fca 100644 --- a/plugins/rust/examples/ramdisk.rs +++ b/plugins/rust/examples/ramdisk.rs @@ -53,6 +53,10 @@ struct Handle { _not_used: i32, } +extern fn ramdisk_thread_model () -> ThreadModel { + Parallel +} + extern fn ramdisk_open (_readonly: c_int) -> *mut c_void { let h = Handle {_not_used: 0}; let h = Box::new(h); @@ -98,9 +102,8 @@ pub extern fn plugin_init () -> *const Plugin { // https://gith...
2019 Aug 16
1
Re: [nbdkit PATCH 2/2] rust: Add support for dynamic .thread_model
...arallel>. > > =over 4 > > diff --git a/plugins/rust/examples/ramdisk.rs b/plugins/rust/examples/ramdisk.rs > index 9d0af0ee..e9462fca 100644 > --- a/plugins/rust/examples/ramdisk.rs > +++ b/plugins/rust/examples/ramdisk.rs > @@ -53,6 +53,10 @@ struct Handle { > _not_used: i32, > } > > +extern fn ramdisk_thread_model () -> ThreadModel { > + Parallel > +} > + > extern fn ramdisk_open (_readonly: c_int) -> *mut c_void { > let h = Handle {_not_used: 0}; > let h = Box::new(h); > @@ -98,9 +102,8 @@ pub extern fn plugin_...
2019 Aug 16
7
[nbdkit PATCH 0/2] rust: Implement some missing v2 callbacks
Similar to what I just did for OCaml (this IS an API break, requiring recompilation of any existing Rust plugin), and done because I want to add fast_zero support to both languages as part of my upcoming fast zero series. Figuring out how to get extents working was hard enough that I punted that, still. Eric Blake (2): rust: Implement can_cache rust: Add support for dynamic .thread_model
2019 Feb 08
0
[PATCH nbdkit] Add support for writing plugins in Rust.
...ic! { + static ref DISK: Mutex<Vec<u8>> = Mutex::new (vec![0; 100 * 1024 * 1024]); +} + +struct Handle { + // Box::new doesn't allocate anything unless we put some dummy + // fields here. In a real implementation you would put per-handle + // data here as required. + _not_used: i32, +} + +extern fn ramdisk_open (_readonly: c_int) -> *mut c_void { + let h = Handle {_not_used: 0}; + let h = Box::new(h); + return Box::into_raw(h) as *mut c_void; +} + +extern fn ramdisk_close (h: *mut c_void) { + let h = unsafe { Box::from_raw(h as *mut Handle) }; + drop (h...
2019 Feb 08
3
[PATCH nbdkit] Add support for writing plugins in Rust.
This adds very rough support for writing nbdkit plugins in Rust. This is not very idiomatic -- essentially we're handling the direct C calls from nbdkit in Rust. We have to use ‘unsafe’ in a few places because there's no way to tell the Rust code that nbdkit satisfies guarantees (eg. around thread safety, always returning leaked pointers back to the close function, always doing bounds