mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: Migrate away from versionize
Replace with serde instead. Fixes: #6370 Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
@@ -22,23 +22,20 @@ use crate::{
|
||||
};
|
||||
use anyhow::anyhow;
|
||||
use seccompiler::SeccompAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::io::{self, Write};
|
||||
use std::mem::size_of;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::result;
|
||||
use std::sync::{atomic::AtomicBool, Arc, Barrier};
|
||||
use thiserror::Error;
|
||||
use versionize::{VersionMap, Versionize, VersionizeResult};
|
||||
use versionize_derive::Versionize;
|
||||
use virtio_queue::{Queue, QueueT};
|
||||
use vm_allocator::page_size::{align_page_size_down, get_page_size};
|
||||
use vm_memory::{
|
||||
Address, ByteValued, Bytes, GuestAddress, GuestAddressSpace, GuestMemory, GuestMemoryAtomic,
|
||||
GuestMemoryError, GuestMemoryRegion,
|
||||
};
|
||||
use vm_migration::{
|
||||
Migratable, MigratableError, Pausable, Snapshot, Snapshottable, Transportable, VersionMapped,
|
||||
};
|
||||
use vm_migration::{Migratable, MigratableError, Pausable, Snapshot, Snapshottable, Transportable};
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
const QUEUE_SIZE: u16 = 128;
|
||||
@@ -89,7 +86,7 @@ pub enum Error {
|
||||
|
||||
// Got from include/uapi/linux/virtio_balloon.h
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Versionize)]
|
||||
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize)]
|
||||
pub struct VirtioBalloonConfig {
|
||||
// Number of pages host wants Guest to give up.
|
||||
num_pages: u32,
|
||||
@@ -418,15 +415,13 @@ impl EpollHelperHandler for BalloonEpollHandler {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Versionize)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct BalloonState {
|
||||
pub avail_features: u64,
|
||||
pub acked_features: u64,
|
||||
pub config: VirtioBalloonConfig,
|
||||
}
|
||||
|
||||
impl VersionMapped for BalloonState {}
|
||||
|
||||
// Virtio device for exposing entropy to the guest OS through virtio.
|
||||
pub struct Balloon {
|
||||
common: VirtioCommon,
|
||||
@@ -672,7 +667,7 @@ impl Snapshottable for Balloon {
|
||||
}
|
||||
|
||||
fn snapshot(&mut self) -> std::result::Result<Snapshot, MigratableError> {
|
||||
Snapshot::new_from_versioned_state(&self.state())
|
||||
Snapshot::new_from_state(&self.state())
|
||||
}
|
||||
}
|
||||
impl Transportable for Balloon {}
|
||||
|
||||
Reference in New Issue
Block a user