mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-03 03:15:20 +00:00
vfio_user: add safety comments for impl ByteValued
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
d2d6eb0591
commit
d8becc742c
@ -73,8 +73,6 @@ struct Header {
|
|||||||
error: u32,
|
error: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl ByteValued for Header {}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Default, Clone, Copy, Debug)]
|
#[derive(Default, Clone, Copy, Debug)]
|
||||||
struct Version {
|
struct Version {
|
||||||
@ -82,7 +80,6 @@ struct Version {
|
|||||||
major: u16,
|
major: u16,
|
||||||
minor: u16,
|
minor: u16,
|
||||||
}
|
}
|
||||||
unsafe impl ByteValued for Version {}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
struct MigrationCapabilities {
|
struct MigrationCapabilities {
|
||||||
@ -128,8 +125,6 @@ struct DmaMap {
|
|||||||
size: u64,
|
size: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl ByteValued for DmaMap {}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Default, Clone, Copy, Debug)]
|
#[derive(Default, Clone, Copy, Debug)]
|
||||||
struct DmaUnmap {
|
struct DmaUnmap {
|
||||||
@ -140,8 +135,6 @@ struct DmaUnmap {
|
|||||||
size: u64,
|
size: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl ByteValued for DmaUnmap {}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Default, Clone, Copy, Debug)]
|
#[derive(Default, Clone, Copy, Debug)]
|
||||||
struct DeviceGetInfo {
|
struct DeviceGetInfo {
|
||||||
@ -152,8 +145,6 @@ struct DeviceGetInfo {
|
|||||||
num_irqs: u32,
|
num_irqs: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl ByteValued for DeviceGetInfo {}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Default, Clone, Copy, Debug)]
|
#[derive(Default, Clone, Copy, Debug)]
|
||||||
struct DeviceGetRegionInfo {
|
struct DeviceGetRegionInfo {
|
||||||
@ -161,8 +152,6 @@ struct DeviceGetRegionInfo {
|
|||||||
region_info: vfio_region_info,
|
region_info: vfio_region_info,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl ByteValued for DeviceGetRegionInfo {}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Default, Clone, Copy, Debug)]
|
#[derive(Default, Clone, Copy, Debug)]
|
||||||
struct RegionAccess {
|
struct RegionAccess {
|
||||||
@ -172,8 +161,6 @@ struct RegionAccess {
|
|||||||
count: u32,
|
count: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl ByteValued for RegionAccess {}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Default, Clone, Copy, Debug)]
|
#[derive(Default, Clone, Copy, Debug)]
|
||||||
struct GetIrqInfo {
|
struct GetIrqInfo {
|
||||||
@ -184,8 +171,6 @@ struct GetIrqInfo {
|
|||||||
count: u32,
|
count: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl ByteValued for GetIrqInfo {}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Default, Clone, Copy, Debug)]
|
#[derive(Default, Clone, Copy, Debug)]
|
||||||
struct SetIrqs {
|
struct SetIrqs {
|
||||||
@ -197,14 +182,22 @@ struct SetIrqs {
|
|||||||
count: u32,
|
count: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl ByteValued for SetIrqs {}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Default, Clone, Copy, Debug)]
|
#[derive(Default, Clone, Copy, Debug)]
|
||||||
struct DeviceReset {
|
struct DeviceReset {
|
||||||
header: Header,
|
header: Header,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SAFETY: these data structures only contain a sereis of integers
|
||||||
|
unsafe impl ByteValued for Header {}
|
||||||
|
unsafe impl ByteValued for Version {}
|
||||||
|
unsafe impl ByteValued for DmaMap {}
|
||||||
|
unsafe impl ByteValued for DmaUnmap {}
|
||||||
|
unsafe impl ByteValued for DeviceGetInfo {}
|
||||||
|
unsafe impl ByteValued for DeviceGetRegionInfo {}
|
||||||
|
unsafe impl ByteValued for RegionAccess {}
|
||||||
|
unsafe impl ByteValued for GetIrqInfo {}
|
||||||
|
unsafe impl ByteValued for SetIrqs {}
|
||||||
unsafe impl ByteValued for DeviceReset {}
|
unsafe impl ByteValued for DeviceReset {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
Loading…
Reference in New Issue
Block a user