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 <julian.stecklina@cyberus-technology.de>
This commit is contained in:
Julian Stecklina
2025-10-16 15:01:00 +02:00
committed by Rob Bradford
parent b163fea66a
commit 3d43245608

View File

@@ -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<Response, MigratableError> {
let mut response = Response::default();
fd.read_exact(Self::as_mut_slice(&mut response))