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