Skip to content

Commit 0f26a47

Browse files
committed
refactor: remove unnecessary push_flags methods
1 parent 411a609 commit 0f26a47

File tree

3 files changed

+6
-58
lines changed

3 files changed

+6
-58
lines changed

compio-driver/src/iour/mod.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -238,37 +238,6 @@ impl Driver {
238238
}
239239
}
240240

241-
pub fn push_flags<T: crate::sys::OpCode + 'static>(
242-
&mut self,
243-
op: &mut Key<T>,
244-
) -> Poll<(io::Result<usize>, u32)> {
245-
instrument!(compio_log::Level::TRACE, "push_flags", ?op);
246-
let user_data = op.user_data();
247-
let op_pin = op.as_op_pin();
248-
trace!("push RawOp");
249-
match op_pin.create_entry() {
250-
OpEntry::Submission(entry) => {
251-
#[allow(clippy::useless_conversion)]
252-
if let Err(err) = self.push_raw(entry.user_data(user_data as _).into()) {
253-
return Poll::Ready((Err(err), 0));
254-
}
255-
Poll::Pending
256-
}
257-
#[cfg(feature = "io-uring-sqe128")]
258-
OpEntry::Submission128(entry) => {
259-
if let Err(err) = self.push_raw(entry.user_data(user_data as _)) {
260-
return Poll::Ready((Err(err), 0));
261-
}
262-
Poll::Pending
263-
}
264-
OpEntry::Blocking => match self.push_blocking(user_data) {
265-
Err(err) => Poll::Ready((Err(err), 0)),
266-
Ok(true) => Poll::Pending,
267-
Ok(false) => Poll::Ready((Err(io::Error::from_raw_os_error(libc::EBUSY)), 0)),
268-
},
269-
}
270-
}
271-
272241
fn push_blocking(&mut self, user_data: usize) -> io::Result<bool> {
273242
let handle = self.handle()?;
274243
let completed = self.pool_completed.clone();

compio-driver/src/lib.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -272,24 +272,6 @@ impl Proactor {
272272
}
273273
}
274274

275-
/// Push an operation into the driver, and return the unique key, called
276-
/// user-defined data, associated with it.
277-
pub fn push_flags<T: OpCode + 'static>(
278-
&mut self,
279-
op: T,
280-
) -> PushEntry<Key<T>, (BufResult<usize, T>, u32)> {
281-
let mut op = self.driver.create_op(op);
282-
match self.driver.push_flags(&mut op) {
283-
Poll::Pending => PushEntry::Pending(op),
284-
Poll::Ready((res, flags)) => {
285-
op.set_result(res);
286-
op.set_flags(flags);
287-
// SAFETY: just completed.
288-
PushEntry::Ready(unsafe { op.into_inner_flags() })
289-
}
290-
}
291-
}
292-
293275
/// Poll the driver and get completed entries.
294276
/// You need to call [`Proactor::pop`] to get the pushed operations.
295277
pub fn poll(

compio-runtime/src/runtime/mod.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,6 @@ impl Runtime {
234234
self.driver.borrow_mut().push(op)
235235
}
236236

237-
fn submit_flags_raw<T: OpCode + 'static>(
238-
&self,
239-
op: T,
240-
) -> PushEntry<Key<T>, (BufResult<usize, T>, u32)> {
241-
self.driver.borrow_mut().push_flags(op)
242-
}
243-
244237
/// Submit an operation to the runtime.
245238
///
246239
/// You only need this when authoring your own [`OpCode`].
@@ -261,9 +254,13 @@ impl Runtime {
261254
&self,
262255
op: T,
263256
) -> impl Future<Output = (BufResult<usize, T>, u32)> {
264-
match self.submit_flags_raw(op) {
257+
match self.submit_raw(op) {
265258
PushEntry::Pending(user_data) => Either::Left(OpFlagsFuture::new(user_data)),
266-
PushEntry::Ready(res) => Either::Right(ready(res)),
259+
PushEntry::Ready(res) => {
260+
// submit_flags won't be ready immediately, if ready, it must be error without
261+
// flags
262+
Either::Right(ready((res, 0)))
263+
}
267264
}
268265
}
269266

0 commit comments

Comments
 (0)