Skip to content

Commit b40dd08

Browse files
RoyLinRoyLin
authored andcommitted
fix(macos): gate no_fsync method and call site for macOS only
The no_fsync feature is specific to macOS HVF framework which uses a global shared lock. This commit gates the set_no_fsync method and its call site so they only apply on macOS. Fixes Linux build failure where no_fsync field doesn't exist in the Linux Config struct.
1 parent 3834e84 commit b40dd08

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

src/devices/src/virtio/fs/device.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ impl Fs {
148148
self.passthrough_cfg.export_fsid
149149
}
150150

151+
#[cfg(target_os = "macos")]
151152
pub fn set_no_fsync(&mut self, no_fsync: bool) {
152153
self.passthrough_cfg.no_fsync = no_fsync;
153154
}

src/vmm/src/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,6 +3668,7 @@ fn attach_fs_devices(
36683668
let id = format!("{}{}", String::from(fs.lock().unwrap().id()), i);
36693669

36703670
// Set no_fsync option if enabled
3671+
#[cfg(target_os = "macos")]
36713672
if config.no_fsync {
36723673
fs.lock().unwrap().set_no_fsync(true);
36733674
}

0 commit comments

Comments
 (0)