1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_KEY_SIZE: u32 = 256;
15
16#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub struct DeviceManagerFormatRequest {
18 pub key: Vec<u8>,
19 pub slot: u8,
20}
21
22impl fidl::Persistable for DeviceManagerFormatRequest {}
23
24#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25#[repr(C)]
26pub struct DeviceManagerFormatResponse {
27 pub status: i32,
28}
29
30impl fidl::Persistable for DeviceManagerFormatResponse {}
31
32#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33#[repr(C)]
34pub struct DeviceManagerSealResponse {
35 pub status: i32,
36}
37
38impl fidl::Persistable for DeviceManagerSealResponse {}
39
40#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
41#[repr(C)]
42pub struct DeviceManagerShredResponse {
43 pub status: i32,
44}
45
46impl fidl::Persistable for DeviceManagerShredResponse {}
47
48#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
49pub struct DeviceManagerUnsealRequest {
50 pub key: Vec<u8>,
51 pub slot: u8,
52}
53
54impl fidl::Persistable for DeviceManagerUnsealRequest {}
55
56#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57#[repr(C)]
58pub struct DeviceManagerUnsealResponse {
59 pub status: i32,
60}
61
62impl fidl::Persistable for DeviceManagerUnsealResponse {}
63
64mod internal {
65 use super::*;
66
67 impl fidl::encoding::ValueTypeMarker for DeviceManagerFormatRequest {
68 type Borrowed<'a> = &'a Self;
69 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
70 value
71 }
72 }
73
74 unsafe impl fidl::encoding::TypeMarker for DeviceManagerFormatRequest {
75 type Owned = Self;
76
77 #[inline(always)]
78 fn inline_align(_context: fidl::encoding::Context) -> usize {
79 8
80 }
81
82 #[inline(always)]
83 fn inline_size(_context: fidl::encoding::Context) -> usize {
84 24
85 }
86 }
87
88 unsafe impl<D: fidl::encoding::ResourceDialect>
89 fidl::encoding::Encode<DeviceManagerFormatRequest, D> for &DeviceManagerFormatRequest
90 {
91 #[inline]
92 unsafe fn encode(
93 self,
94 encoder: &mut fidl::encoding::Encoder<'_, D>,
95 offset: usize,
96 _depth: fidl::encoding::Depth,
97 ) -> fidl::Result<()> {
98 encoder.debug_check_bounds::<DeviceManagerFormatRequest>(offset);
99 fidl::encoding::Encode::<DeviceManagerFormatRequest, D>::encode(
101 (
102 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(
103 &self.key,
104 ),
105 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.slot),
106 ),
107 encoder,
108 offset,
109 _depth,
110 )
111 }
112 }
113 unsafe impl<
114 D: fidl::encoding::ResourceDialect,
115 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
116 T1: fidl::encoding::Encode<u8, D>,
117 > fidl::encoding::Encode<DeviceManagerFormatRequest, D> for (T0, T1)
118 {
119 #[inline]
120 unsafe fn encode(
121 self,
122 encoder: &mut fidl::encoding::Encoder<'_, D>,
123 offset: usize,
124 depth: fidl::encoding::Depth,
125 ) -> fidl::Result<()> {
126 encoder.debug_check_bounds::<DeviceManagerFormatRequest>(offset);
127 unsafe {
130 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
131 (ptr as *mut u64).write_unaligned(0);
132 }
133 self.0.encode(encoder, offset + 0, depth)?;
135 self.1.encode(encoder, offset + 16, depth)?;
136 Ok(())
137 }
138 }
139
140 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
141 for DeviceManagerFormatRequest
142 {
143 #[inline(always)]
144 fn new_empty() -> Self {
145 Self {
146 key: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D),
147 slot: fidl::new_empty!(u8, D),
148 }
149 }
150
151 #[inline]
152 unsafe fn decode(
153 &mut self,
154 decoder: &mut fidl::encoding::Decoder<'_, D>,
155 offset: usize,
156 _depth: fidl::encoding::Depth,
157 ) -> fidl::Result<()> {
158 decoder.debug_check_bounds::<Self>(offset);
159 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
161 let padval = unsafe { (ptr as *const u64).read_unaligned() };
162 let mask = 0xffffffffffffff00u64;
163 let maskedval = padval & mask;
164 if maskedval != 0 {
165 return Err(fidl::Error::NonZeroPadding {
166 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
167 });
168 }
169 fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.key, decoder, offset + 0, _depth)?;
170 fidl::decode!(u8, D, &mut self.slot, decoder, offset + 16, _depth)?;
171 Ok(())
172 }
173 }
174
175 impl fidl::encoding::ValueTypeMarker for DeviceManagerFormatResponse {
176 type Borrowed<'a> = &'a Self;
177 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
178 value
179 }
180 }
181
182 unsafe impl fidl::encoding::TypeMarker for DeviceManagerFormatResponse {
183 type Owned = Self;
184
185 #[inline(always)]
186 fn inline_align(_context: fidl::encoding::Context) -> usize {
187 4
188 }
189
190 #[inline(always)]
191 fn inline_size(_context: fidl::encoding::Context) -> usize {
192 4
193 }
194 #[inline(always)]
195 fn encode_is_copy() -> bool {
196 true
197 }
198
199 #[inline(always)]
200 fn decode_is_copy() -> bool {
201 true
202 }
203 }
204
205 unsafe impl<D: fidl::encoding::ResourceDialect>
206 fidl::encoding::Encode<DeviceManagerFormatResponse, D> for &DeviceManagerFormatResponse
207 {
208 #[inline]
209 unsafe fn encode(
210 self,
211 encoder: &mut fidl::encoding::Encoder<'_, D>,
212 offset: usize,
213 _depth: fidl::encoding::Depth,
214 ) -> fidl::Result<()> {
215 encoder.debug_check_bounds::<DeviceManagerFormatResponse>(offset);
216 unsafe {
217 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
219 (buf_ptr as *mut DeviceManagerFormatResponse)
220 .write_unaligned((self as *const DeviceManagerFormatResponse).read());
221 }
224 Ok(())
225 }
226 }
227 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
228 fidl::encoding::Encode<DeviceManagerFormatResponse, D> for (T0,)
229 {
230 #[inline]
231 unsafe fn encode(
232 self,
233 encoder: &mut fidl::encoding::Encoder<'_, D>,
234 offset: usize,
235 depth: fidl::encoding::Depth,
236 ) -> fidl::Result<()> {
237 encoder.debug_check_bounds::<DeviceManagerFormatResponse>(offset);
238 self.0.encode(encoder, offset + 0, depth)?;
242 Ok(())
243 }
244 }
245
246 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
247 for DeviceManagerFormatResponse
248 {
249 #[inline(always)]
250 fn new_empty() -> Self {
251 Self { status: fidl::new_empty!(i32, D) }
252 }
253
254 #[inline]
255 unsafe fn decode(
256 &mut self,
257 decoder: &mut fidl::encoding::Decoder<'_, D>,
258 offset: usize,
259 _depth: fidl::encoding::Depth,
260 ) -> fidl::Result<()> {
261 decoder.debug_check_bounds::<Self>(offset);
262 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
263 unsafe {
266 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
267 }
268 Ok(())
269 }
270 }
271
272 impl fidl::encoding::ValueTypeMarker for DeviceManagerSealResponse {
273 type Borrowed<'a> = &'a Self;
274 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
275 value
276 }
277 }
278
279 unsafe impl fidl::encoding::TypeMarker for DeviceManagerSealResponse {
280 type Owned = Self;
281
282 #[inline(always)]
283 fn inline_align(_context: fidl::encoding::Context) -> usize {
284 4
285 }
286
287 #[inline(always)]
288 fn inline_size(_context: fidl::encoding::Context) -> usize {
289 4
290 }
291 #[inline(always)]
292 fn encode_is_copy() -> bool {
293 true
294 }
295
296 #[inline(always)]
297 fn decode_is_copy() -> bool {
298 true
299 }
300 }
301
302 unsafe impl<D: fidl::encoding::ResourceDialect>
303 fidl::encoding::Encode<DeviceManagerSealResponse, D> for &DeviceManagerSealResponse
304 {
305 #[inline]
306 unsafe fn encode(
307 self,
308 encoder: &mut fidl::encoding::Encoder<'_, D>,
309 offset: usize,
310 _depth: fidl::encoding::Depth,
311 ) -> fidl::Result<()> {
312 encoder.debug_check_bounds::<DeviceManagerSealResponse>(offset);
313 unsafe {
314 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
316 (buf_ptr as *mut DeviceManagerSealResponse)
317 .write_unaligned((self as *const DeviceManagerSealResponse).read());
318 }
321 Ok(())
322 }
323 }
324 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
325 fidl::encoding::Encode<DeviceManagerSealResponse, D> for (T0,)
326 {
327 #[inline]
328 unsafe fn encode(
329 self,
330 encoder: &mut fidl::encoding::Encoder<'_, D>,
331 offset: usize,
332 depth: fidl::encoding::Depth,
333 ) -> fidl::Result<()> {
334 encoder.debug_check_bounds::<DeviceManagerSealResponse>(offset);
335 self.0.encode(encoder, offset + 0, depth)?;
339 Ok(())
340 }
341 }
342
343 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
344 for DeviceManagerSealResponse
345 {
346 #[inline(always)]
347 fn new_empty() -> Self {
348 Self { status: fidl::new_empty!(i32, D) }
349 }
350
351 #[inline]
352 unsafe fn decode(
353 &mut self,
354 decoder: &mut fidl::encoding::Decoder<'_, D>,
355 offset: usize,
356 _depth: fidl::encoding::Depth,
357 ) -> fidl::Result<()> {
358 decoder.debug_check_bounds::<Self>(offset);
359 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
360 unsafe {
363 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
364 }
365 Ok(())
366 }
367 }
368
369 impl fidl::encoding::ValueTypeMarker for DeviceManagerShredResponse {
370 type Borrowed<'a> = &'a Self;
371 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
372 value
373 }
374 }
375
376 unsafe impl fidl::encoding::TypeMarker for DeviceManagerShredResponse {
377 type Owned = Self;
378
379 #[inline(always)]
380 fn inline_align(_context: fidl::encoding::Context) -> usize {
381 4
382 }
383
384 #[inline(always)]
385 fn inline_size(_context: fidl::encoding::Context) -> usize {
386 4
387 }
388 #[inline(always)]
389 fn encode_is_copy() -> bool {
390 true
391 }
392
393 #[inline(always)]
394 fn decode_is_copy() -> bool {
395 true
396 }
397 }
398
399 unsafe impl<D: fidl::encoding::ResourceDialect>
400 fidl::encoding::Encode<DeviceManagerShredResponse, D> for &DeviceManagerShredResponse
401 {
402 #[inline]
403 unsafe fn encode(
404 self,
405 encoder: &mut fidl::encoding::Encoder<'_, D>,
406 offset: usize,
407 _depth: fidl::encoding::Depth,
408 ) -> fidl::Result<()> {
409 encoder.debug_check_bounds::<DeviceManagerShredResponse>(offset);
410 unsafe {
411 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
413 (buf_ptr as *mut DeviceManagerShredResponse)
414 .write_unaligned((self as *const DeviceManagerShredResponse).read());
415 }
418 Ok(())
419 }
420 }
421 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
422 fidl::encoding::Encode<DeviceManagerShredResponse, D> for (T0,)
423 {
424 #[inline]
425 unsafe fn encode(
426 self,
427 encoder: &mut fidl::encoding::Encoder<'_, D>,
428 offset: usize,
429 depth: fidl::encoding::Depth,
430 ) -> fidl::Result<()> {
431 encoder.debug_check_bounds::<DeviceManagerShredResponse>(offset);
432 self.0.encode(encoder, offset + 0, depth)?;
436 Ok(())
437 }
438 }
439
440 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
441 for DeviceManagerShredResponse
442 {
443 #[inline(always)]
444 fn new_empty() -> Self {
445 Self { status: fidl::new_empty!(i32, D) }
446 }
447
448 #[inline]
449 unsafe fn decode(
450 &mut self,
451 decoder: &mut fidl::encoding::Decoder<'_, D>,
452 offset: usize,
453 _depth: fidl::encoding::Depth,
454 ) -> fidl::Result<()> {
455 decoder.debug_check_bounds::<Self>(offset);
456 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
457 unsafe {
460 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
461 }
462 Ok(())
463 }
464 }
465
466 impl fidl::encoding::ValueTypeMarker for DeviceManagerUnsealRequest {
467 type Borrowed<'a> = &'a Self;
468 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
469 value
470 }
471 }
472
473 unsafe impl fidl::encoding::TypeMarker for DeviceManagerUnsealRequest {
474 type Owned = Self;
475
476 #[inline(always)]
477 fn inline_align(_context: fidl::encoding::Context) -> usize {
478 8
479 }
480
481 #[inline(always)]
482 fn inline_size(_context: fidl::encoding::Context) -> usize {
483 24
484 }
485 }
486
487 unsafe impl<D: fidl::encoding::ResourceDialect>
488 fidl::encoding::Encode<DeviceManagerUnsealRequest, D> for &DeviceManagerUnsealRequest
489 {
490 #[inline]
491 unsafe fn encode(
492 self,
493 encoder: &mut fidl::encoding::Encoder<'_, D>,
494 offset: usize,
495 _depth: fidl::encoding::Depth,
496 ) -> fidl::Result<()> {
497 encoder.debug_check_bounds::<DeviceManagerUnsealRequest>(offset);
498 fidl::encoding::Encode::<DeviceManagerUnsealRequest, D>::encode(
500 (
501 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(
502 &self.key,
503 ),
504 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.slot),
505 ),
506 encoder,
507 offset,
508 _depth,
509 )
510 }
511 }
512 unsafe impl<
513 D: fidl::encoding::ResourceDialect,
514 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
515 T1: fidl::encoding::Encode<u8, D>,
516 > fidl::encoding::Encode<DeviceManagerUnsealRequest, D> for (T0, T1)
517 {
518 #[inline]
519 unsafe fn encode(
520 self,
521 encoder: &mut fidl::encoding::Encoder<'_, D>,
522 offset: usize,
523 depth: fidl::encoding::Depth,
524 ) -> fidl::Result<()> {
525 encoder.debug_check_bounds::<DeviceManagerUnsealRequest>(offset);
526 unsafe {
529 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
530 (ptr as *mut u64).write_unaligned(0);
531 }
532 self.0.encode(encoder, offset + 0, depth)?;
534 self.1.encode(encoder, offset + 16, depth)?;
535 Ok(())
536 }
537 }
538
539 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
540 for DeviceManagerUnsealRequest
541 {
542 #[inline(always)]
543 fn new_empty() -> Self {
544 Self {
545 key: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D),
546 slot: fidl::new_empty!(u8, D),
547 }
548 }
549
550 #[inline]
551 unsafe fn decode(
552 &mut self,
553 decoder: &mut fidl::encoding::Decoder<'_, D>,
554 offset: usize,
555 _depth: fidl::encoding::Depth,
556 ) -> fidl::Result<()> {
557 decoder.debug_check_bounds::<Self>(offset);
558 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
560 let padval = unsafe { (ptr as *const u64).read_unaligned() };
561 let mask = 0xffffffffffffff00u64;
562 let maskedval = padval & mask;
563 if maskedval != 0 {
564 return Err(fidl::Error::NonZeroPadding {
565 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
566 });
567 }
568 fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.key, decoder, offset + 0, _depth)?;
569 fidl::decode!(u8, D, &mut self.slot, decoder, offset + 16, _depth)?;
570 Ok(())
571 }
572 }
573
574 impl fidl::encoding::ValueTypeMarker for DeviceManagerUnsealResponse {
575 type Borrowed<'a> = &'a Self;
576 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
577 value
578 }
579 }
580
581 unsafe impl fidl::encoding::TypeMarker for DeviceManagerUnsealResponse {
582 type Owned = Self;
583
584 #[inline(always)]
585 fn inline_align(_context: fidl::encoding::Context) -> usize {
586 4
587 }
588
589 #[inline(always)]
590 fn inline_size(_context: fidl::encoding::Context) -> usize {
591 4
592 }
593 #[inline(always)]
594 fn encode_is_copy() -> bool {
595 true
596 }
597
598 #[inline(always)]
599 fn decode_is_copy() -> bool {
600 true
601 }
602 }
603
604 unsafe impl<D: fidl::encoding::ResourceDialect>
605 fidl::encoding::Encode<DeviceManagerUnsealResponse, D> for &DeviceManagerUnsealResponse
606 {
607 #[inline]
608 unsafe fn encode(
609 self,
610 encoder: &mut fidl::encoding::Encoder<'_, D>,
611 offset: usize,
612 _depth: fidl::encoding::Depth,
613 ) -> fidl::Result<()> {
614 encoder.debug_check_bounds::<DeviceManagerUnsealResponse>(offset);
615 unsafe {
616 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
618 (buf_ptr as *mut DeviceManagerUnsealResponse)
619 .write_unaligned((self as *const DeviceManagerUnsealResponse).read());
620 }
623 Ok(())
624 }
625 }
626 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
627 fidl::encoding::Encode<DeviceManagerUnsealResponse, D> for (T0,)
628 {
629 #[inline]
630 unsafe fn encode(
631 self,
632 encoder: &mut fidl::encoding::Encoder<'_, D>,
633 offset: usize,
634 depth: fidl::encoding::Depth,
635 ) -> fidl::Result<()> {
636 encoder.debug_check_bounds::<DeviceManagerUnsealResponse>(offset);
637 self.0.encode(encoder, offset + 0, depth)?;
641 Ok(())
642 }
643 }
644
645 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
646 for DeviceManagerUnsealResponse
647 {
648 #[inline(always)]
649 fn new_empty() -> Self {
650 Self { status: fidl::new_empty!(i32, D) }
651 }
652
653 #[inline]
654 unsafe fn decode(
655 &mut self,
656 decoder: &mut fidl::encoding::Decoder<'_, D>,
657 offset: usize,
658 _depth: fidl::encoding::Depth,
659 ) -> fidl::Result<()> {
660 decoder.debug_check_bounds::<Self>(offset);
661 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
662 unsafe {
665 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
666 }
667 Ok(())
668 }
669 }
670}