Skip to content

Commit

Permalink
Explicitly implement Send for FileSystem (needed by underlying FSP_FI…
Browse files Browse the repository at this point in the history
…LE_SYSTEM ffi stuff)
  • Loading branch information
touilleMan committed Mar 17, 2024
1 parent 17d72b4 commit 1affd10
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions winfsp_wrs/src/file_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ pub struct FileSystem<Ctx: FileSystemContext> {
phantom: PhantomData<Ctx>,
}

// SAFETY: FSP_FILE_SYSTEM contains `*mut c_void` pointers that cannot be send between threads
// by default. However this structure is only used by WinFSP (and not exposed to the user) which
// is deep in C++ land where Rust safety rules do not apply.
unsafe impl<Ctx: FileSystemContext> Send for FileSystem<Ctx> {}

impl<Ctx: FileSystemContext> FileSystem<Ctx> {
pub fn volume_params(&self) -> &VolumeParams {
&self.params.volume_params
Expand Down

0 comments on commit 1affd10

Please sign in to comment.