mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
virtio-queue: add safety comments for impl ByteValued
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
31b3871eee
commit
94fcfa9f1f
@ -94,6 +94,9 @@ pub struct Descriptor {
|
||||
next: u16,
|
||||
}
|
||||
|
||||
// SAFETY: Descriptor only contains a series of integers and has no implicit padding
|
||||
unsafe impl ByteValued for Descriptor {}
|
||||
|
||||
#[allow(clippy::len_without_is_empty)]
|
||||
impl Descriptor {
|
||||
/// Creates a new descriptor
|
||||
@ -149,8 +152,6 @@ impl Descriptor {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl ByteValued for Descriptor {}
|
||||
|
||||
/// A virtio descriptor chain.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DescriptorChain<M: GuestAddressSpace> {
|
||||
@ -421,6 +422,9 @@ pub struct VirtqUsedElem {
|
||||
len: u32,
|
||||
}
|
||||
|
||||
// SAFETY: VirtqUsedElem only contains a series of integers and has no implicit padding
|
||||
unsafe impl ByteValued for VirtqUsedElem {}
|
||||
|
||||
impl VirtqUsedElem {
|
||||
/// Create a new `VirtqUsedElem` instance.
|
||||
pub fn new(id: u16, len: u32) -> Self {
|
||||
@ -431,8 +435,6 @@ impl VirtqUsedElem {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl ByteValued for VirtqUsedElem {}
|
||||
|
||||
/// Struct to hold an exclusive reference to the underlying `QueueState` object.
|
||||
pub enum QueueStateGuard<'a, M: GuestAddressSpace> {
|
||||
/// A reference to a `QueueState` object.
|
||||
|
Loading…
Reference in New Issue
Block a user