diff --git a/staging/vhost-device-sound/src/device.rs b/staging/vhost-device-sound/src/device.rs index 5dff291..c04c61d 100644 --- a/staging/vhost-device-sound/src/device.rs +++ b/staging/vhost-device-sound/src/device.rs @@ -129,7 +129,7 @@ impl VhostUserSoundThread { &self, vring: &VringRwLock, audio_backend: &RwLock>, - ) -> IoResult { + ) -> IoResult<()> { let Some(ref atomic_mem) = self.mem else { return Err(Error::NoMemoryConfigured.into()); }; @@ -141,7 +141,7 @@ impl VhostUserSoundThread { .collect(); if requests.is_empty() { - return Ok(true); + return Ok(()); } // Reply to some requests right away, and defer others to the audio backend (for @@ -445,12 +445,12 @@ impl VhostUserSoundThread { log::error!("Couldn't signal used queue"); } - Ok(!any) + Ok(()) } - fn process_event(&self, _vring: &VringRwLock) -> IoResult { + fn process_event(&self, _vring: &VringRwLock) -> IoResult<()> { log::trace!("process_event"); - Ok(false) + Ok(()) } fn process_io( @@ -458,7 +458,7 @@ impl VhostUserSoundThread { vring: &VringRwLock, audio_backend: &RwLock>, direction: Direction, - ) -> IoResult { + ) -> IoResult<()> { let Some(ref atomic_mem) = self.mem else { return Err(Error::NoMemoryConfigured.into()); }; @@ -470,7 +470,7 @@ impl VhostUserSoundThread { .collect(); if requests.is_empty() { - return Ok(true); + return Ok(()); } // Instead of counting descriptor chain lengths, encode the "parsing" logic in @@ -592,7 +592,7 @@ impl VhostUserSoundThread { } } - Ok(false) + Ok(()) } } diff --git a/staging/vhost-device-video/src/vhu_video_thread.rs b/staging/vhost-device-video/src/vhu_video_thread.rs index 96018d4..ffa55bc 100644 --- a/staging/vhost-device-video/src/vhu_video_thread.rs +++ b/staging/vhost-device-video/src/vhu_video_thread.rs @@ -472,7 +472,7 @@ impl VhostUserVideoThread { } /// Process the requests in the vring and dispatch replies - pub fn process_command_queue(&mut self, vring: &VringRwLock) -> Result { + pub fn process_command_queue(&mut self, vring: &VringRwLock) -> Result<()> { let requests: Vec<_> = vring .get_mut() .get_queue_mut() @@ -487,10 +487,10 @@ impl VhostUserVideoThread { .map_err(|_| VuVideoError::SendNotificationFailed)?; } - Ok(true) + Ok(()) } - fn process_event(&self, stream_id: u32, eventq: &VringRwLock) -> Result { + fn process_event(&self, stream_id: u32, eventq: &VringRwLock) -> Result<()> { if let Some(event) = self.backend.read().unwrap().dequeue_event(stream_id) { let desc_chain = eventq .get_mut() @@ -516,10 +516,10 @@ impl VhostUserVideoThread { .map_err(|_| VuVideoError::SendNotificationFailed)?; } - Ok(true) + Ok(()) } - fn send_dqbuf(&mut self, stream_id: u32, queue_type: video::QueueType) -> Result { + fn send_dqbuf(&mut self, stream_id: u32, queue_type: video::QueueType) -> Result<()> { let dqbuf_data = match self .backend .read() @@ -527,7 +527,7 @@ impl VhostUserVideoThread { .dequeue_resource(stream_id, queue_type) { Some(buf_data) => buf_data, - None => return Ok(false), + None => return Ok(()), }; let mut backend = self.backend.write().unwrap(); let stream = backend.stream_mut(&stream_id).unwrap(); @@ -544,10 +544,10 @@ impl VhostUserVideoThread { .unwrap(); resource.ready_with(dqbuf_data.flags, dqbuf_data.size); - Ok(true) + Ok(()) } - pub fn process_video_event(&mut self, eventq: &VringRwLock) -> Result { + pub fn process_video_event(&mut self, eventq: &VringRwLock) -> Result<()> { let mut epoll_events = vec![PollerEvent::default(); 1024]; let events = self.poller.wait(epoll_events.as_mut_slice(), 0).unwrap(); for event in events { @@ -565,7 +565,7 @@ impl VhostUserVideoThread { } } - Ok(true) + Ok(()) } } diff --git a/vhost-device-i2c/src/vhu_i2c.rs b/vhost-device-i2c/src/vhu_i2c.rs index 26dd013..0ef9184 100644 --- a/vhost-device-i2c/src/vhu_i2c.rs +++ b/vhost-device-i2c/src/vhu_i2c.rs @@ -257,7 +257,7 @@ impl VhostUserI2cBackend { } /// Process the requests in the vring and dispatch replies - fn process_queue(&self, vring: &VringRwLock) -> Result { + fn process_queue(&self, vring: &VringRwLock) -> Result<()> { let requests: Vec<_> = vring .get_mut() .get_queue_mut() @@ -272,7 +272,7 @@ impl VhostUserI2cBackend { .map_err(|_| Error::NotificationFailed)?; } - Ok(true) + Ok(()) } } diff --git a/vhost-device-rng/src/vhu_rng.rs b/vhost-device-rng/src/vhu_rng.rs index afd9f5e..21f5ed1 100644 --- a/vhost-device-rng/src/vhu_rng.rs +++ b/vhost-device-rng/src/vhu_rng.rs @@ -182,7 +182,7 @@ impl VuRngBackend { } /// Process the requests in the vring and dispatch replies - fn process_queue(&mut self, vring: &VringRwLock) -> Result { + fn process_queue(&mut self, vring: &VringRwLock) -> Result<()> { let requests: Vec<_> = vring .get_mut() .get_queue_mut() @@ -197,7 +197,7 @@ impl VuRngBackend { .map_err(|_| VuRngError::SendNotificationFailed)?; } - Ok(true) + Ok(()) } } diff --git a/vhost-device-scmi/src/vhu_scmi.rs b/vhost-device-scmi/src/vhu_scmi.rs index b2e674a..683b327 100644 --- a/vhost-device-scmi/src/vhu_scmi.rs +++ b/vhost-device-scmi/src/vhu_scmi.rs @@ -136,9 +136,9 @@ impl VuScmiBackend { &mut self, requests: Vec, vring: &VringRwLock, - ) -> Result { + ) -> Result<()> { if requests.is_empty() { - return Ok(true); + return Ok(()); } for desc_chain in requests { @@ -230,7 +230,7 @@ impl VuScmiBackend { error!("Couldn't return used descriptors to the ring"); } } - Ok(true) + Ok(()) } fn process_command_queue(&mut self, vring: &VringRwLock) -> Result<()> { @@ -271,7 +271,7 @@ impl VuScmiBackend { &mut self, requests: Vec, _vring: &VringRwLock, - ) -> Result { + ) -> Result<()> { // The requests here are notifications from the guest about adding // fresh buffers for the used ring. The Linux driver allocates 256 // buffers for the event queue initially (arriving here in several @@ -295,7 +295,7 @@ impl VuScmiBackend { self.event_descriptors.push(desc_chain); } - Ok(true) + Ok(()) } fn process_event_queue(&mut self, vring: &VringRwLock) -> Result<()> { diff --git a/vhost-device-vsock/src/vhu_vsock_thread.rs b/vhost-device-vsock/src/vhu_vsock_thread.rs index 10dcc1c..f6213cb 100644 --- a/vhost-device-vsock/src/vhu_vsock_thread.rs +++ b/vhost-device-vsock/src/vhu_vsock_thread.rs @@ -489,12 +489,7 @@ impl VhostUserVsockThread { } /// Iterate over the rx queue and process rx requests. - fn process_rx_queue( - &mut self, - vring: &VringRwLock, - rx_queue_type: RxQueueType, - ) -> Result { - let mut used_any = false; + fn process_rx_queue(&mut self, vring: &VringRwLock, rx_queue_type: RxQueueType) -> Result<()> { let atomic_mem = match &self.mem { Some(m) => m, None => return Err(Error::NoMemoryConfigured), @@ -509,7 +504,6 @@ impl VhostUserVsockThread { .map_err(|_| Error::IterateQueue)? .next() { - used_any = true; let mem = atomic_mem.clone().memory(); let head_idx = avail_desc.head_index(); @@ -561,11 +555,11 @@ impl VhostUserVsockThread { } } } - Ok(used_any) + Ok(()) } /// Wrapper to process rx queue based on whether event idx is enabled or not. - fn process_unix_sockets(&mut self, vring: &VringRwLock, event_idx: bool) -> Result { + fn process_unix_sockets(&mut self, vring: &VringRwLock, event_idx: bool) -> Result<()> { if event_idx { // To properly handle EVENT_IDX we need to keep calling // process_rx_queue until it stops finding new requests @@ -585,11 +579,11 @@ impl VhostUserVsockThread { } else { self.process_rx_queue(vring, RxQueueType::Standard)?; } - Ok(false) + Ok(()) } /// Wrapper to process raw vsock packets queue based on whether event idx is enabled or not. - pub fn process_raw_pkts(&mut self, vring: &VringRwLock, event_idx: bool) -> Result { + pub fn process_raw_pkts(&mut self, vring: &VringRwLock, event_idx: bool) -> Result<()> { if event_idx { loop { if !self.thread_backend.pending_raw_pkts() { @@ -605,10 +599,10 @@ impl VhostUserVsockThread { } else { self.process_rx_queue(vring, RxQueueType::RawPkts)?; } - Ok(false) + Ok(()) } - pub fn process_rx(&mut self, vring: &VringRwLock, event_idx: bool) -> Result { + pub fn process_rx(&mut self, vring: &VringRwLock, event_idx: bool) -> Result<()> { match self.last_processed { RxQueueType::Standard => { if self.thread_backend.pending_raw_pkts() { @@ -629,13 +623,11 @@ impl VhostUserVsockThread { } } } - Ok(false) + Ok(()) } /// Process tx queue and send requests to the backend for processing. - fn process_tx_queue(&mut self, vring: &VringRwLock) -> Result { - let mut used_any = false; - + fn process_tx_queue(&mut self, vring: &VringRwLock) -> Result<()> { let atomic_mem = match &self.mem { Some(m) => m, None => return Err(Error::NoMemoryConfigured), @@ -648,7 +640,6 @@ impl VhostUserVsockThread { .map_err(|_| Error::IterateQueue)? .next() { - used_any = true; let mem = atomic_mem.clone().memory(); let head_idx = avail_desc.head_index(); @@ -689,11 +680,11 @@ impl VhostUserVsockThread { .unwrap(); } - Ok(used_any) + Ok(()) } /// Wrapper to process tx queue based on whether event idx is enabled or not. - pub fn process_tx(&mut self, vring_lock: &VringRwLock, event_idx: bool) -> Result { + pub fn process_tx(&mut self, vring_lock: &VringRwLock, event_idx: bool) -> Result<()> { if event_idx { // To properly handle EVENT_IDX we need to keep calling // process_rx_queue until it stops finding new requests @@ -709,7 +700,7 @@ impl VhostUserVsockThread { } else { self.process_tx_queue(vring_lock)?; } - Ok(false) + Ok(()) } }