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

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

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

Loading…
Cancel
Save