diff --git a/block/src/async_io.rs b/block/src/async_io.rs index 6298dc068..935c259be 100644 --- a/block/src/async_io.rs +++ b/block/src/async_io.rs @@ -51,7 +51,7 @@ enum BlockSize { } impl DiskTopology { - fn is_block_device(f: &mut File) -> std::io::Result { + fn is_block_device(f: &File) -> std::io::Result { let mut stat = std::mem::MaybeUninit::::uninit(); // SAFETY: FFI call with a valid fd and buffer let ret = unsafe { libc::fstat(f.as_raw_fd(), stat.as_mut_ptr()) }; @@ -65,7 +65,7 @@ impl DiskTopology { } // libc::ioctl() takes different types on different architectures - fn query_block_size(f: &mut File, block_size_type: BlockSize) -> std::io::Result { + fn query_block_size(f: &File, block_size_type: BlockSize) -> std::io::Result { let mut block_size = 0; // SAFETY: FFI call with correct arguments let ret = unsafe { @@ -87,7 +87,7 @@ impl DiskTopology { Ok(block_size) } - pub fn probe(f: &mut File) -> std::io::Result { + pub fn probe(f: &File) -> std::io::Result { if !Self::is_block_device(f)? { return Ok(DiskTopology::default()); } diff --git a/block/src/raw_async.rs b/block/src/raw_async.rs index a723fe670..95aafa483 100644 --- a/block/src/raw_async.rs +++ b/block/src/raw_async.rs @@ -36,7 +36,7 @@ impl DiskFile for RawFileDisk { } fn topology(&mut self) -> DiskTopology { - if let Ok(topology) = DiskTopology::probe(&mut self.file) { + if let Ok(topology) = DiskTopology::probe(&self.file) { topology } else { warn!("Unable to get device topology. Using default topology"); diff --git a/block/src/raw_sync.rs b/block/src/raw_sync.rs index a66a36923..66428ba35 100644 --- a/block/src/raw_sync.rs +++ b/block/src/raw_sync.rs @@ -33,7 +33,7 @@ impl DiskFile for RawFileDiskSync { } fn topology(&mut self) -> DiskTopology { - if let Ok(topology) = DiskTopology::probe(&mut self.file) { + if let Ok(topology) = DiskTopology::probe(&self.file) { topology } else { warn!("Unable to get device topology. Using default topology");