pub fn new(start: GuestAddress, mem: &'a GuestMemoryMmap, qsize: u16) -> Self {
            // power of 2?
            assert!(qsize > 0 && qsize & (qsize - 1) == 0);

            let mut dtable = Vec::with_capacity(qsize as usize);

            let mut end = start;

            for _ in 0..qsize {
                let d = VirtqDesc::new(end, mem);
                end = d.end();
                dtable.push(d);
            }

            const AVAIL_ALIGN: usize = 2;

            let avail = VirtqAvail::new(end, mem, qsize, AVAIL_ALIGN);

            const USED_ALIGN: u64 = 4;

            let mut x = avail.end().0;
            x = (x + USED_ALIGN - 1) & !(USED_ALIGN - 1);

            let used = VirtqUsed::new(GuestAddress(x), mem, qsize, USED_ALIGN as usize);

            VirtQueue {
                dtable,
                avail,
                used,
            }
        }
// We try to make sure things are aligned properly :-s
We try to make sure things are aligned properly :-s
We try to make sure things are aligned properly : - s
pub fn new(start: GuestAddress, mem: &'a GuestMemoryMmap, qsize: u16) -> Self {
            // power of 2?
            assert!(qsize > 0 && qsize & (qsize - 1) == 0);
            let mut dtable = Vec::with_capacity(qsize as usize);
            let mut end = start;
            for _ in 0..qsize {
                let d = VirtqDesc::new(end, mem);
                end = d.end();
                dtable.push(d);
            }
            const AVAIL_ALIGN: usize = 2;
            let avail = VirtqAvail::new(end, mem, qsize, AVAIL_ALIGN);
            const USED_ALIGN: u64 = 4;
            let mut x = avail.end().0;
            x = (x + USED_ALIGN - 1) & !(USED_ALIGN - 1);
            let used = VirtqUsed::new(GuestAddress(x), mem, qsize, USED_ALIGN as usize);
            VirtQueue {
                dtable,
                avail,
                used,
            }
        }
pub fn new ( start : GuestAddress , mem : & ' a GuestMemoryMmap , qsize : u16 ) -> Self { // power of 2? assert ! ( qsize 0 qsize ( qsize 1 ) 0 ) ; let mut dtable = Vec :: with_capacity ( qsize as usize ) ; let mut end = start ; for _ in 0 .. qsize { let d = VirtqDesc :: new ( end , mem ) ; end = d . end ( ) ; dtable . push ( d ) ; } const AVAIL_ALIGN : usize = 2 ; let avail = VirtqAvail :: new ( end , mem , qsize , AVAIL_ALIGN ) ; const USED_ALIGN : u64 = 4 ; let mut x = avail . end ( ) . 0 ; x = ( x + USED_ALIGN - 1 ) & ! ( USED_ALIGN - 1 ) ; let used = VirtqUsed :: new ( GuestAddress ( x ) , mem , qsize , USED_ALIGN as usize ) ; VirtQueue { dtable , avail , used , } }
We try to make sure things are aligned properly :-s
We try to make sure things are aligned properly : - s
start
GuestAddress
mem
&'a GuestMemoryMmap
qsize
u16