@@ -1212,17 +1212,7 @@ mod tests {
1212
1212
use crate :: devices:: virtio:: queue:: QueueError :: DescIndexOutOfBounds ;
1213
1213
use crate :: devices:: virtio:: test_utils:: { default_mem, VirtQueue } ;
1214
1214
use crate :: utilities:: test_utils:: { multi_region_mem, single_region_mem} ;
1215
- use crate :: vstate:: memory:: { GuestAddress , GuestMemoryMmap } ;
1216
-
1217
- impl Queue {
1218
- fn avail_event ( & self , mem : & GuestMemoryMmap ) -> u16 {
1219
- let avail_event_addr = self
1220
- . used_ring_address
1221
- . unchecked_add ( u64:: from ( 4 + 8 * self . actual_size ( ) ) ) ;
1222
-
1223
- mem. read_obj :: < u16 > ( avail_event_addr) . unwrap ( )
1224
- }
1225
- }
1215
+ use crate :: vstate:: memory:: GuestAddress ;
1226
1216
1227
1217
#[ test]
1228
1218
fn test_checked_new_descriptor_chain ( ) {
@@ -1416,15 +1406,15 @@ mod tests {
1416
1406
1417
1407
// There are no more descriptors, but notification suppression is disabled.
1418
1408
// Calling pop_or_enable_notification() should simply return None.
1419
- assert_eq ! ( q . avail_event( m ) , 0 ) ;
1409
+ assert_eq ! ( * q . used_ring . avail_event( ) , 0 ) ;
1420
1410
assert ! ( q. pop_or_enable_notification( ) . is_none( ) ) ;
1421
- assert_eq ! ( q . avail_event( m ) , 0 ) ;
1411
+ assert_eq ! ( * q . used_ring . avail_event( ) , 0 ) ;
1422
1412
1423
1413
// There are no more descriptors and notification suppression is enabled. Calling
1424
1414
// pop_or_enable_notification() should enable notifications.
1425
1415
q. enable_notif_suppression ( ) ;
1426
1416
assert ! ( q. pop_or_enable_notification( ) . is_none( ) ) ;
1427
- assert_eq ! ( q . avail_event( m ) , 2 ) ;
1417
+ assert_eq ! ( * q . used_ring . avail_event( ) , 2 ) ;
1428
1418
}
1429
1419
1430
1420
#[ test]
@@ -1623,18 +1613,18 @@ mod tests {
1623
1613
1624
1614
// Notification suppression is disabled. try_enable_notification shouldn't do anything.
1625
1615
assert ! ( q. try_enable_notification( ) ) ;
1626
- assert_eq ! ( q . avail_event( m ) , 0 ) ;
1616
+ assert_eq ! ( * q . used_ring . avail_event( ) , 0 ) ;
1627
1617
1628
1618
// Enable notification suppression and check again. There is 1 available descriptor chain.
1629
1619
// Again nothing should happen.
1630
1620
q. enable_notif_suppression ( ) ;
1631
1621
assert ! ( !q. try_enable_notification( ) ) ;
1632
- assert_eq ! ( q . avail_event( m ) , 0 ) ;
1622
+ assert_eq ! ( * q . used_ring . avail_event( ) , 0 ) ;
1633
1623
1634
1624
// Consume the descriptor. avail_event should be modified
1635
1625
assert ! ( q. pop( ) . is_some( ) ) ;
1636
1626
assert ! ( q. try_enable_notification( ) ) ;
1637
- assert_eq ! ( q . avail_event( m ) , 1 ) ;
1627
+ assert_eq ! ( * q . used_ring . avail_event( ) , 1 ) ;
1638
1628
}
1639
1629
1640
1630
#[ test]
0 commit comments