fidl_cf_sc_internal_fshostconfig_common/
fidl_cf_sc_internal_fshostconfig_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(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13    pub blobfs: bool,
14    pub blobfs_cache_eviction_policy: String,
15    pub blobfs_initial_inodes: u64,
16    pub blobfs_max_bytes: u64,
17    pub blobfs_use_deprecated_padded_format: bool,
18    pub blobfs_write_compression_algorithm: String,
19    pub bootpart: bool,
20    pub check_filesystems: bool,
21    pub data: bool,
22    pub data_filesystem_format: String,
23    pub data_max_bytes: u64,
24    pub disable_automount: bool,
25    pub disable_block_watcher: bool,
26    pub factory: bool,
27    pub format_data_on_corruption: bool,
28    pub fvm: bool,
29    pub fvm_slice_size: u64,
30    pub fxfs_blob: bool,
31    pub fxfs_crypt_url: String,
32    pub gpt: bool,
33    pub gpt_all: bool,
34    pub mbr: bool,
35    pub nand: bool,
36    pub netboot: bool,
37    pub no_zxcrypt: bool,
38    pub ramdisk_image: bool,
39    pub starnix_volume_name: String,
40    pub storage_host: bool,
41    pub use_disk_migration: bool,
42}
43
44impl fidl::Persistable for Config {}
45
46mod internal {
47    use super::*;
48
49    impl fidl::encoding::ValueTypeMarker for Config {
50        type Borrowed<'a> = &'a Self;
51        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
52            value
53        }
54    }
55
56    unsafe impl fidl::encoding::TypeMarker for Config {
57        type Owned = Self;
58
59        #[inline(always)]
60        fn inline_align(_context: fidl::encoding::Context) -> usize {
61            8
62        }
63
64        #[inline(always)]
65        fn inline_size(_context: fidl::encoding::Context) -> usize {
66            168
67        }
68    }
69
70    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
71        #[inline]
72        unsafe fn encode(
73            self,
74            encoder: &mut fidl::encoding::Encoder<'_, D>,
75            offset: usize,
76            _depth: fidl::encoding::Depth,
77        ) -> fidl::Result<()> {
78            encoder.debug_check_bounds::<Config>(offset);
79            // Delegate to tuple encoding.
80            fidl::encoding::Encode::<Config, D>::encode(
81                (
82                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.blobfs),
83                    <fidl::encoding::BoundedString<20> as fidl::encoding::ValueTypeMarker>::borrow(
84                        &self.blobfs_cache_eviction_policy,
85                    ),
86                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.blobfs_initial_inodes),
87                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.blobfs_max_bytes),
88                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
89                        &self.blobfs_use_deprecated_padded_format,
90                    ),
91                    <fidl::encoding::BoundedString<20> as fidl::encoding::ValueTypeMarker>::borrow(
92                        &self.blobfs_write_compression_algorithm,
93                    ),
94                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.bootpart),
95                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.check_filesystems),
96                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
97                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
98                        &self.data_filesystem_format,
99                    ),
100                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.data_max_bytes),
101                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.disable_automount),
102                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.disable_block_watcher),
103                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.factory),
104                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
105                        &self.format_data_on_corruption,
106                    ),
107                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.fvm),
108                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.fvm_slice_size),
109                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.fxfs_blob),
110                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
111                        &self.fxfs_crypt_url,
112                    ),
113                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.gpt),
114                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.gpt_all),
115                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mbr),
116                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.nand),
117                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.netboot),
118                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.no_zxcrypt),
119                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.ramdisk_image),
120                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
121                        &self.starnix_volume_name,
122                    ),
123                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.storage_host),
124                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.use_disk_migration),
125                ),
126                encoder,
127                offset,
128                _depth,
129            )
130        }
131    }
132    unsafe impl<
133            D: fidl::encoding::ResourceDialect,
134            T0: fidl::encoding::Encode<bool, D>,
135            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<20>, D>,
136            T2: fidl::encoding::Encode<u64, D>,
137            T3: fidl::encoding::Encode<u64, D>,
138            T4: fidl::encoding::Encode<bool, D>,
139            T5: fidl::encoding::Encode<fidl::encoding::BoundedString<20>, D>,
140            T6: fidl::encoding::Encode<bool, D>,
141            T7: fidl::encoding::Encode<bool, D>,
142            T8: fidl::encoding::Encode<bool, D>,
143            T9: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
144            T10: fidl::encoding::Encode<u64, D>,
145            T11: fidl::encoding::Encode<bool, D>,
146            T12: fidl::encoding::Encode<bool, D>,
147            T13: fidl::encoding::Encode<bool, D>,
148            T14: fidl::encoding::Encode<bool, D>,
149            T15: fidl::encoding::Encode<bool, D>,
150            T16: fidl::encoding::Encode<u64, D>,
151            T17: fidl::encoding::Encode<bool, D>,
152            T18: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
153            T19: fidl::encoding::Encode<bool, D>,
154            T20: fidl::encoding::Encode<bool, D>,
155            T21: fidl::encoding::Encode<bool, D>,
156            T22: fidl::encoding::Encode<bool, D>,
157            T23: fidl::encoding::Encode<bool, D>,
158            T24: fidl::encoding::Encode<bool, D>,
159            T25: fidl::encoding::Encode<bool, D>,
160            T26: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
161            T27: fidl::encoding::Encode<bool, D>,
162            T28: fidl::encoding::Encode<bool, D>,
163        > fidl::encoding::Encode<Config, D>
164        for (
165            T0,
166            T1,
167            T2,
168            T3,
169            T4,
170            T5,
171            T6,
172            T7,
173            T8,
174            T9,
175            T10,
176            T11,
177            T12,
178            T13,
179            T14,
180            T15,
181            T16,
182            T17,
183            T18,
184            T19,
185            T20,
186            T21,
187            T22,
188            T23,
189            T24,
190            T25,
191            T26,
192            T27,
193            T28,
194        )
195    {
196        #[inline]
197        unsafe fn encode(
198            self,
199            encoder: &mut fidl::encoding::Encoder<'_, D>,
200            offset: usize,
201            depth: fidl::encoding::Depth,
202        ) -> fidl::Result<()> {
203            encoder.debug_check_bounds::<Config>(offset);
204            // Zero out padding regions. There's no need to apply masks
205            // because the unmasked parts will be overwritten by fields.
206            unsafe {
207                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
208                (ptr as *mut u64).write_unaligned(0);
209            }
210            unsafe {
211                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
212                (ptr as *mut u64).write_unaligned(0);
213            }
214            unsafe {
215                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
216                (ptr as *mut u64).write_unaligned(0);
217            }
218            unsafe {
219                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(96);
220                (ptr as *mut u64).write_unaligned(0);
221            }
222            unsafe {
223                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(112);
224                (ptr as *mut u64).write_unaligned(0);
225            }
226            unsafe {
227                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(136);
228                (ptr as *mut u64).write_unaligned(0);
229            }
230            unsafe {
231                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(160);
232                (ptr as *mut u64).write_unaligned(0);
233            }
234            // Write the fields.
235            self.0.encode(encoder, offset + 0, depth)?;
236            self.1.encode(encoder, offset + 8, depth)?;
237            self.2.encode(encoder, offset + 24, depth)?;
238            self.3.encode(encoder, offset + 32, depth)?;
239            self.4.encode(encoder, offset + 40, depth)?;
240            self.5.encode(encoder, offset + 48, depth)?;
241            self.6.encode(encoder, offset + 64, depth)?;
242            self.7.encode(encoder, offset + 65, depth)?;
243            self.8.encode(encoder, offset + 66, depth)?;
244            self.9.encode(encoder, offset + 72, depth)?;
245            self.10.encode(encoder, offset + 88, depth)?;
246            self.11.encode(encoder, offset + 96, depth)?;
247            self.12.encode(encoder, offset + 97, depth)?;
248            self.13.encode(encoder, offset + 98, depth)?;
249            self.14.encode(encoder, offset + 99, depth)?;
250            self.15.encode(encoder, offset + 100, depth)?;
251            self.16.encode(encoder, offset + 104, depth)?;
252            self.17.encode(encoder, offset + 112, depth)?;
253            self.18.encode(encoder, offset + 120, depth)?;
254            self.19.encode(encoder, offset + 136, depth)?;
255            self.20.encode(encoder, offset + 137, depth)?;
256            self.21.encode(encoder, offset + 138, depth)?;
257            self.22.encode(encoder, offset + 139, depth)?;
258            self.23.encode(encoder, offset + 140, depth)?;
259            self.24.encode(encoder, offset + 141, depth)?;
260            self.25.encode(encoder, offset + 142, depth)?;
261            self.26.encode(encoder, offset + 144, depth)?;
262            self.27.encode(encoder, offset + 160, depth)?;
263            self.28.encode(encoder, offset + 161, depth)?;
264            Ok(())
265        }
266    }
267
268    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
269        #[inline(always)]
270        fn new_empty() -> Self {
271            Self {
272                blobfs: fidl::new_empty!(bool, D),
273                blobfs_cache_eviction_policy: fidl::new_empty!(
274                    fidl::encoding::BoundedString<20>,
275                    D
276                ),
277                blobfs_initial_inodes: fidl::new_empty!(u64, D),
278                blobfs_max_bytes: fidl::new_empty!(u64, D),
279                blobfs_use_deprecated_padded_format: fidl::new_empty!(bool, D),
280                blobfs_write_compression_algorithm: fidl::new_empty!(
281                    fidl::encoding::BoundedString<20>,
282                    D
283                ),
284                bootpart: fidl::new_empty!(bool, D),
285                check_filesystems: fidl::new_empty!(bool, D),
286                data: fidl::new_empty!(bool, D),
287                data_filesystem_format: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
288                data_max_bytes: fidl::new_empty!(u64, D),
289                disable_automount: fidl::new_empty!(bool, D),
290                disable_block_watcher: fidl::new_empty!(bool, D),
291                factory: fidl::new_empty!(bool, D),
292                format_data_on_corruption: fidl::new_empty!(bool, D),
293                fvm: fidl::new_empty!(bool, D),
294                fvm_slice_size: fidl::new_empty!(u64, D),
295                fxfs_blob: fidl::new_empty!(bool, D),
296                fxfs_crypt_url: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
297                gpt: fidl::new_empty!(bool, D),
298                gpt_all: fidl::new_empty!(bool, D),
299                mbr: fidl::new_empty!(bool, D),
300                nand: fidl::new_empty!(bool, D),
301                netboot: fidl::new_empty!(bool, D),
302                no_zxcrypt: fidl::new_empty!(bool, D),
303                ramdisk_image: fidl::new_empty!(bool, D),
304                starnix_volume_name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
305                storage_host: fidl::new_empty!(bool, D),
306                use_disk_migration: fidl::new_empty!(bool, D),
307            }
308        }
309
310        #[inline]
311        unsafe fn decode(
312            &mut self,
313            decoder: &mut fidl::encoding::Decoder<'_, D>,
314            offset: usize,
315            _depth: fidl::encoding::Depth,
316        ) -> fidl::Result<()> {
317            decoder.debug_check_bounds::<Self>(offset);
318            // Verify that padding bytes are zero.
319            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
320            let padval = unsafe { (ptr as *const u64).read_unaligned() };
321            let mask = 0xffffffffffffff00u64;
322            let maskedval = padval & mask;
323            if maskedval != 0 {
324                return Err(fidl::Error::NonZeroPadding {
325                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
326                });
327            }
328            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
329            let padval = unsafe { (ptr as *const u64).read_unaligned() };
330            let mask = 0xffffffffffffff00u64;
331            let maskedval = padval & mask;
332            if maskedval != 0 {
333                return Err(fidl::Error::NonZeroPadding {
334                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
335                });
336            }
337            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
338            let padval = unsafe { (ptr as *const u64).read_unaligned() };
339            let mask = 0xffffffffff000000u64;
340            let maskedval = padval & mask;
341            if maskedval != 0 {
342                return Err(fidl::Error::NonZeroPadding {
343                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
344                });
345            }
346            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(96) };
347            let padval = unsafe { (ptr as *const u64).read_unaligned() };
348            let mask = 0xffffff0000000000u64;
349            let maskedval = padval & mask;
350            if maskedval != 0 {
351                return Err(fidl::Error::NonZeroPadding {
352                    padding_start: offset + 96 + ((mask as u64).trailing_zeros() / 8) as usize,
353                });
354            }
355            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(112) };
356            let padval = unsafe { (ptr as *const u64).read_unaligned() };
357            let mask = 0xffffffffffffff00u64;
358            let maskedval = padval & mask;
359            if maskedval != 0 {
360                return Err(fidl::Error::NonZeroPadding {
361                    padding_start: offset + 112 + ((mask as u64).trailing_zeros() / 8) as usize,
362                });
363            }
364            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(136) };
365            let padval = unsafe { (ptr as *const u64).read_unaligned() };
366            let mask = 0xff00000000000000u64;
367            let maskedval = padval & mask;
368            if maskedval != 0 {
369                return Err(fidl::Error::NonZeroPadding {
370                    padding_start: offset + 136 + ((mask as u64).trailing_zeros() / 8) as usize,
371                });
372            }
373            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(160) };
374            let padval = unsafe { (ptr as *const u64).read_unaligned() };
375            let mask = 0xffffffffffff0000u64;
376            let maskedval = padval & mask;
377            if maskedval != 0 {
378                return Err(fidl::Error::NonZeroPadding {
379                    padding_start: offset + 160 + ((mask as u64).trailing_zeros() / 8) as usize,
380                });
381            }
382            fidl::decode!(bool, D, &mut self.blobfs, decoder, offset + 0, _depth)?;
383            fidl::decode!(
384                fidl::encoding::BoundedString<20>,
385                D,
386                &mut self.blobfs_cache_eviction_policy,
387                decoder,
388                offset + 8,
389                _depth
390            )?;
391            fidl::decode!(u64, D, &mut self.blobfs_initial_inodes, decoder, offset + 24, _depth)?;
392            fidl::decode!(u64, D, &mut self.blobfs_max_bytes, decoder, offset + 32, _depth)?;
393            fidl::decode!(
394                bool,
395                D,
396                &mut self.blobfs_use_deprecated_padded_format,
397                decoder,
398                offset + 40,
399                _depth
400            )?;
401            fidl::decode!(
402                fidl::encoding::BoundedString<20>,
403                D,
404                &mut self.blobfs_write_compression_algorithm,
405                decoder,
406                offset + 48,
407                _depth
408            )?;
409            fidl::decode!(bool, D, &mut self.bootpart, decoder, offset + 64, _depth)?;
410            fidl::decode!(bool, D, &mut self.check_filesystems, decoder, offset + 65, _depth)?;
411            fidl::decode!(bool, D, &mut self.data, decoder, offset + 66, _depth)?;
412            fidl::decode!(
413                fidl::encoding::BoundedString<64>,
414                D,
415                &mut self.data_filesystem_format,
416                decoder,
417                offset + 72,
418                _depth
419            )?;
420            fidl::decode!(u64, D, &mut self.data_max_bytes, decoder, offset + 88, _depth)?;
421            fidl::decode!(bool, D, &mut self.disable_automount, decoder, offset + 96, _depth)?;
422            fidl::decode!(bool, D, &mut self.disable_block_watcher, decoder, offset + 97, _depth)?;
423            fidl::decode!(bool, D, &mut self.factory, decoder, offset + 98, _depth)?;
424            fidl::decode!(
425                bool,
426                D,
427                &mut self.format_data_on_corruption,
428                decoder,
429                offset + 99,
430                _depth
431            )?;
432            fidl::decode!(bool, D, &mut self.fvm, decoder, offset + 100, _depth)?;
433            fidl::decode!(u64, D, &mut self.fvm_slice_size, decoder, offset + 104, _depth)?;
434            fidl::decode!(bool, D, &mut self.fxfs_blob, decoder, offset + 112, _depth)?;
435            fidl::decode!(
436                fidl::encoding::BoundedString<64>,
437                D,
438                &mut self.fxfs_crypt_url,
439                decoder,
440                offset + 120,
441                _depth
442            )?;
443            fidl::decode!(bool, D, &mut self.gpt, decoder, offset + 136, _depth)?;
444            fidl::decode!(bool, D, &mut self.gpt_all, decoder, offset + 137, _depth)?;
445            fidl::decode!(bool, D, &mut self.mbr, decoder, offset + 138, _depth)?;
446            fidl::decode!(bool, D, &mut self.nand, decoder, offset + 139, _depth)?;
447            fidl::decode!(bool, D, &mut self.netboot, decoder, offset + 140, _depth)?;
448            fidl::decode!(bool, D, &mut self.no_zxcrypt, decoder, offset + 141, _depth)?;
449            fidl::decode!(bool, D, &mut self.ramdisk_image, decoder, offset + 142, _depth)?;
450            fidl::decode!(
451                fidl::encoding::BoundedString<64>,
452                D,
453                &mut self.starnix_volume_name,
454                decoder,
455                offset + 144,
456                _depth
457            )?;
458            fidl::decode!(bool, D, &mut self.storage_host, decoder, offset + 160, _depth)?;
459            fidl::decode!(bool, D, &mut self.use_disk_migration, decoder, offset + 161, _depth)?;
460            Ok(())
461        }
462    }
463}