mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-01-12 16:45:31 +00:00
virtio-queue: Add an is_read_only() method for DescriptorChain
Add an is_read_only method to the DescriptorChain struct. This is easier to read at a glance than `!is_write_only()`, which looks almost the same as `is_write_only()`. BUG=chromium:703939 TEST=none Change-Id: I0cb3b17c30e38804a21d3e63e975157c96879cb4 Signed-off-by: Chirantan Ekbote <chirantan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1067703 Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
This commit is contained in:
parent
6452eaf902
commit
dd19b2e28a
1 changed files with 8 additions and 0 deletions
|
@ -103,6 +103,14 @@ impl<'a> DescriptorChain<'a> {
|
||||||
self.flags & VIRTQ_DESC_F_WRITE != 0
|
self.flags & VIRTQ_DESC_F_WRITE != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// If the driver designated this as a read only descriptor.
|
||||||
|
///
|
||||||
|
/// If this is false, this descriptor is write only.
|
||||||
|
/// Read only means the emulated device can read and the driver can write.
|
||||||
|
pub fn is_read_only(&self) -> bool {
|
||||||
|
self.flags & VIRTQ_DESC_F_WRITE == 0
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets the next descriptor in this descriptor chain, if there is one.
|
/// Gets the next descriptor in this descriptor chain, if there is one.
|
||||||
///
|
///
|
||||||
/// Note that this is distinct from the next descriptor chain returned by `AvailIter`, which is
|
/// Note that this is distinct from the next descriptor chain returned by `AvailIter`, which is
|
||||||
|
|
Loading…
Reference in a new issue