@@ -288,7 +288,7 @@ impl BufferChainBuilder<Writable> {
288288///
289289/// Contains a scatter-gather list of [`BufferElement`]s, divided into
290290/// readable (driver->device) and writable (device->driver) sections.
291- #[ derive( Debug , Default , Clone ) ]
291+ #[ derive( Debug , Clone ) ]
292292pub struct BufferChain {
293293 /// All buffer elements (readable followed by writable)
294294 elems : SmallVec < [ BufferElement ; 16 ] > ,
@@ -1350,20 +1350,20 @@ pub(crate) mod tests {
13501350 impl MemOps for TestMem {
13511351 type Error = core:: convert:: Infallible ;
13521352
1353- fn read ( & self , addr : u64 , dst : & mut [ u8 ] ) -> Result < usize , Self :: Error > {
1353+ fn read ( & self , addr : u64 , dst : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
13541354 let src = self . ptr_for_addr ( addr) ;
13551355 unsafe {
13561356 ptr:: copy_nonoverlapping ( src, dst. as_mut_ptr ( ) , dst. len ( ) ) ;
13571357 }
1358- Ok ( dst . len ( ) )
1358+ Ok ( ( ) )
13591359 }
13601360
1361- fn write ( & self , addr : u64 , src : & [ u8 ] ) -> Result < usize , Self :: Error > {
1361+ fn write ( & self , addr : u64 , src : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
13621362 let dst = self . ptr_for_addr ( addr) ;
13631363 unsafe {
13641364 ptr:: copy_nonoverlapping ( src. as_ptr ( ) , dst, src. len ( ) ) ;
13651365 }
1366- Ok ( src . len ( ) )
1366+ Ok ( ( ) )
13671367 }
13681368
13691369 fn read_val < T : Pod > ( & self , addr : u64 ) -> Result < T , Self :: Error > {
@@ -1842,18 +1842,6 @@ pub(crate) mod tests {
18421842 ) ) ;
18431843 }
18441844
1845- #[ test]
1846- fn test_empty_chain_rejected ( ) {
1847- let chain = BufferChain :: default ( ) ;
1848- assert_eq ! ( chain. len( ) , 0 ) ;
1849-
1850- let ring = make_ring ( 4 ) ;
1851- let mut producer = make_producer ( & ring) ;
1852-
1853- let result = producer. submit_available ( & chain) ;
1854- assert ! ( matches!( result, Err ( RingError :: EmptyChain ) ) ) ;
1855- }
1856-
18571845 #[ test]
18581846 fn test_wrap_stress ( ) {
18591847 let ring = make_ring ( 4 ) ;
@@ -2491,7 +2479,7 @@ pub(crate) mod tests {
24912479 // Out-of-order multi-length explicit
24922480 #[ test]
24932481 fn test_out_of_order_multi_length ( ) {
2494- let ring = make_ring ( 12 ) ;
2482+ let ring = make_ring ( 16 ) ;
24952483 let mut producer = make_producer ( & ring) ;
24962484 let mut consumer = make_consumer ( & ring) ;
24972485
@@ -3311,7 +3299,7 @@ mod fuzz {
33113299
33123300 impl Arbitrary for Scenario {
33133301 fn arbitrary ( g : & mut Gen ) -> Self {
3314- let table_size = usize:: arbitrary ( g) % MAX_RING + 1 ;
3302+ let table_size = ( usize:: arbitrary ( g) % MAX_RING + 1 ) . next_power_of_two ( ) ;
33153303 let num_ops = usize:: arbitrary ( g) % MAX_OPS + 1 ;
33163304
33173305 let ops = ( 0 ..num_ops) . map ( |_| Op :: arbitrary ( g) ) . collect ( ) ;
0 commit comments