devicemapper: Implement traits for Flags
For compatibility with the new version of libbitflags (2.2.1), derive
Flags struct from Copy, Clone, Debug, Eq, Hash, Ord, PartialEq,
PartialOrd.
Test: Build
Change-Id: I3b07aeec52fcd095201ee34c5a8706e78ca0474c
Ignore-AOSP-First: This is a cherry-pick from AOSP because changes to
Rust crates are not automerged from AOSP.
Change-Id: Ia2372e77805a2bc57bdeaa7eba2f0653e0ee14a7
diff --git a/libs/devicemapper/src/loopdevice/sys.rs b/libs/devicemapper/src/loopdevice/sys.rs
index 98b5085..a35eaa9 100644
--- a/libs/devicemapper/src/loopdevice/sys.rs
+++ b/libs/devicemapper/src/loopdevice/sys.rs
@@ -61,6 +61,8 @@
unsafe impl DataInit for loop_info64 {}
bitflags! {
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Flag: u32 {
const LO_FLAGS_READ_ONLY = 1 << 0;
const LO_FLAGS_AUTOCLEAR = 1 << 2;
diff --git a/libs/devicemapper/src/sys.rs b/libs/devicemapper/src/sys.rs
index e709bf0..3cecde3 100644
--- a/libs/devicemapper/src/sys.rs
+++ b/libs/devicemapper/src/sys.rs
@@ -72,6 +72,8 @@
pub const DM_MAX_TYPE_NAME: usize = 16;
bitflags! {
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Flag: u32 {
const DM_READONLY_FLAG = 1 << 0;
const DM_SUSPEND_FLAG = 1 << 1;