From 05aa9ebcd412476d79964d749a9a17f6c8473984 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 14 Mar 2026 13:26:52 +0100 Subject: [PATCH] block: Replace local FALLOC_FL_* constants with libc::* in probe probe_file_sparse_support() defined FALLOC_FL_KEEP_SIZE, FALLOC_FL_PUNCH_HOLE, and FALLOC_FL_ZERO_RANGE as local constants. These are available from the libc crate directly. Signed-off-by: Anatol Belski --- block/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/block/src/lib.rs b/block/src/lib.rs index 6e3e50178..c02b315cc 100644 --- a/block/src/lib.rs +++ b/block/src/lib.rs @@ -45,7 +45,9 @@ use std::{cmp, mem, result}; #[cfg(feature = "io_uring")] use io_uring::{IoUring, Probe, opcode}; -use libc::{S_IFBLK, S_IFMT, ioctl}; +use libc::{ + FALLOC_FL_KEEP_SIZE, FALLOC_FL_PUNCH_HOLE, FALLOC_FL_ZERO_RANGE, S_IFBLK, S_IFMT, ioctl, +}; use log::{debug, error, info, warn}; use serde::{Deserialize, Serialize}; use smallvec::SmallVec; @@ -807,10 +809,6 @@ pub fn probe_sparse_support(file: &File) -> bool { /// Probe sparse support for a regular file using fallocate(). fn probe_file_sparse_support(fd: libc::c_int) -> bool { - const FALLOC_FL_KEEP_SIZE: libc::c_int = 0x01; - const FALLOC_FL_PUNCH_HOLE: libc::c_int = 0x02; - const FALLOC_FL_ZERO_RANGE: libc::c_int = 0x10; - // SAFETY: FFI call with valid fd let file_size = unsafe { libc::lseek(fd, 0, libc::SEEK_END) }; if file_size < 0 {