mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
committed by
Rob Bradford
parent
b163fea66a
commit
3d43245608
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user