Skip to content

Commit cd948a2

Browse files
blitzlikebreath
authored andcommitted
vfio-user: don't zero unknown bits
Newer versions of the bitflags crate make a distinction between known and unknown bits: https://docs.rs/bitflags/latest/bitflags/#known-and-unknown-bits Because these data types are defined in the VFIO spec, which can introduce more bits, we should handle this like the documentation suggests. Signed-off-by: Julian Stecklina <[email protected]>
1 parent 0d4654b commit cd948a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

vfio-user/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,18 @@ bitflags! {
107107
const READ = 1 << 0;
108108
const WRITE = 1 << 1;
109109
const READ_WRITE = Self::READ.bits() | Self::WRITE.bits();
110+
111+
// There might be unknown bits and we don't want bitflags to clear them.
112+
const _ = !0;
110113
}
111114

112115
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
113116
pub struct DmaUnmapFlags: u32 {
114117
const GET_DIRTY_PAGE_INFO = 1 << 1;
115118
const UNMAP_ALL = 1 << 2;
119+
120+
// See above.
121+
const _ = !0;
116122
}
117123
}
118124

0 commit comments

Comments
 (0)