mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-20 07:58:55 +00:00
vm-migration: add safety comments for impl ByteValued
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
94fcfa9f1f
commit
1a2b01888c
@ -57,6 +57,9 @@ pub struct Request {
|
||||
length: u64, // Length of payload for command excluding the Request struct
|
||||
}
|
||||
|
||||
// SAFETY: Request contains a series of integers with no implicit padding
|
||||
unsafe impl ByteValued for Request {}
|
||||
|
||||
impl Request {
|
||||
pub fn new(command: Command, length: u64) -> Self {
|
||||
Self {
|
||||
@ -112,8 +115,6 @@ impl Request {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl ByteValued for Request {}
|
||||
|
||||
#[repr(u16)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub enum Status {
|
||||
@ -136,6 +137,9 @@ pub struct Response {
|
||||
length: u64, // Length of payload for command excluding the Response struct
|
||||
}
|
||||
|
||||
// SAFETY: Response contains a series of integers with no implicit padding
|
||||
unsafe impl ByteValued for Response {}
|
||||
|
||||
impl Response {
|
||||
pub fn new(status: Status, length: u64) -> Self {
|
||||
Self {
|
||||
@ -171,8 +175,6 @@ impl Response {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl ByteValued for Response {}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Default, Serialize, Deserialize, Versionize)]
|
||||
pub struct MemoryRange {
|
||||
|
Loading…
x
Reference in New Issue
Block a user