misc: cleanup &Arc<dyn T> -> &dyn T

Consuming `&Arc<T>` as argument is almost always an antipattern as it
hides whether the callee is going to take over (shared) ownership
(by .clone()) or not. Instead, it is better to consume `&dyn T` or
`Arc<dyn T>` to be more explicit. This commit cleans up the code.

The change is very mechanic and was very easy to implement across the
code base.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-10-28 10:49:34 +01:00
committed by Rob Bradford
parent e295719967
commit 7536a95424
37 changed files with 121 additions and 117 deletions

View File

@@ -100,7 +100,11 @@ impl EpollHelperHandler for NetCtrlEpollHandler {
))
})?;
self.ctrl_q
.process(mem.deref(), &mut self.queue, self.access_platform.as_ref())
.process(
mem.deref(),
&mut self.queue,
self.access_platform.as_deref(),
)
.map_err(|e| {
EpollHelperError::HandleEvent(anyhow!(
"Failed to process control queue: {e:?}"
@@ -693,7 +697,7 @@ impl VirtioDevice for Net {
interrupt_cb: Arc<dyn VirtioInterrupt>,
mut queues: Vec<(usize, Queue, EventFd)>,
) -> ActivateResult {
self.common.activate(&queues, &interrupt_cb)?;
self.common.activate(&queues, interrupt_cb.clone())?;
let num_queues = queues.len();
let event_idx = self.common.feature_acked(VIRTIO_RING_F_EVENT_IDX.into());