From 7e514d8d0e8b099c2dab2ede0427ac38609475d3 Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Tue, 24 Mar 2026 17:24:54 -0700 Subject: [PATCH] block: Implement Geometry trait for RawFileDisk Add disk_file::Geometry trait implementation for RawFileDisk. Probes disk topology from the file, falling back to defaults on failure. Takes &self instead of &mut self and uses unwrap_or_else for cleaner error handling. Signed-off-by: Muminul Islam --- block/src/raw_async.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/src/raw_async.rs b/block/src/raw_async.rs index c08f501c4..e5ba96de3 100644 --- a/block/src/raw_async.rs +++ b/block/src/raw_async.rs @@ -96,6 +96,15 @@ impl disk_file::DiskFd for RawFileDisk { } } +impl disk_file::Geometry for RawFileDisk { + fn topology(&self) -> DiskTopology { + DiskTopology::probe(&self.file).unwrap_or_else(|_| { + warn!("Unable to get device topology. Using default topology"); + DiskTopology::default() + }) + } +} + pub struct RawFileAsync { fd: RawFd, io_uring: IoUring,