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.
@@ -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());
