fidl_fuchsia_fs_startup_common/
fidl_fuchsia_fs_startup_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/// Compression algorithm specifier.
12#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13pub enum CompressionAlgorithm {
14    ZstdChunked,
15    Uncompressed,
16    #[doc(hidden)]
17    __SourceBreaking {
18        unknown_ordinal: u32,
19    },
20}
21
22/// Pattern that matches an unknown `CompressionAlgorithm` member.
23#[macro_export]
24macro_rules! CompressionAlgorithmUnknown {
25    () => {
26        _
27    };
28}
29
30impl CompressionAlgorithm {
31    #[inline]
32    pub fn from_primitive(prim: u32) -> Option<Self> {
33        match prim {
34            0 => Some(Self::ZstdChunked),
35            1 => Some(Self::Uncompressed),
36            _ => None,
37        }
38    }
39
40    #[inline]
41    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
42        match prim {
43            0 => Self::ZstdChunked,
44            1 => Self::Uncompressed,
45            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
46        }
47    }
48
49    #[inline]
50    pub fn unknown() -> Self {
51        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
52    }
53
54    #[inline]
55    pub const fn into_primitive(self) -> u32 {
56        match self {
57            Self::ZstdChunked => 0,
58            Self::Uncompressed => 1,
59            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
60        }
61    }
62
63    #[inline]
64    pub fn is_unknown(&self) -> bool {
65        match self {
66            Self::__SourceBreaking { unknown_ordinal: _ } => true,
67            _ => false,
68        }
69    }
70}
71
72/// An optional eviction policy override for pager-backed blobs for blobfs.
73#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
74pub enum EvictionPolicyOverride {
75    /// Don't override the default cache policy.
76    None,
77    /// Override the default cache policy for pager-backed blobs with kNeverEvict.
78    NeverEvict,
79    /// Override the default cache policy for pager-backed blobs with kEvictImmediately.
80    EvictImmediately,
81    #[doc(hidden)]
82    __SourceBreaking { unknown_ordinal: u32 },
83}
84
85/// Pattern that matches an unknown `EvictionPolicyOverride` member.
86#[macro_export]
87macro_rules! EvictionPolicyOverrideUnknown {
88    () => {
89        _
90    };
91}
92
93impl EvictionPolicyOverride {
94    #[inline]
95    pub fn from_primitive(prim: u32) -> Option<Self> {
96        match prim {
97            0 => Some(Self::None),
98            1 => Some(Self::NeverEvict),
99            2 => Some(Self::EvictImmediately),
100            _ => None,
101        }
102    }
103
104    #[inline]
105    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
106        match prim {
107            0 => Self::None,
108            1 => Self::NeverEvict,
109            2 => Self::EvictImmediately,
110            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
111        }
112    }
113
114    #[inline]
115    pub fn unknown() -> Self {
116        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
117    }
118
119    #[inline]
120    pub const fn into_primitive(self) -> u32 {
121        match self {
122            Self::None => 0,
123            Self::NeverEvict => 1,
124            Self::EvictImmediately => 2,
125            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
126        }
127    }
128
129    #[inline]
130    pub fn is_unknown(&self) -> bool {
131        match self {
132            Self::__SourceBreaking { unknown_ordinal: _ } => true,
133            _ => false,
134        }
135    }
136}
137
138#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
139#[repr(C)]
140pub struct VolumeSetLimitRequest {
141    pub bytes: u64,
142}
143
144impl fidl::Persistable for VolumeSetLimitRequest {}
145
146#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
147#[repr(C)]
148pub struct VolumeGetLimitResponse {
149    pub bytes: u64,
150}
151
152impl fidl::Persistable for VolumeGetLimitResponse {}
153
154#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
155pub struct VolumesRemoveRequest {
156    pub name: String,
157}
158
159impl fidl::Persistable for VolumesRemoveRequest {}
160
161/// Options for how to format filesystems.
162#[derive(Clone, Debug, Default, PartialEq)]
163pub struct FormatOptions {
164    /// Enable verbose logging.
165    pub verbose: Option<bool>,
166    /// If true, use the deprecated padded merkle tree blobfs format.
167    pub deprecated_padded_blobfs_format: Option<bool>,
168    /// The initial number of inodes to allocate space for. If zero, a default is used. Only
169    /// supported for blobfs.
170    pub num_inodes: Option<u64>,
171    /// The number of fvm slices to preallocate for data when the filesystem is created.
172    pub fvm_data_slices: Option<u32>,
173    /// The number of sectors-per-cluster (for FAT filesystems).
174    pub sectors_per_cluster: Option<u16>,
175    #[doc(hidden)]
176    pub __source_breaking: fidl::marker::SourceBreaking,
177}
178
179impl fidl::Persistable for FormatOptions {}
180
181mod internal {
182    use super::*;
183    unsafe impl fidl::encoding::TypeMarker for CompressionAlgorithm {
184        type Owned = Self;
185
186        #[inline(always)]
187        fn inline_align(_context: fidl::encoding::Context) -> usize {
188            std::mem::align_of::<u32>()
189        }
190
191        #[inline(always)]
192        fn inline_size(_context: fidl::encoding::Context) -> usize {
193            std::mem::size_of::<u32>()
194        }
195
196        #[inline(always)]
197        fn encode_is_copy() -> bool {
198            false
199        }
200
201        #[inline(always)]
202        fn decode_is_copy() -> bool {
203            false
204        }
205    }
206
207    impl fidl::encoding::ValueTypeMarker for CompressionAlgorithm {
208        type Borrowed<'a> = Self;
209        #[inline(always)]
210        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
211            *value
212        }
213    }
214
215    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
216        for CompressionAlgorithm
217    {
218        #[inline]
219        unsafe fn encode(
220            self,
221            encoder: &mut fidl::encoding::Encoder<'_, D>,
222            offset: usize,
223            _depth: fidl::encoding::Depth,
224        ) -> fidl::Result<()> {
225            encoder.debug_check_bounds::<Self>(offset);
226            encoder.write_num(self.into_primitive(), offset);
227            Ok(())
228        }
229    }
230
231    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompressionAlgorithm {
232        #[inline(always)]
233        fn new_empty() -> Self {
234            Self::unknown()
235        }
236
237        #[inline]
238        unsafe fn decode(
239            &mut self,
240            decoder: &mut fidl::encoding::Decoder<'_, D>,
241            offset: usize,
242            _depth: fidl::encoding::Depth,
243        ) -> fidl::Result<()> {
244            decoder.debug_check_bounds::<Self>(offset);
245            let prim = decoder.read_num::<u32>(offset);
246
247            *self = Self::from_primitive_allow_unknown(prim);
248            Ok(())
249        }
250    }
251    unsafe impl fidl::encoding::TypeMarker for EvictionPolicyOverride {
252        type Owned = Self;
253
254        #[inline(always)]
255        fn inline_align(_context: fidl::encoding::Context) -> usize {
256            std::mem::align_of::<u32>()
257        }
258
259        #[inline(always)]
260        fn inline_size(_context: fidl::encoding::Context) -> usize {
261            std::mem::size_of::<u32>()
262        }
263
264        #[inline(always)]
265        fn encode_is_copy() -> bool {
266            false
267        }
268
269        #[inline(always)]
270        fn decode_is_copy() -> bool {
271            false
272        }
273    }
274
275    impl fidl::encoding::ValueTypeMarker for EvictionPolicyOverride {
276        type Borrowed<'a> = Self;
277        #[inline(always)]
278        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
279            *value
280        }
281    }
282
283    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
284        for EvictionPolicyOverride
285    {
286        #[inline]
287        unsafe fn encode(
288            self,
289            encoder: &mut fidl::encoding::Encoder<'_, D>,
290            offset: usize,
291            _depth: fidl::encoding::Depth,
292        ) -> fidl::Result<()> {
293            encoder.debug_check_bounds::<Self>(offset);
294            encoder.write_num(self.into_primitive(), offset);
295            Ok(())
296        }
297    }
298
299    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
300        for EvictionPolicyOverride
301    {
302        #[inline(always)]
303        fn new_empty() -> Self {
304            Self::unknown()
305        }
306
307        #[inline]
308        unsafe fn decode(
309            &mut self,
310            decoder: &mut fidl::encoding::Decoder<'_, D>,
311            offset: usize,
312            _depth: fidl::encoding::Depth,
313        ) -> fidl::Result<()> {
314            decoder.debug_check_bounds::<Self>(offset);
315            let prim = decoder.read_num::<u32>(offset);
316
317            *self = Self::from_primitive_allow_unknown(prim);
318            Ok(())
319        }
320    }
321
322    impl fidl::encoding::ValueTypeMarker for VolumeSetLimitRequest {
323        type Borrowed<'a> = &'a Self;
324        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
325            value
326        }
327    }
328
329    unsafe impl fidl::encoding::TypeMarker for VolumeSetLimitRequest {
330        type Owned = Self;
331
332        #[inline(always)]
333        fn inline_align(_context: fidl::encoding::Context) -> usize {
334            8
335        }
336
337        #[inline(always)]
338        fn inline_size(_context: fidl::encoding::Context) -> usize {
339            8
340        }
341        #[inline(always)]
342        fn encode_is_copy() -> bool {
343            true
344        }
345
346        #[inline(always)]
347        fn decode_is_copy() -> bool {
348            true
349        }
350    }
351
352    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VolumeSetLimitRequest, D>
353        for &VolumeSetLimitRequest
354    {
355        #[inline]
356        unsafe fn encode(
357            self,
358            encoder: &mut fidl::encoding::Encoder<'_, D>,
359            offset: usize,
360            _depth: fidl::encoding::Depth,
361        ) -> fidl::Result<()> {
362            encoder.debug_check_bounds::<VolumeSetLimitRequest>(offset);
363            unsafe {
364                // Copy the object into the buffer.
365                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
366                (buf_ptr as *mut VolumeSetLimitRequest)
367                    .write_unaligned((self as *const VolumeSetLimitRequest).read());
368                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
369                // done second because the memcpy will write garbage to these bytes.
370            }
371            Ok(())
372        }
373    }
374    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
375        fidl::encoding::Encode<VolumeSetLimitRequest, D> for (T0,)
376    {
377        #[inline]
378        unsafe fn encode(
379            self,
380            encoder: &mut fidl::encoding::Encoder<'_, D>,
381            offset: usize,
382            depth: fidl::encoding::Depth,
383        ) -> fidl::Result<()> {
384            encoder.debug_check_bounds::<VolumeSetLimitRequest>(offset);
385            // Zero out padding regions. There's no need to apply masks
386            // because the unmasked parts will be overwritten by fields.
387            // Write the fields.
388            self.0.encode(encoder, offset + 0, depth)?;
389            Ok(())
390        }
391    }
392
393    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VolumeSetLimitRequest {
394        #[inline(always)]
395        fn new_empty() -> Self {
396            Self { bytes: fidl::new_empty!(u64, D) }
397        }
398
399        #[inline]
400        unsafe fn decode(
401            &mut self,
402            decoder: &mut fidl::encoding::Decoder<'_, D>,
403            offset: usize,
404            _depth: fidl::encoding::Depth,
405        ) -> fidl::Result<()> {
406            decoder.debug_check_bounds::<Self>(offset);
407            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
408            // Verify that padding bytes are zero.
409            // Copy from the buffer into the object.
410            unsafe {
411                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
412            }
413            Ok(())
414        }
415    }
416
417    impl fidl::encoding::ValueTypeMarker for VolumeGetLimitResponse {
418        type Borrowed<'a> = &'a Self;
419        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
420            value
421        }
422    }
423
424    unsafe impl fidl::encoding::TypeMarker for VolumeGetLimitResponse {
425        type Owned = Self;
426
427        #[inline(always)]
428        fn inline_align(_context: fidl::encoding::Context) -> usize {
429            8
430        }
431
432        #[inline(always)]
433        fn inline_size(_context: fidl::encoding::Context) -> usize {
434            8
435        }
436        #[inline(always)]
437        fn encode_is_copy() -> bool {
438            true
439        }
440
441        #[inline(always)]
442        fn decode_is_copy() -> bool {
443            true
444        }
445    }
446
447    unsafe impl<D: fidl::encoding::ResourceDialect>
448        fidl::encoding::Encode<VolumeGetLimitResponse, D> for &VolumeGetLimitResponse
449    {
450        #[inline]
451        unsafe fn encode(
452            self,
453            encoder: &mut fidl::encoding::Encoder<'_, D>,
454            offset: usize,
455            _depth: fidl::encoding::Depth,
456        ) -> fidl::Result<()> {
457            encoder.debug_check_bounds::<VolumeGetLimitResponse>(offset);
458            unsafe {
459                // Copy the object into the buffer.
460                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
461                (buf_ptr as *mut VolumeGetLimitResponse)
462                    .write_unaligned((self as *const VolumeGetLimitResponse).read());
463                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
464                // done second because the memcpy will write garbage to these bytes.
465            }
466            Ok(())
467        }
468    }
469    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
470        fidl::encoding::Encode<VolumeGetLimitResponse, D> for (T0,)
471    {
472        #[inline]
473        unsafe fn encode(
474            self,
475            encoder: &mut fidl::encoding::Encoder<'_, D>,
476            offset: usize,
477            depth: fidl::encoding::Depth,
478        ) -> fidl::Result<()> {
479            encoder.debug_check_bounds::<VolumeGetLimitResponse>(offset);
480            // Zero out padding regions. There's no need to apply masks
481            // because the unmasked parts will be overwritten by fields.
482            // Write the fields.
483            self.0.encode(encoder, offset + 0, depth)?;
484            Ok(())
485        }
486    }
487
488    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
489        for VolumeGetLimitResponse
490    {
491        #[inline(always)]
492        fn new_empty() -> Self {
493            Self { bytes: fidl::new_empty!(u64, D) }
494        }
495
496        #[inline]
497        unsafe fn decode(
498            &mut self,
499            decoder: &mut fidl::encoding::Decoder<'_, D>,
500            offset: usize,
501            _depth: fidl::encoding::Depth,
502        ) -> fidl::Result<()> {
503            decoder.debug_check_bounds::<Self>(offset);
504            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
505            // Verify that padding bytes are zero.
506            // Copy from the buffer into the object.
507            unsafe {
508                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
509            }
510            Ok(())
511        }
512    }
513
514    impl fidl::encoding::ValueTypeMarker for VolumesRemoveRequest {
515        type Borrowed<'a> = &'a Self;
516        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
517            value
518        }
519    }
520
521    unsafe impl fidl::encoding::TypeMarker for VolumesRemoveRequest {
522        type Owned = Self;
523
524        #[inline(always)]
525        fn inline_align(_context: fidl::encoding::Context) -> usize {
526            8
527        }
528
529        #[inline(always)]
530        fn inline_size(_context: fidl::encoding::Context) -> usize {
531            16
532        }
533    }
534
535    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VolumesRemoveRequest, D>
536        for &VolumesRemoveRequest
537    {
538        #[inline]
539        unsafe fn encode(
540            self,
541            encoder: &mut fidl::encoding::Encoder<'_, D>,
542            offset: usize,
543            _depth: fidl::encoding::Depth,
544        ) -> fidl::Result<()> {
545            encoder.debug_check_bounds::<VolumesRemoveRequest>(offset);
546            // Delegate to tuple encoding.
547            fidl::encoding::Encode::<VolumesRemoveRequest, D>::encode(
548                (<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
549                    &self.name,
550                ),),
551                encoder,
552                offset,
553                _depth,
554            )
555        }
556    }
557    unsafe impl<
558            D: fidl::encoding::ResourceDialect,
559            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
560        > fidl::encoding::Encode<VolumesRemoveRequest, D> for (T0,)
561    {
562        #[inline]
563        unsafe fn encode(
564            self,
565            encoder: &mut fidl::encoding::Encoder<'_, D>,
566            offset: usize,
567            depth: fidl::encoding::Depth,
568        ) -> fidl::Result<()> {
569            encoder.debug_check_bounds::<VolumesRemoveRequest>(offset);
570            // Zero out padding regions. There's no need to apply masks
571            // because the unmasked parts will be overwritten by fields.
572            // Write the fields.
573            self.0.encode(encoder, offset + 0, depth)?;
574            Ok(())
575        }
576    }
577
578    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VolumesRemoveRequest {
579        #[inline(always)]
580        fn new_empty() -> Self {
581            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D) }
582        }
583
584        #[inline]
585        unsafe fn decode(
586            &mut self,
587            decoder: &mut fidl::encoding::Decoder<'_, D>,
588            offset: usize,
589            _depth: fidl::encoding::Depth,
590        ) -> fidl::Result<()> {
591            decoder.debug_check_bounds::<Self>(offset);
592            // Verify that padding bytes are zero.
593            fidl::decode!(
594                fidl::encoding::BoundedString<255>,
595                D,
596                &mut self.name,
597                decoder,
598                offset + 0,
599                _depth
600            )?;
601            Ok(())
602        }
603    }
604
605    impl FormatOptions {
606        #[inline(always)]
607        fn max_ordinal_present(&self) -> u64 {
608            if let Some(_) = self.sectors_per_cluster {
609                return 5;
610            }
611            if let Some(_) = self.fvm_data_slices {
612                return 4;
613            }
614            if let Some(_) = self.num_inodes {
615                return 3;
616            }
617            if let Some(_) = self.deprecated_padded_blobfs_format {
618                return 2;
619            }
620            if let Some(_) = self.verbose {
621                return 1;
622            }
623            0
624        }
625    }
626
627    impl fidl::encoding::ValueTypeMarker for FormatOptions {
628        type Borrowed<'a> = &'a Self;
629        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
630            value
631        }
632    }
633
634    unsafe impl fidl::encoding::TypeMarker for FormatOptions {
635        type Owned = Self;
636
637        #[inline(always)]
638        fn inline_align(_context: fidl::encoding::Context) -> usize {
639            8
640        }
641
642        #[inline(always)]
643        fn inline_size(_context: fidl::encoding::Context) -> usize {
644            16
645        }
646    }
647
648    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FormatOptions, D>
649        for &FormatOptions
650    {
651        unsafe fn encode(
652            self,
653            encoder: &mut fidl::encoding::Encoder<'_, D>,
654            offset: usize,
655            mut depth: fidl::encoding::Depth,
656        ) -> fidl::Result<()> {
657            encoder.debug_check_bounds::<FormatOptions>(offset);
658            // Vector header
659            let max_ordinal: u64 = self.max_ordinal_present();
660            encoder.write_num(max_ordinal, offset);
661            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
662            // Calling encoder.out_of_line_offset(0) is not allowed.
663            if max_ordinal == 0 {
664                return Ok(());
665            }
666            depth.increment()?;
667            let envelope_size = 8;
668            let bytes_len = max_ordinal as usize * envelope_size;
669            #[allow(unused_variables)]
670            let offset = encoder.out_of_line_offset(bytes_len);
671            let mut _prev_end_offset: usize = 0;
672            if 1 > max_ordinal {
673                return Ok(());
674            }
675
676            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
677            // are envelope_size bytes.
678            let cur_offset: usize = (1 - 1) * envelope_size;
679
680            // Zero reserved fields.
681            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
682
683            // Safety:
684            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
685            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
686            //   envelope_size bytes, there is always sufficient room.
687            fidl::encoding::encode_in_envelope_optional::<bool, D>(
688                self.verbose.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
689                encoder,
690                offset + cur_offset,
691                depth,
692            )?;
693
694            _prev_end_offset = cur_offset + envelope_size;
695            if 2 > max_ordinal {
696                return Ok(());
697            }
698
699            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
700            // are envelope_size bytes.
701            let cur_offset: usize = (2 - 1) * envelope_size;
702
703            // Zero reserved fields.
704            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
705
706            // Safety:
707            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
708            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
709            //   envelope_size bytes, there is always sufficient room.
710            fidl::encoding::encode_in_envelope_optional::<bool, D>(
711                self.deprecated_padded_blobfs_format
712                    .as_ref()
713                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
714                encoder,
715                offset + cur_offset,
716                depth,
717            )?;
718
719            _prev_end_offset = cur_offset + envelope_size;
720            if 3 > max_ordinal {
721                return Ok(());
722            }
723
724            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
725            // are envelope_size bytes.
726            let cur_offset: usize = (3 - 1) * envelope_size;
727
728            // Zero reserved fields.
729            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
730
731            // Safety:
732            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
733            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
734            //   envelope_size bytes, there is always sufficient room.
735            fidl::encoding::encode_in_envelope_optional::<u64, D>(
736                self.num_inodes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
737                encoder,
738                offset + cur_offset,
739                depth,
740            )?;
741
742            _prev_end_offset = cur_offset + envelope_size;
743            if 4 > max_ordinal {
744                return Ok(());
745            }
746
747            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
748            // are envelope_size bytes.
749            let cur_offset: usize = (4 - 1) * envelope_size;
750
751            // Zero reserved fields.
752            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
753
754            // Safety:
755            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
756            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
757            //   envelope_size bytes, there is always sufficient room.
758            fidl::encoding::encode_in_envelope_optional::<u32, D>(
759                self.fvm_data_slices.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
760                encoder,
761                offset + cur_offset,
762                depth,
763            )?;
764
765            _prev_end_offset = cur_offset + envelope_size;
766            if 5 > max_ordinal {
767                return Ok(());
768            }
769
770            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
771            // are envelope_size bytes.
772            let cur_offset: usize = (5 - 1) * envelope_size;
773
774            // Zero reserved fields.
775            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
776
777            // Safety:
778            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
779            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
780            //   envelope_size bytes, there is always sufficient room.
781            fidl::encoding::encode_in_envelope_optional::<u16, D>(
782                self.sectors_per_cluster
783                    .as_ref()
784                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
785                encoder,
786                offset + cur_offset,
787                depth,
788            )?;
789
790            _prev_end_offset = cur_offset + envelope_size;
791
792            Ok(())
793        }
794    }
795
796    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FormatOptions {
797        #[inline(always)]
798        fn new_empty() -> Self {
799            Self::default()
800        }
801
802        unsafe fn decode(
803            &mut self,
804            decoder: &mut fidl::encoding::Decoder<'_, D>,
805            offset: usize,
806            mut depth: fidl::encoding::Depth,
807        ) -> fidl::Result<()> {
808            decoder.debug_check_bounds::<Self>(offset);
809            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
810                None => return Err(fidl::Error::NotNullable),
811                Some(len) => len,
812            };
813            // Calling decoder.out_of_line_offset(0) is not allowed.
814            if len == 0 {
815                return Ok(());
816            };
817            depth.increment()?;
818            let envelope_size = 8;
819            let bytes_len = len * envelope_size;
820            let offset = decoder.out_of_line_offset(bytes_len)?;
821            // Decode the envelope for each type.
822            let mut _next_ordinal_to_read = 0;
823            let mut next_offset = offset;
824            let end_offset = offset + bytes_len;
825            _next_ordinal_to_read += 1;
826            if next_offset >= end_offset {
827                return Ok(());
828            }
829
830            // Decode unknown envelopes for gaps in ordinals.
831            while _next_ordinal_to_read < 1 {
832                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
833                _next_ordinal_to_read += 1;
834                next_offset += envelope_size;
835            }
836
837            let next_out_of_line = decoder.next_out_of_line();
838            let handles_before = decoder.remaining_handles();
839            if let Some((inlined, num_bytes, num_handles)) =
840                fidl::encoding::decode_envelope_header(decoder, next_offset)?
841            {
842                let member_inline_size =
843                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
844                if inlined != (member_inline_size <= 4) {
845                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
846                }
847                let inner_offset;
848                let mut inner_depth = depth.clone();
849                if inlined {
850                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
851                    inner_offset = next_offset;
852                } else {
853                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
854                    inner_depth.increment()?;
855                }
856                let val_ref = self.verbose.get_or_insert_with(|| fidl::new_empty!(bool, D));
857                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
858                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
859                {
860                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
861                }
862                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
863                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
864                }
865            }
866
867            next_offset += envelope_size;
868            _next_ordinal_to_read += 1;
869            if next_offset >= end_offset {
870                return Ok(());
871            }
872
873            // Decode unknown envelopes for gaps in ordinals.
874            while _next_ordinal_to_read < 2 {
875                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
876                _next_ordinal_to_read += 1;
877                next_offset += envelope_size;
878            }
879
880            let next_out_of_line = decoder.next_out_of_line();
881            let handles_before = decoder.remaining_handles();
882            if let Some((inlined, num_bytes, num_handles)) =
883                fidl::encoding::decode_envelope_header(decoder, next_offset)?
884            {
885                let member_inline_size =
886                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
887                if inlined != (member_inline_size <= 4) {
888                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
889                }
890                let inner_offset;
891                let mut inner_depth = depth.clone();
892                if inlined {
893                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
894                    inner_offset = next_offset;
895                } else {
896                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
897                    inner_depth.increment()?;
898                }
899                let val_ref = self
900                    .deprecated_padded_blobfs_format
901                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
902                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
903                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
904                {
905                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
906                }
907                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
908                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
909                }
910            }
911
912            next_offset += envelope_size;
913            _next_ordinal_to_read += 1;
914            if next_offset >= end_offset {
915                return Ok(());
916            }
917
918            // Decode unknown envelopes for gaps in ordinals.
919            while _next_ordinal_to_read < 3 {
920                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
921                _next_ordinal_to_read += 1;
922                next_offset += envelope_size;
923            }
924
925            let next_out_of_line = decoder.next_out_of_line();
926            let handles_before = decoder.remaining_handles();
927            if let Some((inlined, num_bytes, num_handles)) =
928                fidl::encoding::decode_envelope_header(decoder, next_offset)?
929            {
930                let member_inline_size =
931                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
932                if inlined != (member_inline_size <= 4) {
933                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
934                }
935                let inner_offset;
936                let mut inner_depth = depth.clone();
937                if inlined {
938                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
939                    inner_offset = next_offset;
940                } else {
941                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
942                    inner_depth.increment()?;
943                }
944                let val_ref = self.num_inodes.get_or_insert_with(|| fidl::new_empty!(u64, D));
945                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
946                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
947                {
948                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
949                }
950                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
951                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
952                }
953            }
954
955            next_offset += envelope_size;
956            _next_ordinal_to_read += 1;
957            if next_offset >= end_offset {
958                return Ok(());
959            }
960
961            // Decode unknown envelopes for gaps in ordinals.
962            while _next_ordinal_to_read < 4 {
963                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
964                _next_ordinal_to_read += 1;
965                next_offset += envelope_size;
966            }
967
968            let next_out_of_line = decoder.next_out_of_line();
969            let handles_before = decoder.remaining_handles();
970            if let Some((inlined, num_bytes, num_handles)) =
971                fidl::encoding::decode_envelope_header(decoder, next_offset)?
972            {
973                let member_inline_size =
974                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
975                if inlined != (member_inline_size <= 4) {
976                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
977                }
978                let inner_offset;
979                let mut inner_depth = depth.clone();
980                if inlined {
981                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
982                    inner_offset = next_offset;
983                } else {
984                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
985                    inner_depth.increment()?;
986                }
987                let val_ref = self.fvm_data_slices.get_or_insert_with(|| fidl::new_empty!(u32, D));
988                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
989                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
990                {
991                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
992                }
993                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
994                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
995                }
996            }
997
998            next_offset += envelope_size;
999            _next_ordinal_to_read += 1;
1000            if next_offset >= end_offset {
1001                return Ok(());
1002            }
1003
1004            // Decode unknown envelopes for gaps in ordinals.
1005            while _next_ordinal_to_read < 5 {
1006                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1007                _next_ordinal_to_read += 1;
1008                next_offset += envelope_size;
1009            }
1010
1011            let next_out_of_line = decoder.next_out_of_line();
1012            let handles_before = decoder.remaining_handles();
1013            if let Some((inlined, num_bytes, num_handles)) =
1014                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1015            {
1016                let member_inline_size =
1017                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1018                if inlined != (member_inline_size <= 4) {
1019                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1020                }
1021                let inner_offset;
1022                let mut inner_depth = depth.clone();
1023                if inlined {
1024                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1025                    inner_offset = next_offset;
1026                } else {
1027                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1028                    inner_depth.increment()?;
1029                }
1030                let val_ref =
1031                    self.sectors_per_cluster.get_or_insert_with(|| fidl::new_empty!(u16, D));
1032                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
1033                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1034                {
1035                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1036                }
1037                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1038                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1039                }
1040            }
1041
1042            next_offset += envelope_size;
1043
1044            // Decode the remaining unknown envelopes.
1045            while next_offset < end_offset {
1046                _next_ordinal_to_read += 1;
1047                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1048                next_offset += envelope_size;
1049            }
1050
1051            Ok(())
1052        }
1053    }
1054}