Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Experimental Filesystem version using closures.

use core::ffi::{c_int, c_void};
use core::marker::PhantomData;
use core::ptr::addr_of;
use core::ptr::addr_of_mut;
use core::{
Expand Down Expand Up @@ -613,6 +614,7 @@ pub struct File<'a, 'b, S: driver::Storage> {
// We must store a raw pointer here since the FFI retains a copy of a pointer
// to the field alloc.state, so we cannot assert unique mutable access.
alloc: RefCell<*mut FileAllocation<S>>,
phantom: PhantomData<RefCell<&'b mut FileAllocation<S>>>,
fs: &'b Filesystem<'a, S>,
}

Expand Down Expand Up @@ -803,7 +805,7 @@ impl OpenOptions {
pub unsafe fn open<'a, 'b, S: driver::Storage>(
&self,
fs: &'b Filesystem<'a, S>,
alloc: &mut FileAllocation<S>,
alloc: &'b mut FileAllocation<S>,
path: &Path,
) -> Result<File<'a, 'b, S>> {
alloc.config.buffer = alloc.cache.get() as *mut _;
Expand All @@ -820,6 +822,7 @@ impl OpenOptions {

let file = File {
alloc: RefCell::new(alloc),
phantom: PhantomData,
fs,
};

Expand Down