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

@@ -45,7 +45,7 @@ impl TxVirtio {
tap: &Tap,
queue: &mut Queue,
rate_limiter: &mut Option<RateLimiter>,
access_platform: Option<&Arc<dyn AccessPlatform>>,
access_platform: Option<&dyn AccessPlatform>,
) -> Result<bool, NetQueuePairError> {
let mut retry_write = false;
let mut rate_limit_reached = false;
@@ -173,7 +173,7 @@ impl RxVirtio {
tap: &Tap,
queue: &mut Queue,
rate_limiter: &mut Option<RateLimiter>,
access_platform: Option<&Arc<dyn AccessPlatform>>,
access_platform: Option<&dyn AccessPlatform>,
) -> Result<bool, NetQueuePairError> {
let mut exhausted_descs = true;
let mut rate_limit_reached = false;
@@ -413,7 +413,7 @@ impl NetQueuePair {
&self.tap,
queue,
&mut self.tx_rate_limiter,
self.access_platform.as_ref(),
self.access_platform.as_deref(),
)?;
// We got told to try again when writing to the tap. Wait for the TAP to be writable
@@ -463,7 +463,7 @@ impl NetQueuePair {
&self.tap,
queue,
&mut self.rx_rate_limiter,
self.access_platform.as_ref(),
self.access_platform.as_deref(),
)?;
let rate_limit_reached = self
.rx_rate_limiter