diff --git a/src/fd/eventfd.rs b/src/fd/eventfd.rs index 1a4e206a75..87fd30fd37 100644 --- a/src/fd/eventfd.rs +++ b/src/fd/eventfd.rs @@ -142,37 +142,37 @@ impl ObjectInterface for EventFd { } async fn poll(&self, event: PollEvent) -> Result { - let mut result: PollEvent = PollEvent::empty(); + let mut ret = PollEvent::empty(); let guard = self.state.lock().await; if guard.counter < u64::MAX - 1 { if event.contains(PollEvent::POLLOUT) { - result.insert(PollEvent::POLLOUT); + ret.insert(PollEvent::POLLOUT); } if event.contains(PollEvent::POLLWRNORM) { - result.insert(PollEvent::POLLWRNORM); + ret.insert(PollEvent::POLLWRNORM); } if event.contains(PollEvent::POLLWRBAND) { - result.insert(PollEvent::POLLWRBAND); + ret.insert(PollEvent::POLLWRBAND); } } if guard.counter > 0 { if event.contains(PollEvent::POLLIN) { - result.insert(PollEvent::POLLIN); + ret.insert(PollEvent::POLLIN); } if event.contains(PollEvent::POLLRDNORM) { - result.insert(PollEvent::POLLRDNORM); + ret.insert(PollEvent::POLLRDNORM); } if event.contains(PollEvent::POLLRDBAND) { - result.insert(PollEvent::POLLRDBAND); + ret.insert(PollEvent::POLLRDBAND); } } drop(guard); future::poll_fn(|cx| { - if result.is_empty() { + if ret.is_empty() { let mut pinned = core::pin::pin!(self.state.lock()); if let Poll::Ready(mut guard) = pinned.as_mut().poll(cx) { if event.intersects( @@ -186,13 +186,13 @@ impl ObjectInterface for EventFd { guard.write_queue.push_back(cx.waker().clone()); Poll::Pending } else { - Poll::Ready(Ok(result)) + Poll::Ready(Ok(ret)) } } else { Poll::Pending } } else { - Poll::Ready(Ok(result)) + Poll::Ready(Ok(ret)) } }) .await diff --git a/src/fd/socket/tcp.rs b/src/fd/socket/tcp.rs index a07adced27..dc3634f1ce 100644 --- a/src/fd/socket/tcp.rs +++ b/src/fd/socket/tcp.rs @@ -168,35 +168,35 @@ impl Socket { #[async_trait] impl ObjectInterface for Socket { async fn poll(&self, event: PollEvent) -> Result { - let mut result: PollEvent = PollEvent::empty(); + let mut ret = PollEvent::empty(); future::poll_fn(|cx| { self.with(|socket| match socket.state() { tcp::State::Closed | tcp::State::Closing | tcp::State::CloseWait => { if event.contains(PollEvent::POLLOUT) { - result.insert(PollEvent::POLLOUT); + ret.insert(PollEvent::POLLOUT); } if event.contains(PollEvent::POLLWRNORM) { - result.insert(PollEvent::POLLWRNORM); + ret.insert(PollEvent::POLLWRNORM); } if event.contains(PollEvent::POLLWRBAND) { - result.insert(PollEvent::POLLWRBAND); + ret.insert(PollEvent::POLLWRBAND); } if event.contains(PollEvent::POLLIN) { - result.insert(PollEvent::POLLIN); + ret.insert(PollEvent::POLLIN); } if event.contains(PollEvent::POLLRDNORM) { - result.insert(PollEvent::POLLRDNORM); + ret.insert(PollEvent::POLLRDNORM); } if event.contains(PollEvent::POLLRDBAND) { - result.insert(PollEvent::POLLRDBAND); + ret.insert(PollEvent::POLLRDBAND); } - if result.is_empty() { + if ret.is_empty() { Poll::Ready(Ok(PollEvent::POLLHUP)) } else { - Poll::Ready(Ok(result)) + Poll::Ready(Ok(ret)) } } tcp::State::FinWait1 | tcp::State::FinWait2 | tcp::State::TimeWait => { @@ -211,46 +211,46 @@ impl ObjectInterface for Socket { if socket.may_recv() && self.listen.swap(false, Ordering::Relaxed) { // In case, we just establish a fresh connection in non-blocking mode, we try to read data. if event.contains(PollEvent::POLLIN) { - result.insert(PollEvent::POLLIN); + ret.insert(PollEvent::POLLIN); } if event.contains(PollEvent::POLLRDNORM) { - result.insert(PollEvent::POLLRDNORM); + ret.insert(PollEvent::POLLRDNORM); } if event.contains(PollEvent::POLLRDBAND) { - result.insert(PollEvent::POLLRDBAND); + ret.insert(PollEvent::POLLRDBAND); } } if socket.can_send() { if event.contains(PollEvent::POLLOUT) { - result.insert(PollEvent::POLLOUT); + ret.insert(PollEvent::POLLOUT); } if event.contains(PollEvent::POLLWRNORM) { - result.insert(PollEvent::POLLWRNORM); + ret.insert(PollEvent::POLLWRNORM); } if event.contains(PollEvent::POLLWRBAND) { - result.insert(PollEvent::POLLWRBAND); + ret.insert(PollEvent::POLLWRBAND); } } if socket.can_recv() { if event.contains(PollEvent::POLLIN) { - result.insert(PollEvent::POLLIN); + ret.insert(PollEvent::POLLIN); } if event.contains(PollEvent::POLLRDNORM) { - result.insert(PollEvent::POLLRDNORM); + ret.insert(PollEvent::POLLRDNORM); } if event.contains(PollEvent::POLLRDBAND) { - result.insert(PollEvent::POLLRDBAND); + ret.insert(PollEvent::POLLRDBAND); } } - if result.is_empty() { + if ret.is_empty() { socket.register_recv_waker(cx.waker()); socket.register_send_waker(cx.waker()); Poll::Pending } else { - Poll::Ready(Ok(result)) + Poll::Ready(Ok(ret)) } } }) diff --git a/src/fd/socket/udp.rs b/src/fd/socket/udp.rs index 08523772d5..f7ffa719fb 100644 --- a/src/fd/socket/udp.rs +++ b/src/fd/socket/udp.rs @@ -119,44 +119,44 @@ impl Socket { #[async_trait] impl ObjectInterface for Socket { async fn poll(&self, event: PollEvent) -> Result { - let mut result: PollEvent = PollEvent::empty(); + let mut ret = PollEvent::empty(); future::poll_fn(|cx| { self.with(|socket| { if socket.is_open() { if socket.can_send() { if event.contains(PollEvent::POLLOUT) { - result.insert(PollEvent::POLLOUT); + ret.insert(PollEvent::POLLOUT); } if event.contains(PollEvent::POLLWRNORM) { - result.insert(PollEvent::POLLWRNORM); + ret.insert(PollEvent::POLLWRNORM); } if event.contains(PollEvent::POLLWRBAND) { - result.insert(PollEvent::POLLWRBAND); + ret.insert(PollEvent::POLLWRBAND); } } if socket.can_recv() { if event.contains(PollEvent::POLLIN) { - result.insert(PollEvent::POLLIN); + ret.insert(PollEvent::POLLIN); } if event.contains(PollEvent::POLLRDNORM) { - result.insert(PollEvent::POLLRDNORM); + ret.insert(PollEvent::POLLRDNORM); } if event.contains(PollEvent::POLLRDBAND) { - result.insert(PollEvent::POLLRDBAND); + ret.insert(PollEvent::POLLRDBAND); } } } else { - result.insert(PollEvent::POLLNVAL); + ret.insert(PollEvent::POLLNVAL); } - if result.is_empty() { + if ret.is_empty() { socket.register_recv_waker(cx.waker()); socket.register_send_waker(cx.waker()); Poll::Pending } else { - Poll::Ready(Ok(result)) + Poll::Ready(Ok(ret)) } }) }) diff --git a/src/fd/stdio.rs b/src/fd/stdio.rs index 26b8e58152..45d3e37784 100644 --- a/src/fd/stdio.rs +++ b/src/fd/stdio.rs @@ -84,19 +84,19 @@ pub struct GenericStdout; #[async_trait] impl ObjectInterface for GenericStdout { async fn poll(&self, event: PollEvent) -> Result { - let mut result: PollEvent = PollEvent::empty(); + let mut ret = PollEvent::empty(); if event.contains(PollEvent::POLLOUT) { - result.insert(PollEvent::POLLOUT); + ret.insert(PollEvent::POLLOUT); } if event.contains(PollEvent::POLLWRNORM) { - result.insert(PollEvent::POLLWRNORM); + ret.insert(PollEvent::POLLWRNORM); } if event.contains(PollEvent::POLLWRBAND) { - result.insert(PollEvent::POLLWRBAND); + ret.insert(PollEvent::POLLWRBAND); } - Ok(result) + Ok(ret) } async fn async_write(&self, buf: &[u8]) -> Result { @@ -119,19 +119,19 @@ pub struct GenericStderr; #[async_trait] impl ObjectInterface for GenericStderr { async fn poll(&self, event: PollEvent) -> Result { - let mut result: PollEvent = PollEvent::empty(); + let mut ret = PollEvent::empty(); if event.contains(PollEvent::POLLOUT) { - result.insert(PollEvent::POLLOUT); + ret.insert(PollEvent::POLLOUT); } if event.contains(PollEvent::POLLWRNORM) { - result.insert(PollEvent::POLLWRNORM); + ret.insert(PollEvent::POLLWRNORM); } if event.contains(PollEvent::POLLWRBAND) { - result.insert(PollEvent::POLLWRBAND); + ret.insert(PollEvent::POLLWRBAND); } - Ok(result) + Ok(ret) } async fn async_write(&self, buf: &[u8]) -> Result { @@ -165,19 +165,19 @@ pub struct UhyveStdout; #[async_trait] impl ObjectInterface for UhyveStdout { async fn poll(&self, event: PollEvent) -> Result { - let mut result: PollEvent = PollEvent::empty(); + let mut ret = PollEvent::empty(); if event.contains(PollEvent::POLLOUT) { - result.insert(PollEvent::POLLOUT); + ret.insert(PollEvent::POLLOUT); } if event.contains(PollEvent::POLLWRNORM) { - result.insert(PollEvent::POLLWRNORM); + ret.insert(PollEvent::POLLWRNORM); } if event.contains(PollEvent::POLLWRBAND) { - result.insert(PollEvent::POLLWRBAND); + ret.insert(PollEvent::POLLWRBAND); } - Ok(result) + Ok(ret) } async fn async_write(&self, buf: &[u8]) -> Result { @@ -200,19 +200,19 @@ pub struct UhyveStderr; #[async_trait] impl ObjectInterface for UhyveStderr { async fn poll(&self, event: PollEvent) -> Result { - let mut result: PollEvent = PollEvent::empty(); + let mut ret = PollEvent::empty(); if event.contains(PollEvent::POLLOUT) { - result.insert(PollEvent::POLLOUT); + ret.insert(PollEvent::POLLOUT); } if event.contains(PollEvent::POLLWRNORM) { - result.insert(PollEvent::POLLWRNORM); + ret.insert(PollEvent::POLLWRNORM); } if event.contains(PollEvent::POLLWRBAND) { - result.insert(PollEvent::POLLWRBAND); + ret.insert(PollEvent::POLLWRBAND); } - Ok(result) + Ok(ret) } async fn async_write(&self, buf: &[u8]) -> Result { diff --git a/src/fs/mem.rs b/src/fs/mem.rs index b38621b14b..5e5b10263e 100644 --- a/src/fs/mem.rs +++ b/src/fs/mem.rs @@ -50,21 +50,21 @@ struct RomFileInterface { #[async_trait] impl ObjectInterface for RomFileInterface { async fn poll(&self, event: PollEvent) -> Result { - let mut result: PollEvent = PollEvent::empty(); + let mut ret = PollEvent::empty(); let len = self.inner.read().await.data.len(); let pos = *self.pos.lock().await; if event.contains(PollEvent::POLLIN) && pos < len { - result.insert(PollEvent::POLLIN); + ret.insert(PollEvent::POLLIN); } if event.contains(PollEvent::POLLRDNORM) && pos < len { - result.insert(PollEvent::POLLRDNORM); + ret.insert(PollEvent::POLLRDNORM); } if event.contains(PollEvent::POLLRDBAND) && pos < len { - result.insert(PollEvent::POLLRDBAND); + ret.insert(PollEvent::POLLRDBAND); } - Ok(result) + Ok(ret) } async fn async_read(&self, buf: &mut [u8]) -> Result { @@ -135,30 +135,30 @@ pub struct RamFileInterface { #[async_trait] impl ObjectInterface for RamFileInterface { async fn poll(&self, event: PollEvent) -> Result { - let mut result: PollEvent = PollEvent::empty(); + let mut ret = PollEvent::empty(); let len = self.inner.read().await.data.len(); let pos = *self.pos.lock().await; if event.contains(PollEvent::POLLIN) && pos < len { - result.insert(PollEvent::POLLIN); + ret.insert(PollEvent::POLLIN); } if event.contains(PollEvent::POLLRDNORM) && pos < len { - result.insert(PollEvent::POLLRDNORM); + ret.insert(PollEvent::POLLRDNORM); } if event.contains(PollEvent::POLLRDBAND) && pos < len { - result.insert(PollEvent::POLLRDBAND); + ret.insert(PollEvent::POLLRDBAND); } if event.contains(PollEvent::POLLOUT) { - result.insert(PollEvent::POLLOUT); + ret.insert(PollEvent::POLLOUT); } if event.contains(PollEvent::POLLWRNORM) { - result.insert(PollEvent::POLLWRNORM); + ret.insert(PollEvent::POLLWRNORM); } if event.contains(PollEvent::POLLWRBAND) { - result.insert(PollEvent::POLLWRBAND); + ret.insert(PollEvent::POLLWRBAND); } - Ok(result) + Ok(ret) } async fn async_read(&self, buf: &mut [u8]) -> Result {