Skip to content

Commit 6ee42aa

Browse files
committed
feat(driver): use RawFd instead of HANDLE
1 parent e9b7e6f commit 6ee42aa

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

compio-driver/src/iocp/cp/global.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn iocp_start() -> io::Result<()> {
6161
syscall!(
6262
BOOL,
6363
PostQueuedCompletionStatus(
64-
overlapped.driver,
64+
overlapped.driver as _,
6565
entry.dwNumberOfBytesTransferred,
6666
entry.lpCompletionKey,
6767
entry.lpOverlapped,

compio-driver/src/iocp/cp/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use compio_log::*;
99
use windows_sys::Win32::{
1010
Foundation::{
1111
RtlNtStatusToDosError, ERROR_BAD_COMMAND, ERROR_HANDLE_EOF, ERROR_IO_INCOMPLETE,
12-
ERROR_NO_DATA, FACILITY_NTWIN32, HANDLE, INVALID_HANDLE_VALUE, NTSTATUS, STATUS_PENDING,
12+
ERROR_NO_DATA, FACILITY_NTWIN32, INVALID_HANDLE_VALUE, NTSTATUS, STATUS_PENDING,
1313
STATUS_SUCCESS,
1414
},
1515
Storage::FileSystem::SetFileCompletionNotificationModes,
@@ -120,7 +120,7 @@ impl CompletionPort {
120120
pub fn poll(
121121
&self,
122122
timeout: Option<Duration>,
123-
current_driver: Option<HANDLE>,
123+
current_driver: Option<RawFd>,
124124
) -> io::Result<impl Iterator<Item = Entry>> {
125125
Ok(self.poll_raw(timeout)?.map(move |entry| {
126126
// Any thin pointer is OK because we don't use the type of opcode.
@@ -132,7 +132,7 @@ impl CompletionPort {
132132
syscall!(
133133
BOOL,
134134
PostQueuedCompletionStatus(
135-
overlapped.driver,
135+
overlapped.driver as _,
136136
entry.dwNumberOfBytesTransferred,
137137
entry.lpCompletionKey,
138138
entry.lpOverlapped,

compio-driver/src/iocp/cp/multi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl Port {
2828
}
2929

3030
pub fn poll(&self, timeout: Option<Duration>) -> io::Result<impl Iterator<Item = Entry> + '_> {
31-
let current_id = self.as_raw_handle() as _;
31+
let current_id = self.as_raw_handle();
3232
self.port.poll(timeout, Some(current_id))
3333
}
3434
}

compio-driver/src/iocp/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use compio_buf::BufResult;
1717
use compio_log::{instrument, trace};
1818
use slab::Slab;
1919
use windows_sys::Win32::{
20-
Foundation::{ERROR_BUSY, ERROR_OPERATION_ABORTED, HANDLE},
20+
Foundation::{ERROR_BUSY, ERROR_OPERATION_ABORTED},
2121
Networking::WinSock::{WSACleanup, WSAStartup, WSADATA},
2222
System::IO::OVERLAPPED,
2323
};
@@ -294,7 +294,7 @@ pub struct Overlapped<T: ?Sized> {
294294
/// The base [`OVERLAPPED`].
295295
pub base: OVERLAPPED,
296296
/// The unique ID of created driver.
297-
pub driver: HANDLE,
297+
pub driver: RawFd,
298298
/// The registered user defined data.
299299
pub user_data: usize,
300300
/// The opcode.
@@ -303,7 +303,7 @@ pub struct Overlapped<T: ?Sized> {
303303
}
304304

305305
impl<T> Overlapped<T> {
306-
pub(crate) fn new(driver: HANDLE, user_data: usize, op: T) -> Self {
306+
pub(crate) fn new(driver: RawFd, user_data: usize, op: T) -> Self {
307307
Self {
308308
base: unsafe { std::mem::zeroed() },
309309
driver,
@@ -326,7 +326,7 @@ pub(crate) struct RawOp {
326326
}
327327

328328
impl RawOp {
329-
pub(crate) fn new(driver: HANDLE, user_data: usize, op: impl OpCode + 'static) -> Self {
329+
pub(crate) fn new(driver: RawFd, user_data: usize, op: impl OpCode + 'static) -> Self {
330330
let op = Overlapped::new(driver, user_data, op);
331331
let op = Box::new(op) as Box<Overlapped<dyn OpCode>>;
332332
Self {

0 commit comments

Comments
 (0)