@@ -1177,17 +1177,7 @@ mod tests {
1177
1177
use crate :: devices:: virtio:: queue:: QueueError :: DescIndexOutOfBounds ;
1178
1178
use crate :: devices:: virtio:: test_utils:: { default_mem, VirtQueue } ;
1179
1179
use crate :: utilities:: test_utils:: { multi_region_mem, single_region_mem} ;
1180
- use crate :: vstate:: memory:: { GuestAddress , GuestMemoryMmap } ;
1181
-
1182
- impl Queue {
1183
- fn avail_event ( & self , mem : & GuestMemoryMmap ) -> u16 {
1184
- let avail_event_addr = self
1185
- . used_ring_address
1186
- . unchecked_add ( u64:: from ( 4 + 8 * self . actual_size ( ) ) ) ;
1187
-
1188
- mem. read_obj :: < u16 > ( avail_event_addr) . unwrap ( )
1189
- }
1190
- }
1180
+ use crate :: vstate:: memory:: GuestAddress ;
1191
1181
1192
1182
#[ test]
1193
1183
fn test_checked_new_descriptor_chain ( ) {
@@ -1369,15 +1359,15 @@ mod tests {
1369
1359
1370
1360
// There are no more descriptors, but notification suppression is disabled.
1371
1361
// Calling pop_or_enable_notification() should simply return None.
1372
- assert_eq ! ( q. avail_event ( m ) , 0 ) ;
1362
+ assert_eq ! ( q. used_ring_avail_event_get ( ) , 0 ) ;
1373
1363
assert ! ( q. pop_or_enable_notification( ) . is_none( ) ) ;
1374
- assert_eq ! ( q. avail_event ( m ) , 0 ) ;
1364
+ assert_eq ! ( q. used_ring_avail_event_get ( ) , 0 ) ;
1375
1365
1376
1366
// There are no more descriptors and notification suppression is enabled. Calling
1377
1367
// pop_or_enable_notification() should enable notifications.
1378
1368
q. enable_notif_suppression ( ) ;
1379
1369
assert ! ( q. pop_or_enable_notification( ) . is_none( ) ) ;
1380
- assert_eq ! ( q. avail_event ( m ) , 2 ) ;
1370
+ assert_eq ! ( q. used_ring_avail_event_get ( ) , 2 ) ;
1381
1371
}
1382
1372
1383
1373
#[ test]
@@ -1576,18 +1566,18 @@ mod tests {
1576
1566
1577
1567
// Notification suppression is disabled. try_enable_notification shouldn't do anything.
1578
1568
assert ! ( q. try_enable_notification( ) ) ;
1579
- assert_eq ! ( q. avail_event ( m ) , 0 ) ;
1569
+ assert_eq ! ( q. used_ring_avail_event_get ( ) , 0 ) ;
1580
1570
1581
1571
// Enable notification suppression and check again. There is 1 available descriptor chain.
1582
1572
// Again nothing should happen.
1583
1573
q. enable_notif_suppression ( ) ;
1584
1574
assert ! ( !q. try_enable_notification( ) ) ;
1585
- assert_eq ! ( q. avail_event ( m ) , 0 ) ;
1575
+ assert_eq ! ( q. used_ring_avail_event_get ( ) , 0 ) ;
1586
1576
1587
1577
// Consume the descriptor. avail_event should be modified
1588
1578
assert ! ( q. pop( ) . is_some( ) ) ;
1589
1579
assert ! ( q. try_enable_notification( ) ) ;
1590
- assert_eq ! ( q. avail_event ( m ) , 1 ) ;
1580
+ assert_eq ! ( q. used_ring_avail_event_get ( ) , 1 ) ;
1591
1581
}
1592
1582
1593
1583
#[ test]
0 commit comments