Skip to content

Commit 4f264ce

Browse files
committed
refactor(queue): remove mem from try_enable_notification method
`mem` parameter was not used for anything. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 6363dec commit 4f264ce

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/vmm/src/devices/virtio/queue.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ impl Queue {
537537
return self.pop(mem);
538538
}
539539

540-
if self.try_enable_notification(mem) {
540+
if self.try_enable_notification() {
541541
return None;
542542
}
543543

@@ -614,9 +614,7 @@ impl Queue {
614614
/// successfully enabled. Otherwise it means that one or more descriptors can still be consumed
615615
/// from the available ring and we can't guarantee that there will be a notification. In this
616616
/// case the caller might want to consume the mentioned descriptors and call this method again.
617-
pub fn try_enable_notification<M: GuestMemory>(&mut self, mem: &M) -> bool {
618-
debug_assert!(self.is_valid(mem));
619-
617+
pub fn try_enable_notification(&mut self) -> bool {
620618
// If the device doesn't use notification suppression, we'll continue to get notifications
621619
// no matter what.
622620
if !self.uses_notif_suppression {
@@ -1129,11 +1127,11 @@ mod verification {
11291127
#[kani::proof]
11301128
#[kani::unwind(0)]
11311129
fn verify_try_enable_notification() {
1132-
let ProofContext(mut queue, mem) = ProofContext::bounded_queue();
1130+
let ProofContext(mut queue, _) = ProofContext::bounded_queue();
11331131

11341132
kani::assume(queue.len() <= queue.actual_size());
11351133

1136-
if queue.try_enable_notification(&mem) && queue.uses_notif_suppression {
1134+
if queue.try_enable_notification() && queue.uses_notif_suppression {
11371135
// We only require new notifications if the queue is empty (e.g. we've processed
11381136
// everything we've been notified about), or if suppression is disabled.
11391137
assert!(queue.is_empty());
@@ -1584,18 +1582,18 @@ mod tests {
15841582
assert_eq!(q.len(), 1);
15851583

15861584
// Notification suppression is disabled. try_enable_notification shouldn't do anything.
1587-
assert!(q.try_enable_notification(m));
1585+
assert!(q.try_enable_notification());
15881586
assert_eq!(q.avail_event(m), 0);
15891587

15901588
// Enable notification suppression and check again. There is 1 available descriptor chain.
15911589
// Again nothing should happen.
15921590
q.enable_notif_suppression();
1593-
assert!(!q.try_enable_notification(m));
1591+
assert!(!q.try_enable_notification());
15941592
assert_eq!(q.avail_event(m), 0);
15951593

15961594
// Consume the descriptor. avail_event should be modified
15971595
assert!(q.pop(m).is_some());
1598-
assert!(q.try_enable_notification(m));
1596+
assert!(q.try_enable_notification());
15991597
assert_eq!(q.avail_event(m), 1);
16001598
}
16011599

0 commit comments

Comments
 (0)