Sorry I missed this comment before...
Now I have a MemTxAttrs like,
typedef struct MemTxAttrs {
unsigned int secure:1;
unsigned int space:2;
unsigned int user:1;
unsigned int memory:1;
unsigned int requester_id:16;
unsigned int pid:8;
bool unspecified;
uint8_t _reserved1;
uint16_t _reserved2;
} MemTxAttrs;
and its binding is,
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone)]
pub struct MemTxAttrs {
pub _bitfield_align_1: [u16; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
pub unspecified: bool,
pub _reserved1: u8,
pub _reserved2: u16,
}
unfortunately, Zeroable can't be applied to __BindgenBitfieldUnit since
event its member (`storage`) is private :-(.
But there's a solution to force (and at the same time unsafely) ZERO the
entire structure in const:
* const_zero macro: https://docs.rs/const-zero/latest/const_zero/
With const_zero, we can implement Zeroable for MemTxAttrs:
unsafe impl Zeroable for MemTxAttrs {
const ZERO: Self = unsafe {const_zero!(MemTxAttrs)};
}