fidl_fuchsia_fshost__common/
fidl_fuchsia_fshost__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12#[repr(u32)]
13pub enum MountMode {
14    MaybeCreate = 1,
15    AlwaysCreate = 2,
16}
17
18impl MountMode {
19    #[inline]
20    pub fn from_primitive(prim: u32) -> Option<Self> {
21        match prim {
22            1 => Some(Self::MaybeCreate),
23            2 => Some(Self::AlwaysCreate),
24            _ => None,
25        }
26    }
27
28    #[inline]
29    pub const fn into_primitive(self) -> u32 {
30        self as u32
31    }
32}
33
34#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct AdminStorageHostEnabledResponse {
36    pub enabled: bool,
37}
38
39impl fidl::Persistable for AdminStorageHostEnabledResponse {}
40
41#[derive(Clone, Debug, PartialEq)]
42pub struct RecoveryInitSystemPartitionTableRequest {
43    pub partitions: Vec<fidl_fuchsia_storage_partitions__common::PartitionInfo>,
44}
45
46impl fidl::Persistable for RecoveryInitSystemPartitionTableRequest {}
47
48#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
49#[repr(C)]
50pub struct StarnixVolumeProviderMountResponse {
51    pub guid: [u8; 16],
52}
53
54impl fidl::Persistable for StarnixVolumeProviderMountResponse {}
55
56#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57pub struct Unformatted;
58
59impl fidl::Persistable for Unformatted {}
60
61pub mod admin_ordinals {
62    pub const SHRED_DATA_VOLUME: u64 = 0xb0d6c2e95343a10;
63    pub const STORAGE_HOST_ENABLED: u64 = 0x5934b6527ec49a35;
64}
65
66pub mod recovery_ordinals {
67    pub const INIT_SYSTEM_PARTITION_TABLE: u64 = 0x3dcadcbb75e2330b;
68    pub const WRITE_DATA_FILE: u64 = 0xd6cf7b3f57b418d;
69    pub const FORMAT_SYSTEM_BLOB_VOLUME: u64 = 0x4e93f6b198f61f7d;
70    pub const MOUNT_SYSTEM_BLOB_VOLUME: u64 = 0x63ddff4240e908c0;
71    pub const GET_BLOB_IMAGE_HANDLE: u64 = 0x5cc0f6646bdb5e57;
72    pub const INSTALL_BLOB_IMAGE: u64 = 0x323375398af8a29;
73}
74
75pub mod starnix_volume_provider_ordinals {
76    pub const MOUNT: u64 = 0x62ae75763dde5af6;
77    pub const CONNECT_TO_INLINE_ENCRYPTION: u64 = 0x4add58a720826ce5;
78}
79
80mod internal {
81    use super::*;
82    unsafe impl fidl::encoding::TypeMarker for MountMode {
83        type Owned = Self;
84
85        #[inline(always)]
86        fn inline_align(_context: fidl::encoding::Context) -> usize {
87            std::mem::align_of::<u32>()
88        }
89
90        #[inline(always)]
91        fn inline_size(_context: fidl::encoding::Context) -> usize {
92            std::mem::size_of::<u32>()
93        }
94
95        #[inline(always)]
96        fn encode_is_copy() -> bool {
97            true
98        }
99
100        #[inline(always)]
101        fn decode_is_copy() -> bool {
102            false
103        }
104    }
105
106    impl fidl::encoding::ValueTypeMarker for MountMode {
107        type Borrowed<'a> = Self;
108        #[inline(always)]
109        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
110            *value
111        }
112    }
113
114    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MountMode {
115        #[inline]
116        unsafe fn encode(
117            self,
118            encoder: &mut fidl::encoding::Encoder<'_, D>,
119            offset: usize,
120            _depth: fidl::encoding::Depth,
121        ) -> fidl::Result<()> {
122            encoder.debug_check_bounds::<Self>(offset);
123            encoder.write_num(self.into_primitive(), offset);
124            Ok(())
125        }
126    }
127
128    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MountMode {
129        #[inline(always)]
130        fn new_empty() -> Self {
131            Self::MaybeCreate
132        }
133
134        #[inline]
135        unsafe fn decode(
136            &mut self,
137            decoder: &mut fidl::encoding::Decoder<'_, D>,
138            offset: usize,
139            _depth: fidl::encoding::Depth,
140        ) -> fidl::Result<()> {
141            decoder.debug_check_bounds::<Self>(offset);
142            let prim = decoder.read_num::<u32>(offset);
143
144            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
145            Ok(())
146        }
147    }
148
149    impl fidl::encoding::ValueTypeMarker for AdminStorageHostEnabledResponse {
150        type Borrowed<'a> = &'a Self;
151        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
152            value
153        }
154    }
155
156    unsafe impl fidl::encoding::TypeMarker for AdminStorageHostEnabledResponse {
157        type Owned = Self;
158
159        #[inline(always)]
160        fn inline_align(_context: fidl::encoding::Context) -> usize {
161            1
162        }
163
164        #[inline(always)]
165        fn inline_size(_context: fidl::encoding::Context) -> usize {
166            1
167        }
168    }
169
170    unsafe impl<D: fidl::encoding::ResourceDialect>
171        fidl::encoding::Encode<AdminStorageHostEnabledResponse, D>
172        for &AdminStorageHostEnabledResponse
173    {
174        #[inline]
175        unsafe fn encode(
176            self,
177            encoder: &mut fidl::encoding::Encoder<'_, D>,
178            offset: usize,
179            _depth: fidl::encoding::Depth,
180        ) -> fidl::Result<()> {
181            encoder.debug_check_bounds::<AdminStorageHostEnabledResponse>(offset);
182            // Delegate to tuple encoding.
183            fidl::encoding::Encode::<AdminStorageHostEnabledResponse, D>::encode(
184                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
185                encoder,
186                offset,
187                _depth,
188            )
189        }
190    }
191    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
192        fidl::encoding::Encode<AdminStorageHostEnabledResponse, D> for (T0,)
193    {
194        #[inline]
195        unsafe fn encode(
196            self,
197            encoder: &mut fidl::encoding::Encoder<'_, D>,
198            offset: usize,
199            depth: fidl::encoding::Depth,
200        ) -> fidl::Result<()> {
201            encoder.debug_check_bounds::<AdminStorageHostEnabledResponse>(offset);
202            // Zero out padding regions. There's no need to apply masks
203            // because the unmasked parts will be overwritten by fields.
204            // Write the fields.
205            self.0.encode(encoder, offset + 0, depth)?;
206            Ok(())
207        }
208    }
209
210    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
211        for AdminStorageHostEnabledResponse
212    {
213        #[inline(always)]
214        fn new_empty() -> Self {
215            Self { enabled: fidl::new_empty!(bool, D) }
216        }
217
218        #[inline]
219        unsafe fn decode(
220            &mut self,
221            decoder: &mut fidl::encoding::Decoder<'_, D>,
222            offset: usize,
223            _depth: fidl::encoding::Depth,
224        ) -> fidl::Result<()> {
225            decoder.debug_check_bounds::<Self>(offset);
226            // Verify that padding bytes are zero.
227            fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
228            Ok(())
229        }
230    }
231
232    impl fidl::encoding::ValueTypeMarker for RecoveryInitSystemPartitionTableRequest {
233        type Borrowed<'a> = &'a Self;
234        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
235            value
236        }
237    }
238
239    unsafe impl fidl::encoding::TypeMarker for RecoveryInitSystemPartitionTableRequest {
240        type Owned = Self;
241
242        #[inline(always)]
243        fn inline_align(_context: fidl::encoding::Context) -> usize {
244            8
245        }
246
247        #[inline(always)]
248        fn inline_size(_context: fidl::encoding::Context) -> usize {
249            16
250        }
251    }
252
253    unsafe impl<D: fidl::encoding::ResourceDialect>
254        fidl::encoding::Encode<RecoveryInitSystemPartitionTableRequest, D>
255        for &RecoveryInitSystemPartitionTableRequest
256    {
257        #[inline]
258        unsafe fn encode(
259            self,
260            encoder: &mut fidl::encoding::Encoder<'_, D>,
261            offset: usize,
262            _depth: fidl::encoding::Depth,
263        ) -> fidl::Result<()> {
264            encoder.debug_check_bounds::<RecoveryInitSystemPartitionTableRequest>(offset);
265            // Delegate to tuple encoding.
266            fidl::encoding::Encode::<RecoveryInitSystemPartitionTableRequest, D>::encode(
267                (<fidl::encoding::Vector<
268                    fidl_fuchsia_storage_partitions__common::PartitionInfo,
269                    128,
270                > as fidl::encoding::ValueTypeMarker>::borrow(&self.partitions),),
271                encoder,
272                offset,
273                _depth,
274            )
275        }
276    }
277    unsafe impl<
278        D: fidl::encoding::ResourceDialect,
279        T0: fidl::encoding::Encode<
280                fidl::encoding::Vector<fidl_fuchsia_storage_partitions__common::PartitionInfo, 128>,
281                D,
282            >,
283    > fidl::encoding::Encode<RecoveryInitSystemPartitionTableRequest, D> for (T0,)
284    {
285        #[inline]
286        unsafe fn encode(
287            self,
288            encoder: &mut fidl::encoding::Encoder<'_, D>,
289            offset: usize,
290            depth: fidl::encoding::Depth,
291        ) -> fidl::Result<()> {
292            encoder.debug_check_bounds::<RecoveryInitSystemPartitionTableRequest>(offset);
293            // Zero out padding regions. There's no need to apply masks
294            // because the unmasked parts will be overwritten by fields.
295            // Write the fields.
296            self.0.encode(encoder, offset + 0, depth)?;
297            Ok(())
298        }
299    }
300
301    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
302        for RecoveryInitSystemPartitionTableRequest
303    {
304        #[inline(always)]
305        fn new_empty() -> Self {
306            Self {
307                partitions: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_storage_partitions__common::PartitionInfo, 128>, D),
308            }
309        }
310
311        #[inline]
312        unsafe fn decode(
313            &mut self,
314            decoder: &mut fidl::encoding::Decoder<'_, D>,
315            offset: usize,
316            _depth: fidl::encoding::Depth,
317        ) -> fidl::Result<()> {
318            decoder.debug_check_bounds::<Self>(offset);
319            // Verify that padding bytes are zero.
320            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_storage_partitions__common::PartitionInfo, 128>, D, &mut self.partitions, decoder, offset + 0, _depth)?;
321            Ok(())
322        }
323    }
324
325    impl fidl::encoding::ValueTypeMarker for StarnixVolumeProviderMountResponse {
326        type Borrowed<'a> = &'a Self;
327        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
328            value
329        }
330    }
331
332    unsafe impl fidl::encoding::TypeMarker for StarnixVolumeProviderMountResponse {
333        type Owned = Self;
334
335        #[inline(always)]
336        fn inline_align(_context: fidl::encoding::Context) -> usize {
337            1
338        }
339
340        #[inline(always)]
341        fn inline_size(_context: fidl::encoding::Context) -> usize {
342            16
343        }
344        #[inline(always)]
345        fn encode_is_copy() -> bool {
346            true
347        }
348
349        #[inline(always)]
350        fn decode_is_copy() -> bool {
351            true
352        }
353    }
354
355    unsafe impl<D: fidl::encoding::ResourceDialect>
356        fidl::encoding::Encode<StarnixVolumeProviderMountResponse, D>
357        for &StarnixVolumeProviderMountResponse
358    {
359        #[inline]
360        unsafe fn encode(
361            self,
362            encoder: &mut fidl::encoding::Encoder<'_, D>,
363            offset: usize,
364            _depth: fidl::encoding::Depth,
365        ) -> fidl::Result<()> {
366            encoder.debug_check_bounds::<StarnixVolumeProviderMountResponse>(offset);
367            unsafe {
368                // Copy the object into the buffer.
369                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
370                (buf_ptr as *mut StarnixVolumeProviderMountResponse)
371                    .write_unaligned((self as *const StarnixVolumeProviderMountResponse).read());
372                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
373                // done second because the memcpy will write garbage to these bytes.
374            }
375            Ok(())
376        }
377    }
378    unsafe impl<
379        D: fidl::encoding::ResourceDialect,
380        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
381    > fidl::encoding::Encode<StarnixVolumeProviderMountResponse, D> for (T0,)
382    {
383        #[inline]
384        unsafe fn encode(
385            self,
386            encoder: &mut fidl::encoding::Encoder<'_, D>,
387            offset: usize,
388            depth: fidl::encoding::Depth,
389        ) -> fidl::Result<()> {
390            encoder.debug_check_bounds::<StarnixVolumeProviderMountResponse>(offset);
391            // Zero out padding regions. There's no need to apply masks
392            // because the unmasked parts will be overwritten by fields.
393            // Write the fields.
394            self.0.encode(encoder, offset + 0, depth)?;
395            Ok(())
396        }
397    }
398
399    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
400        for StarnixVolumeProviderMountResponse
401    {
402        #[inline(always)]
403        fn new_empty() -> Self {
404            Self { guid: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
405        }
406
407        #[inline]
408        unsafe fn decode(
409            &mut self,
410            decoder: &mut fidl::encoding::Decoder<'_, D>,
411            offset: usize,
412            _depth: fidl::encoding::Depth,
413        ) -> fidl::Result<()> {
414            decoder.debug_check_bounds::<Self>(offset);
415            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
416            // Verify that padding bytes are zero.
417            // Copy from the buffer into the object.
418            unsafe {
419                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
420            }
421            Ok(())
422        }
423    }
424
425    impl fidl::encoding::ValueTypeMarker for Unformatted {
426        type Borrowed<'a> = &'a Self;
427        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
428            value
429        }
430    }
431
432    unsafe impl fidl::encoding::TypeMarker for Unformatted {
433        type Owned = Self;
434
435        #[inline(always)]
436        fn inline_align(_context: fidl::encoding::Context) -> usize {
437            1
438        }
439
440        #[inline(always)]
441        fn inline_size(_context: fidl::encoding::Context) -> usize {
442            1
443        }
444    }
445
446    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unformatted, D>
447        for &Unformatted
448    {
449        #[inline]
450        unsafe fn encode(
451            self,
452            encoder: &mut fidl::encoding::Encoder<'_, D>,
453            offset: usize,
454            _depth: fidl::encoding::Depth,
455        ) -> fidl::Result<()> {
456            encoder.debug_check_bounds::<Unformatted>(offset);
457            encoder.write_num(0u8, offset);
458            Ok(())
459        }
460    }
461
462    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unformatted {
463        #[inline(always)]
464        fn new_empty() -> Self {
465            Self
466        }
467
468        #[inline]
469        unsafe fn decode(
470            &mut self,
471            decoder: &mut fidl::encoding::Decoder<'_, D>,
472            offset: usize,
473            _depth: fidl::encoding::Depth,
474        ) -> fidl::Result<()> {
475            decoder.debug_check_bounds::<Self>(offset);
476            match decoder.read_num::<u8>(offset) {
477                0 => Ok(()),
478                _ => Err(fidl::Error::Invalid),
479            }
480        }
481    }
482}