Displaying 6 results from an estimated 6 matches for "ramdisk_get_size".
2019 Jun 11
3
[nbdkit PATCH 0/2] Few rust plugin fixups/nitpicks
There are few more things that could be cleaned up related to the coding style
and other things, like explicitly specifying the abi style after "extern"
(i.e. `extern "C" fn` instead of `extern fn`), but since those are configurable
in rustfmt config, I'm not sure whether the config needs to be added or
complying with the defaults should be the priority. But this was just
2019 Aug 16
0
[nbdkit PATCH 2/2] rust: Add support for dynamic .thread_model
...t;ramdisk\0" as *const str as *const [c_char] as *const c_char;
- // Create a mutable plugin, setting the 5 required fields.
+ // Create a mutable plugin, setting the 4 required fields.
let mut plugin = Plugin::new (
- Parallel,
name,
ramdisk_open,
ramdisk_get_size,
@@ -109,6 +112,7 @@ pub extern fn plugin_init () -> *const Plugin {
// Update any other fields as required.
plugin.close = Some (ramdisk_close);
plugin.pwrite = Some (ramdisk_pwrite);
+ plugin.thread_model = Some (ramdisk_thread_model);
// Return the pointer.
let pl...
2019 Feb 08
0
[PATCH nbdkit] Add support for writing plugins in Rust.
...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);
+}
+
+extern fn ramdisk_get_size (_h: *mut c_void) -> int64_t {
+ return DISK.lock().unwrap().capacity() as int64_t;
+}
+
+extern fn ramdisk_pread (_h: *mut c_void, buf: *mut c_char, count: uint32_t,
+ offset: uint64_t, _flags: uint32_t) -> c_int {
+ let offset = offset as usize;
+ let count...
2019 Aug 16
1
Re: [nbdkit PATCH 2/2] rust: Add support for dynamic .thread_model
...t [c_char] as *const c_char;
>
> - // Create a mutable plugin, setting the 5 required fields.
> + // Create a mutable plugin, setting the 4 required fields.
> let mut plugin = Plugin::new (
> - Parallel,
> name,
> ramdisk_open,
> ramdisk_get_size,
> @@ -109,6 +112,7 @@ pub extern fn plugin_init () -> *const Plugin {
> // Update any other fields as required.
> plugin.close = Some (ramdisk_close);
> plugin.pwrite = Some (ramdisk_pwrite);
> + plugin.thread_model = Some (ramdisk_thread_model);
>
>...
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
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