mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 21:15:45 +00:00
vhost_rs: Change the VhostUserConfigFlags
The latest vhost user spec only define two members in VhostSetConfigType, master and live migration. These changes can make rust-vmm compatible with vhost user backend. Signed-off-by: Yang Zhong <yang.zhong@intel.com>
This commit is contained in:
parent
8718043dfc
commit
b4187a1b9d
@ -540,12 +540,10 @@ impl VhostUserMsgValidator for VhostUserVringAddr {
|
|||||||
bitflags! {
|
bitflags! {
|
||||||
/// Flags for the device configuration message.
|
/// Flags for the device configuration message.
|
||||||
pub struct VhostUserConfigFlags: u32 {
|
pub struct VhostUserConfigFlags: u32 {
|
||||||
/// TODO: seems the vhost-user spec has refined the definition, EMPTY is removed.
|
/// Vhost master messages used for writeable fields.
|
||||||
const EMPTY = 0x0;
|
const WRITABLE = 0x0;
|
||||||
/// Vhost master messages used for writable fields
|
/// Vhost master messages used for live migration.
|
||||||
const WRITABLE = 0x1;
|
const LIVE_MIGRATION = 0x1;
|
||||||
/// Mark that message is part of an ongoing live-migration operation.
|
|
||||||
const LIVE_MIGRATION = 0x2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,7 +785,7 @@ mod tests {
|
|||||||
let mut msg = VhostUserConfig::new(
|
let mut msg = VhostUserConfig::new(
|
||||||
VHOST_USER_CONFIG_OFFSET,
|
VHOST_USER_CONFIG_OFFSET,
|
||||||
VHOST_USER_CONFIG_SIZE - VHOST_USER_CONFIG_OFFSET,
|
VHOST_USER_CONFIG_SIZE - VHOST_USER_CONFIG_OFFSET,
|
||||||
VhostUserConfigFlags::EMPTY,
|
VhostUserConfigFlags::WRITABLE,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert!(msg.is_valid());
|
assert!(msg.is_valid());
|
||||||
@ -804,7 +802,7 @@ mod tests {
|
|||||||
msg.size = 2;
|
msg.size = 2;
|
||||||
assert!(!msg.is_valid());
|
assert!(!msg.is_valid());
|
||||||
msg.size = 1;
|
msg.size = 1;
|
||||||
msg.flags |= VhostUserConfigFlags::WRITABLE.bits();
|
msg.flags |= VhostUserConfigFlags::LIVE_MIGRATION.bits();
|
||||||
assert!(msg.is_valid());
|
assert!(msg.is_valid());
|
||||||
msg.flags |= 0x4;
|
msg.flags |= 0x4;
|
||||||
assert!(!msg.is_valid());
|
assert!(!msg.is_valid());
|
||||||
|
Loading…
Reference in New Issue
Block a user