Skip to content

Commit 0dd525a

Browse files
authored
vmbus_server: Fix some large_enum_variants with boxes (#1397)
All on what should be low-frequency paths.
1 parent d6f9b0a commit 0dd525a

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

vm/devices/vmbus/vmbus_server/src/lib.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,10 @@ pub struct VmbusServerBuilder<'a, T: Spawn> {
134134
send_messages_while_stopped: bool,
135135
}
136136

137-
#[expect(clippy::large_enum_variant)]
138137
#[derive(mesh::MeshPayload)]
139138
/// The request to send to the proxy to set or clear its saved state cache.
140139
pub enum SavedStateRequest {
141-
Set(FailableRpc<channels::SavedState, ()>),
140+
Set(FailableRpc<Box<channels::SavedState>, ()>),
142141
Clear(Rpc<(), ()>),
143142
}
144143

@@ -210,13 +209,12 @@ impl From<ModifyConnectionRequest> for ModifyRelayRequest {
210209
}
211210
}
212211

213-
#[expect(clippy::large_enum_variant)]
214212
#[derive(Debug)]
215213
enum VmbusRequest {
216214
Reset(Rpc<(), ()>),
217215
Inspect(inspect::Deferred),
218216
Save(Rpc<(), SavedState>),
219-
Restore(Rpc<SavedState, Result<(), RestoreError>>),
217+
Restore(Rpc<Box<SavedState>, Result<(), RestoreError>>),
220218
Start,
221219
Stop(Rpc<(), ()>),
222220
}
@@ -575,7 +573,7 @@ impl VmbusServer {
575573

576574
pub async fn restore(&self, state: SavedState) -> Result<(), RestoreError> {
577575
self.task_send
578-
.call(VmbusRequest::Restore, state)
576+
.call(VmbusRequest::Restore, Box::new(state))
579577
.await
580578
.unwrap()
581579
}
@@ -972,12 +970,12 @@ impl ServerTask {
972970
lost_synic_bug_fixed: true,
973971
}),
974972
VmbusRequest::Restore(rpc) => {
975-
rpc.handle(async |state: SavedState| {
973+
rpc.handle(async |state| {
976974
self.unstick_on_start = !state.lost_synic_bug_fixed;
977975
if let Some(sender) = &self.inner.saved_state_notify {
978976
tracing::trace!("sending saved state to proxy");
979977
if let Err(err) = sender
980-
.call_failable(SavedStateRequest::Set, state.server.clone())
978+
.call_failable(SavedStateRequest::Set, Box::new(state.server.clone()))
981979
.await
982980
{
983981
tracing::error!(

vm/devices/vmbus/vmbus_server/src/proxyintegration.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ impl ProxyTask {
778778
let mut proxy_ids: HashMap<u32, u64> = HashMap::new();
779779
tracing::trace!("restoring channels...");
780780

781-
rpc.handle_failable(async |saved_state: SavedState| {
781+
rpc.handle_failable(async |saved_state| {
782782
// Restore channel state in the proxy for each channel in the SavedState.
783783
if let Some(channels) = saved_state.channels() {
784784
for channel in channels {
@@ -847,7 +847,7 @@ impl ProxyTask {
847847
return Err(anyhow!("No channels exist in the saved state"));
848848
}
849849

850-
*saved_state_option = Some(saved_state);
850+
*saved_state_option = Some(*saved_state);
851851
Ok(())
852852
})
853853
.await;

0 commit comments

Comments
 (0)