compio_driver\sys\op\fs/
iocp.rs1use windows_sys::Win32::{
2 Foundation::CloseHandle, Storage::FileSystem::FlushFileBuffers, System::IO::OVERLAPPED,
3};
4
5use crate::{OpCode, OpType, sys::op::*};
6
7unsafe impl OpCode for CloseFile {
8 type Control = ();
9
10 fn op_type(&self, _: &Self::Control) -> OpType {
11 OpType::Blocking
12 }
13
14 unsafe fn operate(&mut self, _: &mut (), _optr: *mut OVERLAPPED) -> Poll<io::Result<usize>> {
15 Poll::Ready(Ok(
16 syscall!(BOOL, CloseHandle(self.fd.as_fd().as_raw_fd()))? as _,
17 ))
18 }
19}
20
21unsafe impl<S: AsFd> OpCode for Sync<S> {
22 type Control = ();
23
24 fn op_type(&self, _: &Self::Control) -> OpType {
25 OpType::Blocking
26 }
27
28 unsafe fn operate(&mut self, _: &mut (), _optr: *mut OVERLAPPED) -> Poll<io::Result<usize>> {
29 Poll::Ready(Ok(
30 syscall!(BOOL, FlushFileBuffers(self.fd.as_fd().as_raw_fd()))? as _,
31 ))
32 }
33}