mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: raw: Replace FALLOC_FL_* consts with libc::* in raw backends
raw_sync, raw_async, and raw_async_aio each defined FALLOC_FL_PUNCH_HOLE, FALLOC_FL_KEEP_SIZE, and FALLOC_FL_ZERO_RANGE as local constants in their punch_hole() and write_zeroes() implementations. These are available from the libc crate directly. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
05aa9ebcd4
commit
1733e08a0f
@@ -7,6 +7,7 @@ use std::fs::File;
|
||||
use std::io::{Seek, SeekFrom};
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
|
||||
use libc::{FALLOC_FL_KEEP_SIZE, FALLOC_FL_PUNCH_HOLE, FALLOC_FL_ZERO_RANGE};
|
||||
use log::warn;
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
@@ -161,8 +162,6 @@ impl AsyncIo for RawFileSync {
|
||||
}
|
||||
|
||||
fn punch_hole(&mut self, offset: u64, length: u64, user_data: u64) -> AsyncIoResult<()> {
|
||||
const FALLOC_FL_PUNCH_HOLE: i32 = 0x02;
|
||||
const FALLOC_FL_KEEP_SIZE: i32 = 0x01;
|
||||
let mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
|
||||
|
||||
// SAFETY: FFI call with valid arguments
|
||||
@@ -185,8 +184,6 @@ impl AsyncIo for RawFileSync {
|
||||
}
|
||||
|
||||
fn write_zeroes(&mut self, offset: u64, length: u64, user_data: u64) -> AsyncIoResult<()> {
|
||||
const FALLOC_FL_ZERO_RANGE: i32 = 0x10;
|
||||
const FALLOC_FL_KEEP_SIZE: i32 = 0x01;
|
||||
let mode = FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE;
|
||||
|
||||
// SAFETY: FFI call with valid arguments
|
||||
|
||||
Reference in New Issue
Block a user