mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +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:
@@ -3,7 +3,10 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// 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;
|
use vm_memory::ByteValued;
|
||||||
|
|
||||||
// Migration protocol
|
// Migration protocol
|
||||||
@@ -28,8 +31,6 @@ use vm_memory::ByteValued;
|
|||||||
// The destination can at any time send an "error response" to cancel
|
// The destination can at any time send an "error response" to cancel
|
||||||
// The source can at any time send an "abandon request" to cancel
|
// The source can at any time send an "abandon request" to cancel
|
||||||
|
|
||||||
use std::io::{Read, Write};
|
|
||||||
|
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
@@ -173,16 +174,19 @@ impl Response {
|
|||||||
unsafe impl ByteValued for Response {}
|
unsafe impl ByteValued for Response {}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
#[derive(Clone, Versionize)]
|
||||||
pub struct MemoryRange {
|
pub struct MemoryRange {
|
||||||
pub gpa: u64,
|
pub gpa: u64,
|
||||||
pub length: u64,
|
pub length: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Clone, Default, Versionize)]
|
||||||
pub struct MemoryRangeTable {
|
pub struct MemoryRangeTable {
|
||||||
data: Vec<MemoryRange>,
|
data: Vec<MemoryRange>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl VersionMapped for MemoryRangeTable {}
|
||||||
|
|
||||||
impl MemoryRangeTable {
|
impl MemoryRangeTable {
|
||||||
pub fn from_bitmap(bitmap: Vec<u64>, start_addr: u64, page_size: u64) -> Self {
|
pub fn from_bitmap(bitmap: Vec<u64>, start_addr: u64, page_size: u64) -> Self {
|
||||||
let mut table = MemoryRangeTable::default();
|
let mut table = MemoryRangeTable::default();
|
||||||
|
|||||||
Reference in New Issue
Block a user