use #[repr(C)] instead of #[repr(packed)] to avoid warning

master
WangRunji 6 years ago
parent 847a1c7576
commit 1ceb7ae12d

@ -13,7 +13,7 @@ use super::super::gpu::virtio_gpu;
use super::super::net::virtio_net;
// virtio 4.2.4 Legacy interface
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
pub struct VirtIOHeader {
magic: ReadOnly<u32>, // 0x000
@ -64,7 +64,7 @@ bitflags! {
}
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
pub struct VirtIOVirtqueueDesc {
pub addr: Volatile<u64>,
@ -81,7 +81,7 @@ bitflags! {
}
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
pub struct VirtIOVirtqueueAvailableRing {
pub flags: Volatile<u16>,
@ -90,14 +90,14 @@ pub struct VirtIOVirtqueueAvailableRing {
used_event: Volatile<u16>
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
pub struct VirtIOVirtqueueUsedElem {
id: Volatile<u32>,
len: Volatile<u32>
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
pub struct VirtIOVirtqueueUsedRing {
pub flags: Volatile<u16>,

@ -33,7 +33,7 @@ struct VirtIOGpu {
rect: VirtIOGpuRect
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
struct VirtIOGpuConfig {
events_read: ReadOnly<u32>,
@ -88,7 +88,7 @@ const VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID : u32 = 0x1202;
const VIRTIO_GPU_FLAG_FENCE : u32 = 1 << 0;
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
struct VirtIOGpuCtrlHdr {
hdr_type: u32,
@ -110,7 +110,7 @@ impl VirtIOGpuCtrlHdr {
}
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug, Copy, Clone, Default)]
struct VirtIOGpuRect {
x: u32,
@ -119,7 +119,7 @@ struct VirtIOGpuRect {
height: u32
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
struct VirtIOGpuRespDisplayInfo {
header: VirtIOGpuCtrlHdr,
@ -130,7 +130,7 @@ struct VirtIOGpuRespDisplayInfo {
const VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM: u32 = 1;
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
struct VirtIOGpuResourceCreate2D {
header: VirtIOGpuCtrlHdr,
@ -140,7 +140,7 @@ struct VirtIOGpuResourceCreate2D {
height: u32
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
struct VirtIOGpuResourceAttachBacking {
header: VirtIOGpuCtrlHdr,
@ -151,7 +151,7 @@ struct VirtIOGpuResourceAttachBacking {
padding: u32
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
struct VirtIOGpuSetScanout {
header: VirtIOGpuCtrlHdr,
@ -160,7 +160,7 @@ struct VirtIOGpuSetScanout {
resource_id: u32
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
struct VirtIOGpuTransferToHost2D {
header: VirtIOGpuCtrlHdr,
@ -170,7 +170,7 @@ struct VirtIOGpuTransferToHost2D {
padding: u32
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
struct VirtIOGpuResourceFlush {
header: VirtIOGpuCtrlHdr,

@ -272,7 +272,7 @@ bitflags! {
}
}
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
struct VirtIONetworkConfig {
mac: [u8; 6],
@ -280,7 +280,7 @@ struct VirtIONetworkConfig {
}
// virtio 5.1.6 Device Operation
#[repr(packed)]
#[repr(C)]
#[derive(Debug)]
struct VirtIONetHeader {
flags: Volatile<u8>,

Loading…
Cancel
Save