mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vm-migration: Derive Versionize for MemoryRangeTable structure
During snapshot/restore we will need to store this structure, which is why it must derive the Versionize trait. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
1ea63f50a1
commit
2569621c4b
@ -3,7 +3,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
use crate::MigratableError;
|
||||
use crate::{MigratableError, VersionMapped};
|
||||
use std::io::{Read, Write};
|
||||
use versionize::{VersionMap, Versionize, VersionizeResult};
|
||||
use versionize_derive::Versionize;
|
||||
use vm_memory::ByteValued;
|
||||
|
||||
// Migration protocol
|
||||
@ -28,8 +31,6 @@ use vm_memory::ByteValued;
|
||||
// The destination can at any time send an "error response" to cancel
|
||||
// The source can at any time send an "abandon request" to cancel
|
||||
|
||||
use std::io::{Read, Write};
|
||||
|
||||
#[repr(u16)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum Command {
|
||||
@ -173,16 +174,19 @@ impl Response {
|
||||
unsafe impl ByteValued for Response {}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Versionize)]
|
||||
pub struct MemoryRange {
|
||||
pub gpa: u64,
|
||||
pub length: u64,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Clone, Default, Versionize)]
|
||||
pub struct MemoryRangeTable {
|
||||
data: Vec<MemoryRange>,
|
||||
}
|
||||
|
||||
impl VersionMapped for MemoryRangeTable {}
|
||||
|
||||
impl MemoryRangeTable {
|
||||
pub fn from_bitmap(bitmap: Vec<u64>, start_addr: u64, page_size: u64) -> Self {
|
||||
let mut table = MemoryRangeTable::default();
|
||||
|
Loading…
Reference in New Issue
Block a user