vmm/devices/virtio/generated/
virtio_mem.rs

1// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4// automatically generated by tools/bindgen.sh
5
6#![allow(
7    non_camel_case_types,
8    non_upper_case_globals,
9    dead_code,
10    non_snake_case,
11    clippy::ptr_as_ptr,
12    clippy::undocumented_unsafe_blocks,
13    missing_debug_implementations,
14    clippy::tests_outside_test_module,
15    unsafe_op_in_unsafe_fn,
16    clippy::redundant_static_lifetimes
17)]
18
19pub const VIRTIO_MEM_F_ACPI_PXM: u32 = 0;
20pub const VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE: u32 = 1;
21pub const VIRTIO_MEM_F_PERSISTENT_SUSPEND: u32 = 2;
22pub const VIRTIO_MEM_REQ_PLUG: u32 = 0;
23pub const VIRTIO_MEM_REQ_UNPLUG: u32 = 1;
24pub const VIRTIO_MEM_REQ_UNPLUG_ALL: u32 = 2;
25pub const VIRTIO_MEM_REQ_STATE: u32 = 3;
26pub const VIRTIO_MEM_RESP_ACK: u32 = 0;
27pub const VIRTIO_MEM_RESP_NACK: u32 = 1;
28pub const VIRTIO_MEM_RESP_BUSY: u32 = 2;
29pub const VIRTIO_MEM_RESP_ERROR: u32 = 3;
30pub const VIRTIO_MEM_STATE_PLUGGED: u32 = 0;
31pub const VIRTIO_MEM_STATE_UNPLUGGED: u32 = 1;
32pub const VIRTIO_MEM_STATE_MIXED: u32 = 2;
33pub type __u8 = ::std::os::raw::c_uchar;
34pub type __u16 = ::std::os::raw::c_ushort;
35pub type __u64 = ::std::os::raw::c_ulonglong;
36pub type __le16 = __u16;
37pub type __le64 = __u64;
38pub type __virtio16 = __u16;
39pub type __virtio64 = __u64;
40#[repr(C)]
41#[derive(Debug, Default, Copy, Clone, PartialEq)]
42pub struct virtio_mem_req_plug {
43    pub addr: __virtio64,
44    pub nb_blocks: __virtio16,
45    pub padding: [__virtio16; 3usize],
46}
47#[allow(clippy::unnecessary_operation, clippy::identity_op)]
48const _: () = {
49    ["Size of virtio_mem_req_plug"][::std::mem::size_of::<virtio_mem_req_plug>() - 16usize];
50    ["Alignment of virtio_mem_req_plug"][::std::mem::align_of::<virtio_mem_req_plug>() - 8usize];
51    ["Offset of field: virtio_mem_req_plug::addr"]
52        [::std::mem::offset_of!(virtio_mem_req_plug, addr) - 0usize];
53    ["Offset of field: virtio_mem_req_plug::nb_blocks"]
54        [::std::mem::offset_of!(virtio_mem_req_plug, nb_blocks) - 8usize];
55    ["Offset of field: virtio_mem_req_plug::padding"]
56        [::std::mem::offset_of!(virtio_mem_req_plug, padding) - 10usize];
57};
58#[repr(C)]
59#[derive(Debug, Default, Copy, Clone, PartialEq)]
60pub struct virtio_mem_req_unplug {
61    pub addr: __virtio64,
62    pub nb_blocks: __virtio16,
63    pub padding: [__virtio16; 3usize],
64}
65#[allow(clippy::unnecessary_operation, clippy::identity_op)]
66const _: () = {
67    ["Size of virtio_mem_req_unplug"][::std::mem::size_of::<virtio_mem_req_unplug>() - 16usize];
68    ["Alignment of virtio_mem_req_unplug"]
69        [::std::mem::align_of::<virtio_mem_req_unplug>() - 8usize];
70    ["Offset of field: virtio_mem_req_unplug::addr"]
71        [::std::mem::offset_of!(virtio_mem_req_unplug, addr) - 0usize];
72    ["Offset of field: virtio_mem_req_unplug::nb_blocks"]
73        [::std::mem::offset_of!(virtio_mem_req_unplug, nb_blocks) - 8usize];
74    ["Offset of field: virtio_mem_req_unplug::padding"]
75        [::std::mem::offset_of!(virtio_mem_req_unplug, padding) - 10usize];
76};
77#[repr(C)]
78#[derive(Debug, Default, Copy, Clone, PartialEq)]
79pub struct virtio_mem_req_state {
80    pub addr: __virtio64,
81    pub nb_blocks: __virtio16,
82    pub padding: [__virtio16; 3usize],
83}
84#[allow(clippy::unnecessary_operation, clippy::identity_op)]
85const _: () = {
86    ["Size of virtio_mem_req_state"][::std::mem::size_of::<virtio_mem_req_state>() - 16usize];
87    ["Alignment of virtio_mem_req_state"][::std::mem::align_of::<virtio_mem_req_state>() - 8usize];
88    ["Offset of field: virtio_mem_req_state::addr"]
89        [::std::mem::offset_of!(virtio_mem_req_state, addr) - 0usize];
90    ["Offset of field: virtio_mem_req_state::nb_blocks"]
91        [::std::mem::offset_of!(virtio_mem_req_state, nb_blocks) - 8usize];
92    ["Offset of field: virtio_mem_req_state::padding"]
93        [::std::mem::offset_of!(virtio_mem_req_state, padding) - 10usize];
94};
95#[repr(C)]
96#[derive(Copy, Clone)]
97pub struct virtio_mem_req {
98    pub type_: __virtio16,
99    pub padding: [__virtio16; 3usize],
100    pub u: virtio_mem_req__bindgen_ty_1,
101}
102#[repr(C)]
103#[derive(Copy, Clone)]
104pub union virtio_mem_req__bindgen_ty_1 {
105    pub plug: virtio_mem_req_plug,
106    pub unplug: virtio_mem_req_unplug,
107    pub state: virtio_mem_req_state,
108}
109#[allow(clippy::unnecessary_operation, clippy::identity_op)]
110const _: () = {
111    ["Size of virtio_mem_req__bindgen_ty_1"]
112        [::std::mem::size_of::<virtio_mem_req__bindgen_ty_1>() - 16usize];
113    ["Alignment of virtio_mem_req__bindgen_ty_1"]
114        [::std::mem::align_of::<virtio_mem_req__bindgen_ty_1>() - 8usize];
115    ["Offset of field: virtio_mem_req__bindgen_ty_1::plug"]
116        [::std::mem::offset_of!(virtio_mem_req__bindgen_ty_1, plug) - 0usize];
117    ["Offset of field: virtio_mem_req__bindgen_ty_1::unplug"]
118        [::std::mem::offset_of!(virtio_mem_req__bindgen_ty_1, unplug) - 0usize];
119    ["Offset of field: virtio_mem_req__bindgen_ty_1::state"]
120        [::std::mem::offset_of!(virtio_mem_req__bindgen_ty_1, state) - 0usize];
121};
122impl Default for virtio_mem_req__bindgen_ty_1 {
123    fn default() -> Self {
124        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
125        unsafe {
126            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
127            s.assume_init()
128        }
129    }
130}
131#[allow(clippy::unnecessary_operation, clippy::identity_op)]
132const _: () = {
133    ["Size of virtio_mem_req"][::std::mem::size_of::<virtio_mem_req>() - 24usize];
134    ["Alignment of virtio_mem_req"][::std::mem::align_of::<virtio_mem_req>() - 8usize];
135    ["Offset of field: virtio_mem_req::type_"]
136        [::std::mem::offset_of!(virtio_mem_req, type_) - 0usize];
137    ["Offset of field: virtio_mem_req::padding"]
138        [::std::mem::offset_of!(virtio_mem_req, padding) - 2usize];
139    ["Offset of field: virtio_mem_req::u"][::std::mem::offset_of!(virtio_mem_req, u) - 8usize];
140};
141impl Default for virtio_mem_req {
142    fn default() -> Self {
143        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
144        unsafe {
145            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
146            s.assume_init()
147        }
148    }
149}
150#[repr(C)]
151#[derive(Debug, Default, Copy, Clone, PartialEq)]
152pub struct virtio_mem_resp_state {
153    pub state: __virtio16,
154}
155#[allow(clippy::unnecessary_operation, clippy::identity_op)]
156const _: () = {
157    ["Size of virtio_mem_resp_state"][::std::mem::size_of::<virtio_mem_resp_state>() - 2usize];
158    ["Alignment of virtio_mem_resp_state"]
159        [::std::mem::align_of::<virtio_mem_resp_state>() - 2usize];
160    ["Offset of field: virtio_mem_resp_state::state"]
161        [::std::mem::offset_of!(virtio_mem_resp_state, state) - 0usize];
162};
163#[repr(C)]
164#[derive(Copy, Clone)]
165pub struct virtio_mem_resp {
166    pub type_: __virtio16,
167    pub padding: [__virtio16; 3usize],
168    pub u: virtio_mem_resp__bindgen_ty_1,
169}
170#[repr(C)]
171#[derive(Copy, Clone)]
172pub union virtio_mem_resp__bindgen_ty_1 {
173    pub state: virtio_mem_resp_state,
174}
175#[allow(clippy::unnecessary_operation, clippy::identity_op)]
176const _: () = {
177    ["Size of virtio_mem_resp__bindgen_ty_1"]
178        [::std::mem::size_of::<virtio_mem_resp__bindgen_ty_1>() - 2usize];
179    ["Alignment of virtio_mem_resp__bindgen_ty_1"]
180        [::std::mem::align_of::<virtio_mem_resp__bindgen_ty_1>() - 2usize];
181    ["Offset of field: virtio_mem_resp__bindgen_ty_1::state"]
182        [::std::mem::offset_of!(virtio_mem_resp__bindgen_ty_1, state) - 0usize];
183};
184impl Default for virtio_mem_resp__bindgen_ty_1 {
185    fn default() -> Self {
186        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
187        unsafe {
188            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
189            s.assume_init()
190        }
191    }
192}
193#[allow(clippy::unnecessary_operation, clippy::identity_op)]
194const _: () = {
195    ["Size of virtio_mem_resp"][::std::mem::size_of::<virtio_mem_resp>() - 10usize];
196    ["Alignment of virtio_mem_resp"][::std::mem::align_of::<virtio_mem_resp>() - 2usize];
197    ["Offset of field: virtio_mem_resp::type_"]
198        [::std::mem::offset_of!(virtio_mem_resp, type_) - 0usize];
199    ["Offset of field: virtio_mem_resp::padding"]
200        [::std::mem::offset_of!(virtio_mem_resp, padding) - 2usize];
201    ["Offset of field: virtio_mem_resp::u"][::std::mem::offset_of!(virtio_mem_resp, u) - 8usize];
202};
203impl Default for virtio_mem_resp {
204    fn default() -> Self {
205        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
206        unsafe {
207            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
208            s.assume_init()
209        }
210    }
211}
212#[repr(C)]
213#[derive(Debug, Default, Copy, Clone, PartialEq)]
214pub struct virtio_mem_config {
215    pub block_size: __le64,
216    pub node_id: __le16,
217    pub padding: [__u8; 6usize],
218    pub addr: __le64,
219    pub region_size: __le64,
220    pub usable_region_size: __le64,
221    pub plugged_size: __le64,
222    pub requested_size: __le64,
223}
224#[allow(clippy::unnecessary_operation, clippy::identity_op)]
225const _: () = {
226    ["Size of virtio_mem_config"][::std::mem::size_of::<virtio_mem_config>() - 56usize];
227    ["Alignment of virtio_mem_config"][::std::mem::align_of::<virtio_mem_config>() - 8usize];
228    ["Offset of field: virtio_mem_config::block_size"]
229        [::std::mem::offset_of!(virtio_mem_config, block_size) - 0usize];
230    ["Offset of field: virtio_mem_config::node_id"]
231        [::std::mem::offset_of!(virtio_mem_config, node_id) - 8usize];
232    ["Offset of field: virtio_mem_config::padding"]
233        [::std::mem::offset_of!(virtio_mem_config, padding) - 10usize];
234    ["Offset of field: virtio_mem_config::addr"]
235        [::std::mem::offset_of!(virtio_mem_config, addr) - 16usize];
236    ["Offset of field: virtio_mem_config::region_size"]
237        [::std::mem::offset_of!(virtio_mem_config, region_size) - 24usize];
238    ["Offset of field: virtio_mem_config::usable_region_size"]
239        [::std::mem::offset_of!(virtio_mem_config, usable_region_size) - 32usize];
240    ["Offset of field: virtio_mem_config::plugged_size"]
241        [::std::mem::offset_of!(virtio_mem_config, plugged_size) - 40usize];
242    ["Offset of field: virtio_mem_config::requested_size"]
243        [::std::mem::offset_of!(virtio_mem_config, requested_size) - 48usize];
244};