diff options
author | Chirantan Ekbote <chirantan@chromium.org> | 2018-05-21 14:28:42 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-06-15 10:56:38 -0700 |
commit | dd19b2e28afe741180c58a8348905c7dcb2ce015 (patch) | |
tree | 0905e2750dce068d111f8e3f1952fd9c54b5125a /devices/src | |
parent | 6452eaf9023a71f133804fd04ebeb685783cb79b (diff) | |
download | crosvm-dd19b2e28afe741180c58a8348905c7dcb2ce015.tar crosvm-dd19b2e28afe741180c58a8348905c7dcb2ce015.tar.gz crosvm-dd19b2e28afe741180c58a8348905c7dcb2ce015.tar.bz2 crosvm-dd19b2e28afe741180c58a8348905c7dcb2ce015.tar.lz crosvm-dd19b2e28afe741180c58a8348905c7dcb2ce015.tar.xz crosvm-dd19b2e28afe741180c58a8348905c7dcb2ce015.tar.zst crosvm-dd19b2e28afe741180c58a8348905c7dcb2ce015.zip |
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>
Diffstat (limited to 'devices/src')
-rw-r--r-- | devices/src/virtio/queue.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/devices/src/virtio/queue.rs b/devices/src/virtio/queue.rs index 59b09b7..702c100 100644 --- a/devices/src/virtio/queue.rs +++ b/devices/src/virtio/queue.rs @@ -103,6 +103,14 @@ impl<'a> DescriptorChain<'a> { 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. /// /// Note that this is distinct from the next descriptor chain returned by `AvailIter`, which is |