|
| 1 | +/* automatically generated by rust-bindgen */ |
| 2 | + |
| 3 | + |
| 4 | +#![allow(non_snake_case)] |
| 5 | + |
| 6 | + |
| 7 | +#[repr(C)] |
| 8 | +#[derive(Default)] |
| 9 | +pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>); |
| 10 | +impl <T> __IncompleteArrayField<T> { |
| 11 | + #[inline] |
| 12 | + pub fn new() -> Self { |
| 13 | + __IncompleteArrayField(::std::marker::PhantomData) |
| 14 | + } |
| 15 | + #[inline] |
| 16 | + pub unsafe fn as_ptr(&self) -> *const T { ::std::mem::transmute(self) } |
| 17 | + #[inline] |
| 18 | + pub unsafe fn as_mut_ptr(&mut self) -> *mut T { |
| 19 | + ::std::mem::transmute(self) |
| 20 | + } |
| 21 | + #[inline] |
| 22 | + pub unsafe fn as_slice(&self, len: usize) -> &[T] { |
| 23 | + ::std::slice::from_raw_parts(self.as_ptr(), len) |
| 24 | + } |
| 25 | + #[inline] |
| 26 | + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { |
| 27 | + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) |
| 28 | + } |
| 29 | +} |
| 30 | +impl <T> ::std::fmt::Debug for __IncompleteArrayField<T> { |
| 31 | + fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { |
| 32 | + fmt.write_str("__IncompleteArrayField") |
| 33 | + } |
| 34 | +} |
| 35 | +impl <T> ::std::clone::Clone for __IncompleteArrayField<T> { |
| 36 | + #[inline] |
| 37 | + fn clone(&self) -> Self { Self::new() } |
| 38 | +} |
| 39 | +impl <T> ::std::marker::Copy for __IncompleteArrayField<T> { } |
| 40 | +#[repr(C)] |
| 41 | +#[derive(Debug, Copy)] |
| 42 | +pub struct rte_ring { |
| 43 | + /**< Name of the ring. */ |
| 44 | + pub name: [::std::os::raw::c_char; 4usize], |
| 45 | + /**< Flags supplied at creation. */ |
| 46 | + pub flags: ::std::os::raw::c_int, |
| 47 | + pub memzone: *mut rte_memzone, |
| 48 | + pub prod: rte_ring_prod, |
| 49 | + pub cons: rte_ring_cons, |
| 50 | + /**< Memory space of ring starts here. |
| 51 | + * not volatile so need to be careful |
| 52 | + * about compiler re-ordering */ |
| 53 | + pub ring: __IncompleteArrayField<*mut ::std::os::raw::c_void>, |
| 54 | +} |
| 55 | +/** Ring producer status. */ |
| 56 | +#[repr(C)] |
| 57 | +#[derive(Debug, Default, Copy)] |
| 58 | +pub struct rte_ring_prod { |
| 59 | + /**< Maximum items before EDQUOT. */ |
| 60 | + pub watermark: u32, |
| 61 | + /**< True, if single producer. */ |
| 62 | + pub sp_enqueue: u32, |
| 63 | + /**< Size of ring. */ |
| 64 | + pub size: u32, |
| 65 | + /**< Mask (size-1) of ring. */ |
| 66 | + pub mask: u32, |
| 67 | + /**< Producer head. */ |
| 68 | + pub head: u32, |
| 69 | + /**< Producer tail. */ |
| 70 | + pub tail: u32, |
| 71 | +} |
| 72 | +#[test] |
| 73 | +fn bindgen_test_layout_rte_ring_prod() { |
| 74 | + assert_eq!(::std::mem::size_of::<rte_ring_prod>() , 24usize , concat ! ( |
| 75 | + "Size of: " , stringify ! ( rte_ring_prod ) )); |
| 76 | + assert_eq! (::std::mem::align_of::<rte_ring_prod>() , 4usize , concat ! ( |
| 77 | + "Alignment of " , stringify ! ( rte_ring_prod ) )); |
| 78 | + assert_eq! (unsafe { |
| 79 | + & ( * ( 0 as * const rte_ring_prod ) ) . watermark as * const |
| 80 | + _ as usize } , 0usize , concat ! ( |
| 81 | + "Alignment of field: " , stringify ! ( rte_ring_prod ) , "::" |
| 82 | + , stringify ! ( watermark ) )); |
| 83 | + assert_eq! (unsafe { |
| 84 | + & ( * ( 0 as * const rte_ring_prod ) ) . sp_enqueue as * const |
| 85 | + _ as usize } , 4usize , concat ! ( |
| 86 | + "Alignment of field: " , stringify ! ( rte_ring_prod ) , "::" |
| 87 | + , stringify ! ( sp_enqueue ) )); |
| 88 | + assert_eq! (unsafe { |
| 89 | + & ( * ( 0 as * const rte_ring_prod ) ) . size as * const _ as |
| 90 | + usize } , 8usize , concat ! ( |
| 91 | + "Alignment of field: " , stringify ! ( rte_ring_prod ) , "::" |
| 92 | + , stringify ! ( size ) )); |
| 93 | + assert_eq! (unsafe { |
| 94 | + & ( * ( 0 as * const rte_ring_prod ) ) . mask as * const _ as |
| 95 | + usize } , 12usize , concat ! ( |
| 96 | + "Alignment of field: " , stringify ! ( rte_ring_prod ) , "::" |
| 97 | + , stringify ! ( mask ) )); |
| 98 | + assert_eq! (unsafe { |
| 99 | + & ( * ( 0 as * const rte_ring_prod ) ) . head as * const _ as |
| 100 | + usize } , 16usize , concat ! ( |
| 101 | + "Alignment of field: " , stringify ! ( rte_ring_prod ) , "::" |
| 102 | + , stringify ! ( head ) )); |
| 103 | + assert_eq! (unsafe { |
| 104 | + & ( * ( 0 as * const rte_ring_prod ) ) . tail as * const _ as |
| 105 | + usize } , 20usize , concat ! ( |
| 106 | + "Alignment of field: " , stringify ! ( rte_ring_prod ) , "::" |
| 107 | + , stringify ! ( tail ) )); |
| 108 | +} |
| 109 | +impl Clone for rte_ring_prod { |
| 110 | + fn clone(&self) -> Self { *self } |
| 111 | +} |
| 112 | +/** Ring consumer status. */ |
| 113 | +#[repr(C)] |
| 114 | +#[derive(Debug, Default, Copy)] |
| 115 | +pub struct rte_ring_cons { |
| 116 | + /**< True, if single consumer. */ |
| 117 | + pub sc_dequeue: u32, |
| 118 | + /**< Size of the ring. */ |
| 119 | + pub size: u32, |
| 120 | + /**< Mask (size-1) of ring. */ |
| 121 | + pub mask: u32, |
| 122 | + /**< Consumer head. */ |
| 123 | + pub head: u32, |
| 124 | + /**< Consumer tail. */ |
| 125 | + pub tail: u32, |
| 126 | +} |
| 127 | +#[test] |
| 128 | +fn bindgen_test_layout_rte_ring_cons() { |
| 129 | + assert_eq!(::std::mem::size_of::<rte_ring_cons>() , 20usize , concat ! ( |
| 130 | + "Size of: " , stringify ! ( rte_ring_cons ) )); |
| 131 | + assert_eq! (::std::mem::align_of::<rte_ring_cons>() , 4usize , concat ! ( |
| 132 | + "Alignment of " , stringify ! ( rte_ring_cons ) )); |
| 133 | + assert_eq! (unsafe { |
| 134 | + & ( * ( 0 as * const rte_ring_cons ) ) . sc_dequeue as * const |
| 135 | + _ as usize } , 0usize , concat ! ( |
| 136 | + "Alignment of field: " , stringify ! ( rte_ring_cons ) , "::" |
| 137 | + , stringify ! ( sc_dequeue ) )); |
| 138 | + assert_eq! (unsafe { |
| 139 | + & ( * ( 0 as * const rte_ring_cons ) ) . size as * const _ as |
| 140 | + usize } , 4usize , concat ! ( |
| 141 | + "Alignment of field: " , stringify ! ( rte_ring_cons ) , "::" |
| 142 | + , stringify ! ( size ) )); |
| 143 | + assert_eq! (unsafe { |
| 144 | + & ( * ( 0 as * const rte_ring_cons ) ) . mask as * const _ as |
| 145 | + usize } , 8usize , concat ! ( |
| 146 | + "Alignment of field: " , stringify ! ( rte_ring_cons ) , "::" |
| 147 | + , stringify ! ( mask ) )); |
| 148 | + assert_eq! (unsafe { |
| 149 | + & ( * ( 0 as * const rte_ring_cons ) ) . head as * const _ as |
| 150 | + usize } , 12usize , concat ! ( |
| 151 | + "Alignment of field: " , stringify ! ( rte_ring_cons ) , "::" |
| 152 | + , stringify ! ( head ) )); |
| 153 | + assert_eq! (unsafe { |
| 154 | + & ( * ( 0 as * const rte_ring_cons ) ) . tail as * const _ as |
| 155 | + usize } , 16usize , concat ! ( |
| 156 | + "Alignment of field: " , stringify ! ( rte_ring_cons ) , "::" |
| 157 | + , stringify ! ( tail ) )); |
| 158 | +} |
| 159 | +impl Clone for rte_ring_cons { |
| 160 | + fn clone(&self) -> Self { *self } |
| 161 | +} |
| 162 | +#[test] |
| 163 | +fn bindgen_test_layout_rte_ring() { |
| 164 | + assert_eq!(::std::mem::size_of::<rte_ring>() , 64usize , concat ! ( |
| 165 | + "Size of: " , stringify ! ( rte_ring ) )); |
| 166 | + assert_eq! (::std::mem::align_of::<rte_ring>() , 8usize , concat ! ( |
| 167 | + "Alignment of " , stringify ! ( rte_ring ) )); |
| 168 | +} |
| 169 | +impl Clone for rte_ring { |
| 170 | + fn clone(&self) -> Self { *self } |
| 171 | +} |
| 172 | +impl Default for rte_ring { |
| 173 | + fn default() -> Self { unsafe { ::std::mem::zeroed() } } |
| 174 | +} |
| 175 | +#[repr(C)] |
| 176 | +#[derive(Debug, Default, Copy)] |
| 177 | +pub struct rte_memzone { |
| 178 | + pub _address: u8, |
| 179 | +} |
| 180 | +impl Clone for rte_memzone { |
| 181 | + fn clone(&self) -> Self { *self } |
| 182 | +} |
0 commit comments