Skip to content

Commit

Permalink
Fix clippy smells
Browse files Browse the repository at this point in the history
  • Loading branch information
touilleMan committed Aug 7, 2024
1 parent f504380 commit c7f0382
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
8 changes: 4 additions & 4 deletions winfsp_wrs/src/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ pub trait FileSystemContext {
/// - reparse (false if `reparse_point` is not supported)
///
/// [help]:
/// - find_reparse_point (optional, can be ignored): helper to find reparse
/// points (`get_reparse_point_by_name` should be implemented)
/// if reparse point is found, return the `FileAttributes` and `reparse` should be
/// set to `true`.
/// - find_reparse_point (optional, can be ignored): Helper to find reparse
/// points (`get_reparse_point_by_name` should be implemented).
/// If reparse point is found, return the `FileAttributes` and `reparse` should be
/// set to `true`.
fn get_security_by_name(
&self,
file_name: &U16CStr,
Expand Down
31 changes: 19 additions & 12 deletions winfsp_wrs/src/file_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ use crate::{FileAccessRights, FileAttributes, FileCreationDisposition, FileShare
pub enum OperationGuardStrategy {
#[default]
/// A fine-grained concurrency model where file system NAMESPACE accesses are
/// guarded using an exclusive-shared (read-write) lock. File I/O is not
/// guarded and concurrent reads/writes/etc. are possible. [Note that the FSD
/// will still apply an exclusive-shared lock PER INDIVIDUAL FILE, but it will
/// not limit I/O operations for different files.] The fine-grained concurrency
/// model applies the exclusive-shared lock as follows:
/// guarded using an exclusive-shared (read-write) lock.
///
/// File I/O is not guarded and concurrent reads/writes/etc. are possible. (Note
/// that the FSD will still apply an exclusive-shared lock PER INDIVIDUAL FILE,
/// but it will not limit I/O operations for different files.)
///
/// The fine-grained concurrency model applies the exclusive-shared lock as follows:
/// - EXCL: SetVolumeLabel, Flush(Volume), Create, Cleanup(Delete),
/// SetInformation(Rename)
/// SetInformation(Rename)
/// - SHRD: GetVolumeInfo, Open, SetInformation(Disposition), ReadDirectory
/// - NONE: all other operations
Fine = FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY_FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY_FINE,
Expand Down Expand Up @@ -336,12 +338,14 @@ impl<Ctx: FileSystemContext> FileSystem<Ctx> {
&mut self.params.volume_params
}

/// - Create a file system object.
/// - Set file system locking strategy.
/// - Set the mount point for a file system.
/// A value of None means that the file system should use the next available
/// drive letter counting downwards from Z: as its mount point.
/// - Start the file system dispatcher.
/// Start the mountpoint, i.e.:
/// - Create a file system object (`FspFileSystemCreate`).
/// - Set file system locking strategy (`FspFileSystemSetOperationGuardStrategyF`).
/// - Set the mount point for a file system (`FspFileSystemSetMountPoint`).
/// - Start the file system dispatcher (`FspFileSystemStartDispatcher`).
///
/// A value of `None` for `mountpoint` means that the file system should use
/// the next available drive letter counting downwards from `Z:`.
pub fn new(
mut params: Params,
mountpoint: Option<&U16CStr>,
Expand Down Expand Up @@ -476,6 +480,9 @@ impl<Ctx: FileSystemContext> FileSystem<Ctx> {
}
}

/// Stop the mountpoint, i.e.:
/// - Stop the file system dispatcher (`FspFileSystemStopDispatcher`).
/// - Remove the mount point for the file system (`FspFileSystemRemoveMountPoint`).
pub fn stop(mut self) {
unsafe {
FspFileSystemStopDispatcher(&mut self.inner);
Expand Down
5 changes: 4 additions & 1 deletion winfsp_wrs/src/security.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ impl SecurityDescriptor {
// Free psd
FspDeleteSecurityDescriptor(
psd,
Some(std::mem::transmute(FspSetSecurityDescriptor as *const ())),
Some(std::mem::transmute::<
*const (),
unsafe extern "C" fn() -> i32,
>(FspSetSecurityDescriptor as *const ())),
);

Ok(sd)
Expand Down

0 comments on commit c7f0382

Please sign in to comment.