mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-20 19:45:32 +00:00
virtio-devices: use C ABI-qualification for packed structures
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
5b29eba636
commit
778c05d678
@ -73,7 +73,7 @@ const VIRTIO_IOMMU_F_BYPASS_CONFIG: u32 = 6;
|
||||
const VIRTIO_IOMMU_PAGE_SIZE_MASK: u64 = (2 << 20) | (4 << 10);
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[allow(dead_code)]
|
||||
struct VirtioIommuRange32 {
|
||||
start: u32,
|
||||
@ -81,7 +81,7 @@ struct VirtioIommuRange32 {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[allow(dead_code)]
|
||||
struct VirtioIommuRange64 {
|
||||
start: u64,
|
||||
@ -89,7 +89,7 @@ struct VirtioIommuRange64 {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[allow(dead_code)]
|
||||
struct VirtioIommuConfig {
|
||||
page_size_mask: u64,
|
||||
@ -108,7 +108,7 @@ const VIRTIO_IOMMU_T_UNMAP: u8 = 4;
|
||||
const VIRTIO_IOMMU_T_PROBE: u8 = 5;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
struct VirtioIommuReqHead {
|
||||
type_: u8,
|
||||
_reserved: [u8; 3],
|
||||
@ -134,7 +134,7 @@ const VIRTIO_IOMMU_S_FAULT: u8 = 7;
|
||||
const VIRTIO_IOMMU_S_NOMEM: u8 = 8;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[allow(dead_code)]
|
||||
struct VirtioIommuReqTail {
|
||||
status: u8,
|
||||
@ -143,7 +143,7 @@ struct VirtioIommuReqTail {
|
||||
|
||||
/// ATTACH request
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
struct VirtioIommuReqAttach {
|
||||
domain: u32,
|
||||
endpoint: u32,
|
||||
@ -155,7 +155,7 @@ const VIRTIO_IOMMU_ATTACH_F_BYPASS: u32 = 1;
|
||||
|
||||
/// DETACH request
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
struct VirtioIommuReqDetach {
|
||||
domain: u32,
|
||||
endpoint: u32,
|
||||
@ -175,7 +175,7 @@ const VIRTIO_IOMMU_MAP_F_MASK: u32 =
|
||||
|
||||
/// MAP request
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
struct VirtioIommuReqMap {
|
||||
domain: u32,
|
||||
virt_start: u64,
|
||||
@ -186,7 +186,7 @@ struct VirtioIommuReqMap {
|
||||
|
||||
/// UNMAP request
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
struct VirtioIommuReqUnmap {
|
||||
domain: u32,
|
||||
virt_start: u64,
|
||||
@ -203,7 +203,7 @@ const VIRTIO_IOMMU_PROBE_T_MASK: u16 = 0xfff;
|
||||
|
||||
/// PROBE request
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[allow(dead_code)]
|
||||
struct VirtioIommuReqProbe {
|
||||
endpoint: u32,
|
||||
@ -211,7 +211,7 @@ struct VirtioIommuReqProbe {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[allow(dead_code)]
|
||||
struct VirtioIommuProbeProperty {
|
||||
type_: u16,
|
||||
@ -224,7 +224,7 @@ const VIRTIO_IOMMU_RESV_MEM_T_RESERVED: u8 = 0;
|
||||
const VIRTIO_IOMMU_RESV_MEM_T_MSI: u8 = 1;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[allow(dead_code)]
|
||||
struct VirtioIommuProbeResvMem {
|
||||
subtype: u8,
|
||||
@ -254,7 +254,7 @@ const VIRTIO_IOMMU_FAULT_R_MAPPING: u32 = 2;
|
||||
/// Fault reporting through eventq
|
||||
#[allow(unused)]
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
struct VirtioIommuFault {
|
||||
reason: u8,
|
||||
reserved: [u8; 3],
|
||||
|
@ -60,7 +60,7 @@ enum PciCapabilityType {
|
||||
const VIRTIO_PCI_CAP_OFFSET: usize = 2;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct VirtioPciCap {
|
||||
cap_len: u8, // Generic PCI field: capability length
|
||||
@ -101,7 +101,7 @@ impl VirtioPciCap {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct VirtioPciNotifyCap {
|
||||
cap: VirtioPciCap,
|
||||
@ -145,7 +145,7 @@ impl VirtioPciNotifyCap {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct VirtioPciCap64 {
|
||||
cap: VirtioPciCap,
|
||||
@ -184,7 +184,7 @@ impl VirtioPciCap64 {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct VirtioPciCfgCap {
|
||||
cap: VirtioPciCap,
|
||||
|
Loading…
x
Reference in New Issue
Block a user