From a89d7aa2c063657bc419d0dc2fd8239843868772 Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Tue, 7 Sep 2021 11:49:14 -0400 Subject: [PATCH] Use platform-independent data sync (fixes Mac build) --- propolis/src/block.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/propolis/src/block.rs b/propolis/src/block.rs index 051c21021..f3b842216 100644 --- a/propolis/src/block.rs +++ b/propolis/src/block.rs @@ -4,7 +4,6 @@ use std::collections::VecDeque; use std::fs::{metadata, File, OpenOptions}; use std::io::Result; use std::io::{Error, ErrorKind}; -use std::os::unix::io::AsRawFd; use std::path::Path; use std::sync::Condvar; use std::sync::{Arc, Mutex, Weak}; @@ -178,13 +177,8 @@ impl FileBdev { /// Send flush to the file fn process_flush(&self) -> Result { - let res = unsafe { libc::fdatasync(self.fp.as_raw_fd()) }; - - if res == -1 { - Err(Error::new(ErrorKind::Other, "file flush failed")) - } else { - Ok(BlockResult::Success) - } + self.fp.sync_data()?; + Ok(BlockResult::Success) } /// Spawns a new thread named `name` on the dispatcher `disp` which