1 // Copyright 2023, The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 use zerocopy::{AsBytes, FromBytes, FromZeroes};
16 
17 /* automatically generated by rust-bindgen 0.65.1 */
18 
19 pub const BOOT_MAGIC: &[u8; 9usize] = b"ANDROID!\0";
20 pub const BOOT_MAGIC_SIZE: u32 = 8;
21 pub const BOOT_NAME_SIZE: u32 = 16;
22 pub const BOOT_ARGS_SIZE: u32 = 512;
23 pub const BOOT_EXTRA_ARGS_SIZE: u32 = 1024;
24 pub const VENDOR_BOOT_MAGIC: &[u8; 9usize] = b"VNDRBOOT\0";
25 pub const VENDOR_BOOT_MAGIC_SIZE: u32 = 8;
26 pub const VENDOR_BOOT_ARGS_SIZE: u32 = 2048;
27 pub const VENDOR_BOOT_NAME_SIZE: u32 = 16;
28 pub const VENDOR_RAMDISK_TYPE_NONE: u32 = 0;
29 pub const VENDOR_RAMDISK_TYPE_PLATFORM: u32 = 1;
30 pub const VENDOR_RAMDISK_TYPE_RECOVERY: u32 = 2;
31 pub const VENDOR_RAMDISK_TYPE_DLKM: u32 = 3;
32 pub const VENDOR_RAMDISK_NAME_SIZE: u32 = 32;
33 pub const VENDOR_RAMDISK_TABLE_ENTRY_BOARD_ID_SIZE: u32 = 16;
34 #[repr(C, packed)]
35 #[derive(AsBytes, FromBytes, FromZeroes, PartialEq, Copy, Clone, Debug)]
36 pub struct boot_img_hdr_v0 {
37     pub magic: [u8; 8usize],
38     pub kernel_size: u32,
39     pub kernel_addr: u32,
40     pub ramdisk_size: u32,
41     pub ramdisk_addr: u32,
42     pub second_size: u32,
43     pub second_addr: u32,
44     pub tags_addr: u32,
45     pub page_size: u32,
46     pub header_version: u32,
47     pub os_version: u32,
48     pub name: [u8; 16usize],
49     pub cmdline: [u8; 512usize],
50     pub id: [u32; 8usize],
51     pub extra_cmdline: [u8; 1024usize],
52 }
53 #[test]
bindgen_test_layout_boot_img_hdr_v0()54 fn bindgen_test_layout_boot_img_hdr_v0() {
55     const UNINIT: ::core::mem::MaybeUninit<boot_img_hdr_v0> = ::core::mem::MaybeUninit::uninit();
56     let ptr = UNINIT.as_ptr();
57     assert_eq!(
58         ::core::mem::size_of::<boot_img_hdr_v0>(),
59         1632usize,
60         concat!("Size of: ", stringify!(boot_img_hdr_v0))
61     );
62     assert_eq!(
63         ::core::mem::align_of::<boot_img_hdr_v0>(),
64         1usize,
65         concat!("Alignment of ", stringify!(boot_img_hdr_v0))
66     );
67     assert_eq!(
68         unsafe { ::core::ptr::addr_of!((*ptr).magic) as usize - ptr as usize },
69         0usize,
70         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(magic))
71     );
72     assert_eq!(
73         unsafe { ::core::ptr::addr_of!((*ptr).kernel_size) as usize - ptr as usize },
74         8usize,
75         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(kernel_size))
76     );
77     assert_eq!(
78         unsafe { ::core::ptr::addr_of!((*ptr).kernel_addr) as usize - ptr as usize },
79         12usize,
80         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(kernel_addr))
81     );
82     assert_eq!(
83         unsafe { ::core::ptr::addr_of!((*ptr).ramdisk_size) as usize - ptr as usize },
84         16usize,
85         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(ramdisk_size))
86     );
87     assert_eq!(
88         unsafe { ::core::ptr::addr_of!((*ptr).ramdisk_addr) as usize - ptr as usize },
89         20usize,
90         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(ramdisk_addr))
91     );
92     assert_eq!(
93         unsafe { ::core::ptr::addr_of!((*ptr).second_size) as usize - ptr as usize },
94         24usize,
95         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(second_size))
96     );
97     assert_eq!(
98         unsafe { ::core::ptr::addr_of!((*ptr).second_addr) as usize - ptr as usize },
99         28usize,
100         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(second_addr))
101     );
102     assert_eq!(
103         unsafe { ::core::ptr::addr_of!((*ptr).tags_addr) as usize - ptr as usize },
104         32usize,
105         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(tags_addr))
106     );
107     assert_eq!(
108         unsafe { ::core::ptr::addr_of!((*ptr).page_size) as usize - ptr as usize },
109         36usize,
110         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(page_size))
111     );
112     assert_eq!(
113         unsafe { ::core::ptr::addr_of!((*ptr).header_version) as usize - ptr as usize },
114         40usize,
115         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(header_version))
116     );
117     assert_eq!(
118         unsafe { ::core::ptr::addr_of!((*ptr).os_version) as usize - ptr as usize },
119         44usize,
120         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(os_version))
121     );
122     assert_eq!(
123         unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
124         48usize,
125         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(name))
126     );
127     assert_eq!(
128         unsafe { ::core::ptr::addr_of!((*ptr).cmdline) as usize - ptr as usize },
129         64usize,
130         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(cmdline))
131     );
132     assert_eq!(
133         unsafe { ::core::ptr::addr_of!((*ptr).id) as usize - ptr as usize },
134         576usize,
135         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(id))
136     );
137     assert_eq!(
138         unsafe { ::core::ptr::addr_of!((*ptr).extra_cmdline) as usize - ptr as usize },
139         608usize,
140         concat!("Offset of field: ", stringify!(boot_img_hdr_v0), "::", stringify!(extra_cmdline))
141     );
142 }
143 impl Default for boot_img_hdr_v0 {
default() -> Self144     fn default() -> Self {
145         let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
146         unsafe {
147             ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
148             s.assume_init()
149         }
150     }
151 }
152 pub type boot_img_hdr = boot_img_hdr_v0;
153 #[repr(C, packed)]
154 #[derive(AsBytes, FromBytes, FromZeroes, PartialEq, Copy, Clone, Debug)]
155 pub struct boot_img_hdr_v1 {
156     pub _base: boot_img_hdr_v0,
157     pub recovery_dtbo_size: u32,
158     pub recovery_dtbo_offset: u64,
159     pub header_size: u32,
160 }
161 #[test]
bindgen_test_layout_boot_img_hdr_v1()162 fn bindgen_test_layout_boot_img_hdr_v1() {
163     const UNINIT: ::core::mem::MaybeUninit<boot_img_hdr_v1> = ::core::mem::MaybeUninit::uninit();
164     let ptr = UNINIT.as_ptr();
165     assert_eq!(
166         ::core::mem::size_of::<boot_img_hdr_v1>(),
167         1648usize,
168         concat!("Size of: ", stringify!(boot_img_hdr_v1))
169     );
170     assert_eq!(
171         ::core::mem::align_of::<boot_img_hdr_v1>(),
172         1usize,
173         concat!("Alignment of ", stringify!(boot_img_hdr_v1))
174     );
175     assert_eq!(
176         unsafe { ::core::ptr::addr_of!((*ptr).recovery_dtbo_size) as usize - ptr as usize },
177         1632usize,
178         concat!(
179             "Offset of field: ",
180             stringify!(boot_img_hdr_v1),
181             "::",
182             stringify!(recovery_dtbo_size)
183         )
184     );
185     assert_eq!(
186         unsafe { ::core::ptr::addr_of!((*ptr).recovery_dtbo_offset) as usize - ptr as usize },
187         1636usize,
188         concat!(
189             "Offset of field: ",
190             stringify!(boot_img_hdr_v1),
191             "::",
192             stringify!(recovery_dtbo_offset)
193         )
194     );
195     assert_eq!(
196         unsafe { ::core::ptr::addr_of!((*ptr).header_size) as usize - ptr as usize },
197         1644usize,
198         concat!("Offset of field: ", stringify!(boot_img_hdr_v1), "::", stringify!(header_size))
199     );
200 }
201 impl Default for boot_img_hdr_v1 {
default() -> Self202     fn default() -> Self {
203         let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
204         unsafe {
205             ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
206             s.assume_init()
207         }
208     }
209 }
210 #[repr(C, packed)]
211 #[derive(AsBytes, FromBytes, FromZeroes, PartialEq, Copy, Clone, Debug)]
212 pub struct boot_img_hdr_v2 {
213     pub _base: boot_img_hdr_v1,
214     pub dtb_size: u32,
215     pub dtb_addr: u64,
216 }
217 #[test]
bindgen_test_layout_boot_img_hdr_v2()218 fn bindgen_test_layout_boot_img_hdr_v2() {
219     const UNINIT: ::core::mem::MaybeUninit<boot_img_hdr_v2> = ::core::mem::MaybeUninit::uninit();
220     let ptr = UNINIT.as_ptr();
221     assert_eq!(
222         ::core::mem::size_of::<boot_img_hdr_v2>(),
223         1660usize,
224         concat!("Size of: ", stringify!(boot_img_hdr_v2))
225     );
226     assert_eq!(
227         ::core::mem::align_of::<boot_img_hdr_v2>(),
228         1usize,
229         concat!("Alignment of ", stringify!(boot_img_hdr_v2))
230     );
231     assert_eq!(
232         unsafe { ::core::ptr::addr_of!((*ptr).dtb_size) as usize - ptr as usize },
233         1648usize,
234         concat!("Offset of field: ", stringify!(boot_img_hdr_v2), "::", stringify!(dtb_size))
235     );
236     assert_eq!(
237         unsafe { ::core::ptr::addr_of!((*ptr).dtb_addr) as usize - ptr as usize },
238         1652usize,
239         concat!("Offset of field: ", stringify!(boot_img_hdr_v2), "::", stringify!(dtb_addr))
240     );
241 }
242 impl Default for boot_img_hdr_v2 {
default() -> Self243     fn default() -> Self {
244         let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
245         unsafe {
246             ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
247             s.assume_init()
248         }
249     }
250 }
251 #[repr(C, packed)]
252 #[derive(AsBytes, FromBytes, FromZeroes, PartialEq, Copy, Clone, Debug)]
253 pub struct boot_img_hdr_v3 {
254     pub magic: [u8; 8usize],
255     pub kernel_size: u32,
256     pub ramdisk_size: u32,
257     pub os_version: u32,
258     pub header_size: u32,
259     pub reserved: [u32; 4usize],
260     pub header_version: u32,
261     pub cmdline: [u8; 1536usize],
262 }
263 #[test]
bindgen_test_layout_boot_img_hdr_v3()264 fn bindgen_test_layout_boot_img_hdr_v3() {
265     const UNINIT: ::core::mem::MaybeUninit<boot_img_hdr_v3> = ::core::mem::MaybeUninit::uninit();
266     let ptr = UNINIT.as_ptr();
267     assert_eq!(
268         ::core::mem::size_of::<boot_img_hdr_v3>(),
269         1580usize,
270         concat!("Size of: ", stringify!(boot_img_hdr_v3))
271     );
272     assert_eq!(
273         ::core::mem::align_of::<boot_img_hdr_v3>(),
274         1usize,
275         concat!("Alignment of ", stringify!(boot_img_hdr_v3))
276     );
277     assert_eq!(
278         unsafe { ::core::ptr::addr_of!((*ptr).magic) as usize - ptr as usize },
279         0usize,
280         concat!("Offset of field: ", stringify!(boot_img_hdr_v3), "::", stringify!(magic))
281     );
282     assert_eq!(
283         unsafe { ::core::ptr::addr_of!((*ptr).kernel_size) as usize - ptr as usize },
284         8usize,
285         concat!("Offset of field: ", stringify!(boot_img_hdr_v3), "::", stringify!(kernel_size))
286     );
287     assert_eq!(
288         unsafe { ::core::ptr::addr_of!((*ptr).ramdisk_size) as usize - ptr as usize },
289         12usize,
290         concat!("Offset of field: ", stringify!(boot_img_hdr_v3), "::", stringify!(ramdisk_size))
291     );
292     assert_eq!(
293         unsafe { ::core::ptr::addr_of!((*ptr).os_version) as usize - ptr as usize },
294         16usize,
295         concat!("Offset of field: ", stringify!(boot_img_hdr_v3), "::", stringify!(os_version))
296     );
297     assert_eq!(
298         unsafe { ::core::ptr::addr_of!((*ptr).header_size) as usize - ptr as usize },
299         20usize,
300         concat!("Offset of field: ", stringify!(boot_img_hdr_v3), "::", stringify!(header_size))
301     );
302     assert_eq!(
303         unsafe { ::core::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize },
304         24usize,
305         concat!("Offset of field: ", stringify!(boot_img_hdr_v3), "::", stringify!(reserved))
306     );
307     assert_eq!(
308         unsafe { ::core::ptr::addr_of!((*ptr).header_version) as usize - ptr as usize },
309         40usize,
310         concat!("Offset of field: ", stringify!(boot_img_hdr_v3), "::", stringify!(header_version))
311     );
312     assert_eq!(
313         unsafe { ::core::ptr::addr_of!((*ptr).cmdline) as usize - ptr as usize },
314         44usize,
315         concat!("Offset of field: ", stringify!(boot_img_hdr_v3), "::", stringify!(cmdline))
316     );
317 }
318 impl Default for boot_img_hdr_v3 {
default() -> Self319     fn default() -> Self {
320         let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
321         unsafe {
322             ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
323             s.assume_init()
324         }
325     }
326 }
327 #[repr(C, packed)]
328 #[derive(AsBytes, FromBytes, FromZeroes, PartialEq, Copy, Clone, Debug)]
329 pub struct vendor_boot_img_hdr_v3 {
330     pub magic: [u8; 8usize],
331     pub header_version: u32,
332     pub page_size: u32,
333     pub kernel_addr: u32,
334     pub ramdisk_addr: u32,
335     pub vendor_ramdisk_size: u32,
336     pub cmdline: [u8; 2048usize],
337     pub tags_addr: u32,
338     pub name: [u8; 16usize],
339     pub header_size: u32,
340     pub dtb_size: u32,
341     pub dtb_addr: u64,
342 }
343 #[test]
bindgen_test_layout_vendor_boot_img_hdr_v3()344 fn bindgen_test_layout_vendor_boot_img_hdr_v3() {
345     const UNINIT: ::core::mem::MaybeUninit<vendor_boot_img_hdr_v3> =
346         ::core::mem::MaybeUninit::uninit();
347     let ptr = UNINIT.as_ptr();
348     assert_eq!(
349         ::core::mem::size_of::<vendor_boot_img_hdr_v3>(),
350         2112usize,
351         concat!("Size of: ", stringify!(vendor_boot_img_hdr_v3))
352     );
353     assert_eq!(
354         ::core::mem::align_of::<vendor_boot_img_hdr_v3>(),
355         1usize,
356         concat!("Alignment of ", stringify!(vendor_boot_img_hdr_v3))
357     );
358     assert_eq!(
359         unsafe { ::core::ptr::addr_of!((*ptr).magic) as usize - ptr as usize },
360         0usize,
361         concat!("Offset of field: ", stringify!(vendor_boot_img_hdr_v3), "::", stringify!(magic))
362     );
363     assert_eq!(
364         unsafe { ::core::ptr::addr_of!((*ptr).header_version) as usize - ptr as usize },
365         8usize,
366         concat!(
367             "Offset of field: ",
368             stringify!(vendor_boot_img_hdr_v3),
369             "::",
370             stringify!(header_version)
371         )
372     );
373     assert_eq!(
374         unsafe { ::core::ptr::addr_of!((*ptr).page_size) as usize - ptr as usize },
375         12usize,
376         concat!(
377             "Offset of field: ",
378             stringify!(vendor_boot_img_hdr_v3),
379             "::",
380             stringify!(page_size)
381         )
382     );
383     assert_eq!(
384         unsafe { ::core::ptr::addr_of!((*ptr).kernel_addr) as usize - ptr as usize },
385         16usize,
386         concat!(
387             "Offset of field: ",
388             stringify!(vendor_boot_img_hdr_v3),
389             "::",
390             stringify!(kernel_addr)
391         )
392     );
393     assert_eq!(
394         unsafe { ::core::ptr::addr_of!((*ptr).ramdisk_addr) as usize - ptr as usize },
395         20usize,
396         concat!(
397             "Offset of field: ",
398             stringify!(vendor_boot_img_hdr_v3),
399             "::",
400             stringify!(ramdisk_addr)
401         )
402     );
403     assert_eq!(
404         unsafe { ::core::ptr::addr_of!((*ptr).vendor_ramdisk_size) as usize - ptr as usize },
405         24usize,
406         concat!(
407             "Offset of field: ",
408             stringify!(vendor_boot_img_hdr_v3),
409             "::",
410             stringify!(vendor_ramdisk_size)
411         )
412     );
413     assert_eq!(
414         unsafe { ::core::ptr::addr_of!((*ptr).cmdline) as usize - ptr as usize },
415         28usize,
416         concat!("Offset of field: ", stringify!(vendor_boot_img_hdr_v3), "::", stringify!(cmdline))
417     );
418     assert_eq!(
419         unsafe { ::core::ptr::addr_of!((*ptr).tags_addr) as usize - ptr as usize },
420         2076usize,
421         concat!(
422             "Offset of field: ",
423             stringify!(vendor_boot_img_hdr_v3),
424             "::",
425             stringify!(tags_addr)
426         )
427     );
428     assert_eq!(
429         unsafe { ::core::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
430         2080usize,
431         concat!("Offset of field: ", stringify!(vendor_boot_img_hdr_v3), "::", stringify!(name))
432     );
433     assert_eq!(
434         unsafe { ::core::ptr::addr_of!((*ptr).header_size) as usize - ptr as usize },
435         2096usize,
436         concat!(
437             "Offset of field: ",
438             stringify!(vendor_boot_img_hdr_v3),
439             "::",
440             stringify!(header_size)
441         )
442     );
443     assert_eq!(
444         unsafe { ::core::ptr::addr_of!((*ptr).dtb_size) as usize - ptr as usize },
445         2100usize,
446         concat!(
447             "Offset of field: ",
448             stringify!(vendor_boot_img_hdr_v3),
449             "::",
450             stringify!(dtb_size)
451         )
452     );
453     assert_eq!(
454         unsafe { ::core::ptr::addr_of!((*ptr).dtb_addr) as usize - ptr as usize },
455         2104usize,
456         concat!(
457             "Offset of field: ",
458             stringify!(vendor_boot_img_hdr_v3),
459             "::",
460             stringify!(dtb_addr)
461         )
462     );
463 }
464 impl Default for vendor_boot_img_hdr_v3 {
default() -> Self465     fn default() -> Self {
466         let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
467         unsafe {
468             ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
469             s.assume_init()
470         }
471     }
472 }
473 #[repr(C, packed)]
474 #[derive(AsBytes, FromBytes, FromZeroes, PartialEq, Copy, Clone, Debug)]
475 pub struct boot_img_hdr_v4 {
476     pub _base: boot_img_hdr_v3,
477     pub signature_size: u32,
478 }
479 #[test]
bindgen_test_layout_boot_img_hdr_v4()480 fn bindgen_test_layout_boot_img_hdr_v4() {
481     const UNINIT: ::core::mem::MaybeUninit<boot_img_hdr_v4> = ::core::mem::MaybeUninit::uninit();
482     let ptr = UNINIT.as_ptr();
483     assert_eq!(
484         ::core::mem::size_of::<boot_img_hdr_v4>(),
485         1584usize,
486         concat!("Size of: ", stringify!(boot_img_hdr_v4))
487     );
488     assert_eq!(
489         ::core::mem::align_of::<boot_img_hdr_v4>(),
490         1usize,
491         concat!("Alignment of ", stringify!(boot_img_hdr_v4))
492     );
493     assert_eq!(
494         unsafe { ::core::ptr::addr_of!((*ptr).signature_size) as usize - ptr as usize },
495         1580usize,
496         concat!("Offset of field: ", stringify!(boot_img_hdr_v4), "::", stringify!(signature_size))
497     );
498 }
499 impl Default for boot_img_hdr_v4 {
default() -> Self500     fn default() -> Self {
501         let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
502         unsafe {
503             ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
504             s.assume_init()
505         }
506     }
507 }
508 #[repr(C, packed)]
509 #[derive(AsBytes, FromBytes, FromZeroes, PartialEq, Copy, Clone, Debug)]
510 pub struct vendor_boot_img_hdr_v4 {
511     pub _base: vendor_boot_img_hdr_v3,
512     pub vendor_ramdisk_table_size: u32,
513     pub vendor_ramdisk_table_entry_num: u32,
514     pub vendor_ramdisk_table_entry_size: u32,
515     pub bootconfig_size: u32,
516 }
517 #[test]
bindgen_test_layout_vendor_boot_img_hdr_v4()518 fn bindgen_test_layout_vendor_boot_img_hdr_v4() {
519     const UNINIT: ::core::mem::MaybeUninit<vendor_boot_img_hdr_v4> =
520         ::core::mem::MaybeUninit::uninit();
521     let ptr = UNINIT.as_ptr();
522     assert_eq!(
523         ::core::mem::size_of::<vendor_boot_img_hdr_v4>(),
524         2128usize,
525         concat!("Size of: ", stringify!(vendor_boot_img_hdr_v4))
526     );
527     assert_eq!(
528         ::core::mem::align_of::<vendor_boot_img_hdr_v4>(),
529         1usize,
530         concat!("Alignment of ", stringify!(vendor_boot_img_hdr_v4))
531     );
532     assert_eq!(
533         unsafe { ::core::ptr::addr_of!((*ptr).vendor_ramdisk_table_size) as usize - ptr as usize },
534         2112usize,
535         concat!(
536             "Offset of field: ",
537             stringify!(vendor_boot_img_hdr_v4),
538             "::",
539             stringify!(vendor_ramdisk_table_size)
540         )
541     );
542     assert_eq!(
543         unsafe {
544             ::core::ptr::addr_of!((*ptr).vendor_ramdisk_table_entry_num) as usize - ptr as usize
545         },
546         2116usize,
547         concat!(
548             "Offset of field: ",
549             stringify!(vendor_boot_img_hdr_v4),
550             "::",
551             stringify!(vendor_ramdisk_table_entry_num)
552         )
553     );
554     assert_eq!(
555         unsafe {
556             ::core::ptr::addr_of!((*ptr).vendor_ramdisk_table_entry_size) as usize - ptr as usize
557         },
558         2120usize,
559         concat!(
560             "Offset of field: ",
561             stringify!(vendor_boot_img_hdr_v4),
562             "::",
563             stringify!(vendor_ramdisk_table_entry_size)
564         )
565     );
566     assert_eq!(
567         unsafe { ::core::ptr::addr_of!((*ptr).bootconfig_size) as usize - ptr as usize },
568         2124usize,
569         concat!(
570             "Offset of field: ",
571             stringify!(vendor_boot_img_hdr_v4),
572             "::",
573             stringify!(bootconfig_size)
574         )
575     );
576 }
577 impl Default for vendor_boot_img_hdr_v4 {
default() -> Self578     fn default() -> Self {
579         let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
580         unsafe {
581             ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
582             s.assume_init()
583         }
584     }
585 }
586 #[repr(C, packed)]
587 #[derive(AsBytes, FromBytes, FromZeroes, PartialEq, Copy, Clone, Debug)]
588 pub struct vendor_ramdisk_table_entry_v4 {
589     pub ramdisk_size: u32,
590     pub ramdisk_offset: u32,
591     pub ramdisk_type: u32,
592     pub ramdisk_name: [u8; 32usize],
593     pub board_id: [u32; 16usize],
594 }
595 #[test]
bindgen_test_layout_vendor_ramdisk_table_entry_v4()596 fn bindgen_test_layout_vendor_ramdisk_table_entry_v4() {
597     const UNINIT: ::core::mem::MaybeUninit<vendor_ramdisk_table_entry_v4> =
598         ::core::mem::MaybeUninit::uninit();
599     let ptr = UNINIT.as_ptr();
600     assert_eq!(
601         ::core::mem::size_of::<vendor_ramdisk_table_entry_v4>(),
602         108usize,
603         concat!("Size of: ", stringify!(vendor_ramdisk_table_entry_v4))
604     );
605     assert_eq!(
606         ::core::mem::align_of::<vendor_ramdisk_table_entry_v4>(),
607         1usize,
608         concat!("Alignment of ", stringify!(vendor_ramdisk_table_entry_v4))
609     );
610     assert_eq!(
611         unsafe { ::core::ptr::addr_of!((*ptr).ramdisk_size) as usize - ptr as usize },
612         0usize,
613         concat!(
614             "Offset of field: ",
615             stringify!(vendor_ramdisk_table_entry_v4),
616             "::",
617             stringify!(ramdisk_size)
618         )
619     );
620     assert_eq!(
621         unsafe { ::core::ptr::addr_of!((*ptr).ramdisk_offset) as usize - ptr as usize },
622         4usize,
623         concat!(
624             "Offset of field: ",
625             stringify!(vendor_ramdisk_table_entry_v4),
626             "::",
627             stringify!(ramdisk_offset)
628         )
629     );
630     assert_eq!(
631         unsafe { ::core::ptr::addr_of!((*ptr).ramdisk_type) as usize - ptr as usize },
632         8usize,
633         concat!(
634             "Offset of field: ",
635             stringify!(vendor_ramdisk_table_entry_v4),
636             "::",
637             stringify!(ramdisk_type)
638         )
639     );
640     assert_eq!(
641         unsafe { ::core::ptr::addr_of!((*ptr).ramdisk_name) as usize - ptr as usize },
642         12usize,
643         concat!(
644             "Offset of field: ",
645             stringify!(vendor_ramdisk_table_entry_v4),
646             "::",
647             stringify!(ramdisk_name)
648         )
649     );
650     assert_eq!(
651         unsafe { ::core::ptr::addr_of!((*ptr).board_id) as usize - ptr as usize },
652         44usize,
653         concat!(
654             "Offset of field: ",
655             stringify!(vendor_ramdisk_table_entry_v4),
656             "::",
657             stringify!(board_id)
658         )
659     );
660 }
661 impl Default for vendor_ramdisk_table_entry_v4 {
default() -> Self662     fn default() -> Self {
663         let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
664         unsafe {
665             ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
666             s.assume_init()
667         }
668     }
669 }
670