From 3d4324560825047645ae5f30b844f05d4dfdcaf3 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Thu, 16 Oct 2025 15:01:00 +0200 Subject: [PATCH] vmm: allow comparing commands and extracting response length This will be useful later when we rebuild the live migration code as a state machine. On-behalf-of: SAP julian.stecklina@sap.com Signed-off-by: Julian Stecklina --- vm-migration/src/protocol.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vm-migration/src/protocol.rs b/vm-migration/src/protocol.rs index bc0d60e96..28cdc9083 100644 --- a/vm-migration/src/protocol.rs +++ b/vm-migration/src/protocol.rs @@ -52,7 +52,7 @@ use crate::bitpos_iterator::BitposIteratorExt; // The source can at any time send an "abandon request" to cancel #[repr(u16)] -#[derive(Copy, Clone, Default)] +#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)] pub enum Command { #[default] Invalid, @@ -176,6 +176,10 @@ impl Response { self.status } + pub fn length(&self) -> u64 { + self.length + } + pub fn read_from(fd: &mut dyn Read) -> Result { let mut response = Response::default(); fd.read_exact(Self::as_mut_slice(&mut response))