Files
cloud-hypervisor/block
Wei Liu 12919dbce9 block: extract is_block_device() helper and dedupe inline fstat probes
probe_sparse_support() and DiskTopology::is_block_device() each carry
their own copy of the same fstat()+S_IFMT dance to ask "is this fd a
block device?". Hoist a single pub helper

    pub(crate) fn is_block_device(fd: RawFd) -> bool

into block::lib and route both call sites through it. Drop the
MaybeUninit gymnastics in favour of mem::zeroed() since libc::stat is
POD.

Drop DiskTopology::is_block_device since it is now just a one line
wrapper around the new helper function.

Pure refactor in preparation for the BLKDISCARD/BLKZEROOUT support,
which needs the same probe in three more backends.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2026-05-14 22:35:02 +00:00
..
2026-05-09 14:10:25 +00:00