mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-migration: add safety comments for impl ByteValued
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -57,6 +57,9 @@ pub struct Request {
|
|||||||
length: u64, // Length of payload for command excluding the Request struct
|
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 {
|
impl Request {
|
||||||
pub fn new(command: Command, length: u64) -> Self {
|
pub fn new(command: Command, length: u64) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -112,8 +115,6 @@ impl Request {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl ByteValued for Request {}
|
|
||||||
|
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
#[derive(Copy, Clone, PartialEq)]
|
#[derive(Copy, Clone, PartialEq)]
|
||||||
pub enum Status {
|
pub enum Status {
|
||||||
@@ -136,6 +137,9 @@ pub struct Response {
|
|||||||
length: u64, // Length of payload for command excluding the Response struct
|
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 {
|
impl Response {
|
||||||
pub fn new(status: Status, length: u64) -> Self {
|
pub fn new(status: Status, length: u64) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -171,8 +175,6 @@ impl Response {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl ByteValued for Response {}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone, Default, Serialize, Deserialize, Versionize)]
|
#[derive(Clone, Default, Serialize, Deserialize, Versionize)]
|
||||||
pub struct MemoryRange {
|
pub struct MemoryRange {
|
||||||
|
|||||||
Reference in New Issue
Block a user