Skip to content

Commit d612337

Browse files
committed
fix Windows sparsify: use Win32_System_Ioctl for FSCTL constants, fix HANDLE type
Signed-off-by: danbugs <danilochiarlone@gmail.com>
1 parent 8cb5a38 commit d612337

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

host/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ nix = { version = "0.29", features = ["fs"] }
4141
libc = "0.2"
4242

4343
[target.'cfg(windows)'.dependencies]
44-
windows-sys = { version = "0.61", features = ["Win32_System_IO", "Win32_Storage_FileSystem"] }
44+
windows-sys = { version = "0.61", features = ["Win32_System_IO", "Win32_System_Ioctl", "Win32_Storage_FileSystem"] }
4545

host/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,15 +1593,15 @@ fn sparsify_snapshot(path: &Path) -> Result<()> {
15931593
#[cfg(target_os = "windows")]
15941594
fn sparsify_snapshot(path: &Path) -> Result<()> {
15951595
use std::os::windows::io::AsRawHandle;
1596-
use windows_sys::Win32::Storage::FileSystem::{FSCTL_SET_SPARSE, FSCTL_SET_ZERO_DATA};
1596+
use windows_sys::Win32::System::Ioctl::{FSCTL_SET_SPARSE, FSCTL_SET_ZERO_DATA};
15971597
use windows_sys::Win32::System::IO::DeviceIoControl;
15981598

15991599
let file = std::fs::OpenOptions::new()
16001600
.read(true)
16011601
.write(true)
16021602
.open(path)?;
16031603
let len = file.metadata()?.len();
1604-
let handle = file.as_raw_handle() as isize;
1604+
let handle = file.as_raw_handle();
16051605

16061606
// Mark file as sparse.
16071607
let ok = unsafe {

0 commit comments

Comments
 (0)