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:
Yang Zhong 2019-07-19 19:46:29 +08:00 committed by Sebastien Boeuf
parent 8718043dfc
commit b4187a1b9d

View File

@ -540,12 +540,10 @@ impl VhostUserMsgValidator for VhostUserVringAddr {
bitflags! {
/// Flags for the device configuration message.
pub struct VhostUserConfigFlags: u32 {
/// TODO: seems the vhost-user spec has refined the definition, EMPTY is removed.
const EMPTY = 0x0;
/// Vhost master messages used for writable fields
const WRITABLE = 0x1;
/// Mark that message is part of an ongoing live-migration operation.
const LIVE_MIGRATION = 0x2;
/// Vhost master messages used for writeable fields.
const WRITABLE = 0x0;
/// Vhost master messages used for live migration.
const LIVE_MIGRATION = 0x1;
}
}
@ -787,7 +785,7 @@ mod tests {
let mut msg = VhostUserConfig::new(
VHOST_USER_CONFIG_OFFSET,
VHOST_USER_CONFIG_SIZE - VHOST_USER_CONFIG_OFFSET,
VhostUserConfigFlags::EMPTY,
VhostUserConfigFlags::WRITABLE,
);
assert!(msg.is_valid());
@ -804,7 +802,7 @@ mod tests {
msg.size = 2;
assert!(!msg.is_valid());
msg.size = 1;
msg.flags |= VhostUserConfigFlags::WRITABLE.bits();
msg.flags |= VhostUserConfigFlags::LIVE_MIGRATION.bits();
assert!(msg.is_valid());
msg.flags |= 0x4;
assert!(!msg.is_valid());