fidl_fuchsia_fshost/
fidl_fuchsia_fshost.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::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_fshost__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct AdminMountRequest {
16    pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
17    pub name: String,
18    pub options: MountOptions,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AdminMountRequest {}
22
23#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
24pub struct AdminWipeStorageRequest {
25    pub blobfs_root: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
26    pub blob_creator: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AdminWipeStorageRequest {}
30
31#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
32pub struct AdminWriteDataFileRequest {
33    pub filename: String,
34    pub payload: fidl::Vmo,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AdminWriteDataFileRequest {}
38
39#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct StarnixVolumeProviderCreateRequest {
41    pub crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
42    pub exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
43}
44
45impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
46    for StarnixVolumeProviderCreateRequest
47{
48}
49
50#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
51pub struct StarnixVolumeProviderMountRequest {
52    pub crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
53    pub exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
54}
55
56impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
57    for StarnixVolumeProviderMountRequest
58{
59}
60
61#[derive(Debug, Default, PartialEq)]
62pub struct MountOptions {
63    pub read_only: Option<bool>,
64    /// [DEPRECATED] Metrics are always enabled now.
65    pub collect_metrics: Option<bool>,
66    pub verbose: Option<bool>,
67    pub write_compression_algorithm: Option<String>,
68    #[doc(hidden)]
69    pub __source_breaking: fidl::marker::SourceBreaking,
70}
71
72impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MountOptions {}
73
74#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
75pub struct AdminMarker;
76
77impl fidl::endpoints::ProtocolMarker for AdminMarker {
78    type Proxy = AdminProxy;
79    type RequestStream = AdminRequestStream;
80    #[cfg(target_os = "fuchsia")]
81    type SynchronousProxy = AdminSynchronousProxy;
82
83    const DEBUG_NAME: &'static str = "fuchsia.fshost.Admin";
84}
85impl fidl::endpoints::DiscoverableProtocolMarker for AdminMarker {}
86pub type AdminMountResult = Result<(), i32>;
87pub type AdminUnmountResult = Result<(), i32>;
88pub type AdminGetDevicePathResult = Result<String, i32>;
89pub type AdminWriteDataFileResult = Result<(), i32>;
90pub type AdminWipeStorageResult = Result<(), i32>;
91pub type AdminShredDataVolumeResult = Result<(), i32>;
92
93pub trait AdminProxyInterface: Send + Sync {
94    type MountResponseFut: std::future::Future<Output = Result<AdminMountResult, fidl::Error>>
95        + Send;
96    fn r#mount(
97        &self,
98        device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
99        name: &str,
100        options: MountOptions,
101    ) -> Self::MountResponseFut;
102    type UnmountResponseFut: std::future::Future<Output = Result<AdminUnmountResult, fidl::Error>>
103        + Send;
104    fn r#unmount(&self, name: &str) -> Self::UnmountResponseFut;
105    type GetDevicePathResponseFut: std::future::Future<Output = Result<AdminGetDevicePathResult, fidl::Error>>
106        + Send;
107    fn r#get_device_path(&self, fs_id: u64) -> Self::GetDevicePathResponseFut;
108    type WriteDataFileResponseFut: std::future::Future<Output = Result<AdminWriteDataFileResult, fidl::Error>>
109        + Send;
110    fn r#write_data_file(
111        &self,
112        filename: &str,
113        payload: fidl::Vmo,
114    ) -> Self::WriteDataFileResponseFut;
115    type WipeStorageResponseFut: std::future::Future<Output = Result<AdminWipeStorageResult, fidl::Error>>
116        + Send;
117    fn r#wipe_storage(
118        &self,
119        blobfs_root: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
120        blob_creator: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>>,
121    ) -> Self::WipeStorageResponseFut;
122    type ShredDataVolumeResponseFut: std::future::Future<Output = Result<AdminShredDataVolumeResult, fidl::Error>>
123        + Send;
124    fn r#shred_data_volume(&self) -> Self::ShredDataVolumeResponseFut;
125    type StorageHostEnabledResponseFut: std::future::Future<Output = Result<bool, fidl::Error>>
126        + Send;
127    fn r#storage_host_enabled(&self) -> Self::StorageHostEnabledResponseFut;
128}
129#[derive(Debug)]
130#[cfg(target_os = "fuchsia")]
131pub struct AdminSynchronousProxy {
132    client: fidl::client::sync::Client,
133}
134
135#[cfg(target_os = "fuchsia")]
136impl fidl::endpoints::SynchronousProxy for AdminSynchronousProxy {
137    type Proxy = AdminProxy;
138    type Protocol = AdminMarker;
139
140    fn from_channel(inner: fidl::Channel) -> Self {
141        Self::new(inner)
142    }
143
144    fn into_channel(self) -> fidl::Channel {
145        self.client.into_channel()
146    }
147
148    fn as_channel(&self) -> &fidl::Channel {
149        self.client.as_channel()
150    }
151}
152
153#[cfg(target_os = "fuchsia")]
154impl AdminSynchronousProxy {
155    pub fn new(channel: fidl::Channel) -> Self {
156        let protocol_name = <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
157        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
158    }
159
160    pub fn into_channel(self) -> fidl::Channel {
161        self.client.into_channel()
162    }
163
164    /// Waits until an event arrives and returns it. It is safe for other
165    /// threads to make concurrent requests while waiting for an event.
166    pub fn wait_for_event(
167        &self,
168        deadline: zx::MonotonicInstant,
169    ) -> Result<AdminEvent, fidl::Error> {
170        AdminEvent::decode(self.client.wait_for_event(deadline)?)
171    }
172
173    /// Mounts the filesystem on the block device. The filesystem will be mounted in /fs/mnt/<name>
174    /// (in fshost's outgoing directory). This may or may not be supported depending on fshost
175    /// configuration.
176    pub fn r#mount(
177        &self,
178        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
179        mut name: &str,
180        mut options: MountOptions,
181        ___deadline: zx::MonotonicInstant,
182    ) -> Result<AdminMountResult, fidl::Error> {
183        let _response = self.client.send_query::<
184            AdminMountRequest,
185            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
186        >(
187            (device, name, &mut options,),
188            0x16306ba03192ba46,
189            fidl::encoding::DynamicFlags::empty(),
190            ___deadline,
191        )?;
192        Ok(_response.map(|x| x))
193    }
194
195    /// Unmounts a previously mounted filesystem.
196    pub fn r#unmount(
197        &self,
198        mut name: &str,
199        ___deadline: zx::MonotonicInstant,
200    ) -> Result<AdminUnmountResult, fidl::Error> {
201        let _response = self.client.send_query::<
202            AdminUnmountRequest,
203            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
204        >(
205            (name,),
206            0x18bd0292d4f70424,
207            fidl::encoding::DynamicFlags::empty(),
208            ___deadline,
209        )?;
210        Ok(_response.map(|x| x))
211    }
212
213    /// Returns the device path for the filesystem with the given fs_id.
214    pub fn r#get_device_path(
215        &self,
216        mut fs_id: u64,
217        ___deadline: zx::MonotonicInstant,
218    ) -> Result<AdminGetDevicePathResult, fidl::Error> {
219        let _response = self.client.send_query::<
220            AdminGetDevicePathRequest,
221            fidl::encoding::ResultType<AdminGetDevicePathResponse, i32>,
222        >(
223            (fs_id,),
224            0x6540a2949ccc50e7,
225            fidl::encoding::DynamicFlags::empty(),
226            ___deadline,
227        )?;
228        Ok(_response.map(|x| x.path))
229    }
230
231    /// Writes `filename` into the data partition with contents from `payload`, formatting the data
232    /// partition if it isn't already formatted.  Overwrites file if it already exists.
233    ///
234    /// This can only be called while the data partition isn't already mounted, which is typically
235    /// in recovery builds where fshost is running with the `ramdisk_image` flag set.
236    pub fn r#write_data_file(
237        &self,
238        mut filename: &str,
239        mut payload: fidl::Vmo,
240        ___deadline: zx::MonotonicInstant,
241    ) -> Result<AdminWriteDataFileResult, fidl::Error> {
242        let _response = self.client.send_query::<
243            AdminWriteDataFileRequest,
244            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
245        >(
246            (filename, payload,),
247            0x57d963b6bdc0c50e,
248            fidl::encoding::DynamicFlags::empty(),
249            ___deadline,
250        )?;
251        Ok(_response.map(|x| x))
252    }
253
254    /// Reprovision the first non-ramdisk FVM volume, and format/mount the blob partition.
255    /// The formatted Blobfs instance can be accessed via the client end of `blobfs_root`; if no
256    /// handle is provided, then blobfs won't be formatted.
257    ///
258    /// If fxblob is configured, blob_creator will be connected with the fxfs BlobCreator protocol,
259    /// which should be used instead of creating blobs in the `blobfs_root`. `blobfs_root` will
260    /// still be connected and can be used to read blobs. If fxblob is configured, but no handle is
261    /// provided for blob_creator or for blobfs_root, the blob volume won't be formatted. If a
262    /// handle is provided for blob_creator but fxblob is not configured, the channel will be
263    /// closed.
264    ///
265    /// This function will pause the fshost block watcher regardless of success or failure.
266    /// Requires fshost to be started with the `ramdisk_image` config option set to true.
267    ///
268    /// **WARNING**: This will cause irreversible data loss. Use with caution.
269    ///
270    /// TODO(https://fxbug.dev/42063480): This function unbinds all child drivers of the volume to be wiped.
271    /// This can race with the fshost block device manager, which attempts to bind the FVM driver
272    /// and unseal the zxcrypt volume.
273    pub fn r#wipe_storage(
274        &self,
275        mut blobfs_root: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
276        mut blob_creator: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>>,
277        ___deadline: zx::MonotonicInstant,
278    ) -> Result<AdminWipeStorageResult, fidl::Error> {
279        let _response = self.client.send_query::<
280            AdminWipeStorageRequest,
281            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
282        >(
283            (blobfs_root, blob_creator,),
284            0x7f135b6aabbc451b,
285            fidl::encoding::DynamicFlags::empty(),
286            ___deadline,
287        )?;
288        Ok(_response.map(|x| x))
289    }
290
291    /// Wipes the data volume which will get reinitialised upon next boot.  This is not
292    /// cryptographically secure; the caller should take care to reset hardware keys.
293    pub fn r#shred_data_volume(
294        &self,
295        ___deadline: zx::MonotonicInstant,
296    ) -> Result<AdminShredDataVolumeResult, fidl::Error> {
297        let _response = self.client.send_query::<
298            fidl::encoding::EmptyPayload,
299            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
300        >(
301            (),
302            0xb0d6c2e95343a10,
303            fidl::encoding::DynamicFlags::empty(),
304            ___deadline,
305        )?;
306        Ok(_response.map(|x| x))
307    }
308
309    /// Returns whether fshost is configured to use storage-host.
310    pub fn r#storage_host_enabled(
311        &self,
312        ___deadline: zx::MonotonicInstant,
313    ) -> Result<bool, fidl::Error> {
314        let _response = self
315            .client
316            .send_query::<fidl::encoding::EmptyPayload, AdminStorageHostEnabledResponse>(
317                (),
318                0x5934b6527ec49a35,
319                fidl::encoding::DynamicFlags::empty(),
320                ___deadline,
321            )?;
322        Ok(_response.enabled)
323    }
324}
325
326#[cfg(target_os = "fuchsia")]
327impl From<AdminSynchronousProxy> for zx::Handle {
328    fn from(value: AdminSynchronousProxy) -> Self {
329        value.into_channel().into()
330    }
331}
332
333#[cfg(target_os = "fuchsia")]
334impl From<fidl::Channel> for AdminSynchronousProxy {
335    fn from(value: fidl::Channel) -> Self {
336        Self::new(value)
337    }
338}
339
340#[cfg(target_os = "fuchsia")]
341impl fidl::endpoints::FromClient for AdminSynchronousProxy {
342    type Protocol = AdminMarker;
343
344    fn from_client(value: fidl::endpoints::ClientEnd<AdminMarker>) -> Self {
345        Self::new(value.into_channel())
346    }
347}
348
349#[derive(Debug, Clone)]
350pub struct AdminProxy {
351    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
352}
353
354impl fidl::endpoints::Proxy for AdminProxy {
355    type Protocol = AdminMarker;
356
357    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
358        Self::new(inner)
359    }
360
361    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
362        self.client.into_channel().map_err(|client| Self { client })
363    }
364
365    fn as_channel(&self) -> &::fidl::AsyncChannel {
366        self.client.as_channel()
367    }
368}
369
370impl AdminProxy {
371    /// Create a new Proxy for fuchsia.fshost/Admin.
372    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
373        let protocol_name = <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
374        Self { client: fidl::client::Client::new(channel, protocol_name) }
375    }
376
377    /// Get a Stream of events from the remote end of the protocol.
378    ///
379    /// # Panics
380    ///
381    /// Panics if the event stream was already taken.
382    pub fn take_event_stream(&self) -> AdminEventStream {
383        AdminEventStream { event_receiver: self.client.take_event_receiver() }
384    }
385
386    /// Mounts the filesystem on the block device. The filesystem will be mounted in /fs/mnt/<name>
387    /// (in fshost's outgoing directory). This may or may not be supported depending on fshost
388    /// configuration.
389    pub fn r#mount(
390        &self,
391        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
392        mut name: &str,
393        mut options: MountOptions,
394    ) -> fidl::client::QueryResponseFut<
395        AdminMountResult,
396        fidl::encoding::DefaultFuchsiaResourceDialect,
397    > {
398        AdminProxyInterface::r#mount(self, device, name, options)
399    }
400
401    /// Unmounts a previously mounted filesystem.
402    pub fn r#unmount(
403        &self,
404        mut name: &str,
405    ) -> fidl::client::QueryResponseFut<
406        AdminUnmountResult,
407        fidl::encoding::DefaultFuchsiaResourceDialect,
408    > {
409        AdminProxyInterface::r#unmount(self, name)
410    }
411
412    /// Returns the device path for the filesystem with the given fs_id.
413    pub fn r#get_device_path(
414        &self,
415        mut fs_id: u64,
416    ) -> fidl::client::QueryResponseFut<
417        AdminGetDevicePathResult,
418        fidl::encoding::DefaultFuchsiaResourceDialect,
419    > {
420        AdminProxyInterface::r#get_device_path(self, fs_id)
421    }
422
423    /// Writes `filename` into the data partition with contents from `payload`, formatting the data
424    /// partition if it isn't already formatted.  Overwrites file if it already exists.
425    ///
426    /// This can only be called while the data partition isn't already mounted, which is typically
427    /// in recovery builds where fshost is running with the `ramdisk_image` flag set.
428    pub fn r#write_data_file(
429        &self,
430        mut filename: &str,
431        mut payload: fidl::Vmo,
432    ) -> fidl::client::QueryResponseFut<
433        AdminWriteDataFileResult,
434        fidl::encoding::DefaultFuchsiaResourceDialect,
435    > {
436        AdminProxyInterface::r#write_data_file(self, filename, payload)
437    }
438
439    /// Reprovision the first non-ramdisk FVM volume, and format/mount the blob partition.
440    /// The formatted Blobfs instance can be accessed via the client end of `blobfs_root`; if no
441    /// handle is provided, then blobfs won't be formatted.
442    ///
443    /// If fxblob is configured, blob_creator will be connected with the fxfs BlobCreator protocol,
444    /// which should be used instead of creating blobs in the `blobfs_root`. `blobfs_root` will
445    /// still be connected and can be used to read blobs. If fxblob is configured, but no handle is
446    /// provided for blob_creator or for blobfs_root, the blob volume won't be formatted. If a
447    /// handle is provided for blob_creator but fxblob is not configured, the channel will be
448    /// closed.
449    ///
450    /// This function will pause the fshost block watcher regardless of success or failure.
451    /// Requires fshost to be started with the `ramdisk_image` config option set to true.
452    ///
453    /// **WARNING**: This will cause irreversible data loss. Use with caution.
454    ///
455    /// TODO(https://fxbug.dev/42063480): This function unbinds all child drivers of the volume to be wiped.
456    /// This can race with the fshost block device manager, which attempts to bind the FVM driver
457    /// and unseal the zxcrypt volume.
458    pub fn r#wipe_storage(
459        &self,
460        mut blobfs_root: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
461        mut blob_creator: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>>,
462    ) -> fidl::client::QueryResponseFut<
463        AdminWipeStorageResult,
464        fidl::encoding::DefaultFuchsiaResourceDialect,
465    > {
466        AdminProxyInterface::r#wipe_storage(self, blobfs_root, blob_creator)
467    }
468
469    /// Wipes the data volume which will get reinitialised upon next boot.  This is not
470    /// cryptographically secure; the caller should take care to reset hardware keys.
471    pub fn r#shred_data_volume(
472        &self,
473    ) -> fidl::client::QueryResponseFut<
474        AdminShredDataVolumeResult,
475        fidl::encoding::DefaultFuchsiaResourceDialect,
476    > {
477        AdminProxyInterface::r#shred_data_volume(self)
478    }
479
480    /// Returns whether fshost is configured to use storage-host.
481    pub fn r#storage_host_enabled(
482        &self,
483    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
484        AdminProxyInterface::r#storage_host_enabled(self)
485    }
486}
487
488impl AdminProxyInterface for AdminProxy {
489    type MountResponseFut = fidl::client::QueryResponseFut<
490        AdminMountResult,
491        fidl::encoding::DefaultFuchsiaResourceDialect,
492    >;
493    fn r#mount(
494        &self,
495        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
496        mut name: &str,
497        mut options: MountOptions,
498    ) -> Self::MountResponseFut {
499        fn _decode(
500            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
501        ) -> Result<AdminMountResult, fidl::Error> {
502            let _response = fidl::client::decode_transaction_body::<
503                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
504                fidl::encoding::DefaultFuchsiaResourceDialect,
505                0x16306ba03192ba46,
506            >(_buf?)?;
507            Ok(_response.map(|x| x))
508        }
509        self.client.send_query_and_decode::<AdminMountRequest, AdminMountResult>(
510            (device, name, &mut options),
511            0x16306ba03192ba46,
512            fidl::encoding::DynamicFlags::empty(),
513            _decode,
514        )
515    }
516
517    type UnmountResponseFut = fidl::client::QueryResponseFut<
518        AdminUnmountResult,
519        fidl::encoding::DefaultFuchsiaResourceDialect,
520    >;
521    fn r#unmount(&self, mut name: &str) -> Self::UnmountResponseFut {
522        fn _decode(
523            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
524        ) -> Result<AdminUnmountResult, fidl::Error> {
525            let _response = fidl::client::decode_transaction_body::<
526                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
527                fidl::encoding::DefaultFuchsiaResourceDialect,
528                0x18bd0292d4f70424,
529            >(_buf?)?;
530            Ok(_response.map(|x| x))
531        }
532        self.client.send_query_and_decode::<AdminUnmountRequest, AdminUnmountResult>(
533            (name,),
534            0x18bd0292d4f70424,
535            fidl::encoding::DynamicFlags::empty(),
536            _decode,
537        )
538    }
539
540    type GetDevicePathResponseFut = fidl::client::QueryResponseFut<
541        AdminGetDevicePathResult,
542        fidl::encoding::DefaultFuchsiaResourceDialect,
543    >;
544    fn r#get_device_path(&self, mut fs_id: u64) -> Self::GetDevicePathResponseFut {
545        fn _decode(
546            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
547        ) -> Result<AdminGetDevicePathResult, fidl::Error> {
548            let _response = fidl::client::decode_transaction_body::<
549                fidl::encoding::ResultType<AdminGetDevicePathResponse, i32>,
550                fidl::encoding::DefaultFuchsiaResourceDialect,
551                0x6540a2949ccc50e7,
552            >(_buf?)?;
553            Ok(_response.map(|x| x.path))
554        }
555        self.client.send_query_and_decode::<AdminGetDevicePathRequest, AdminGetDevicePathResult>(
556            (fs_id,),
557            0x6540a2949ccc50e7,
558            fidl::encoding::DynamicFlags::empty(),
559            _decode,
560        )
561    }
562
563    type WriteDataFileResponseFut = fidl::client::QueryResponseFut<
564        AdminWriteDataFileResult,
565        fidl::encoding::DefaultFuchsiaResourceDialect,
566    >;
567    fn r#write_data_file(
568        &self,
569        mut filename: &str,
570        mut payload: fidl::Vmo,
571    ) -> Self::WriteDataFileResponseFut {
572        fn _decode(
573            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
574        ) -> Result<AdminWriteDataFileResult, fidl::Error> {
575            let _response = fidl::client::decode_transaction_body::<
576                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
577                fidl::encoding::DefaultFuchsiaResourceDialect,
578                0x57d963b6bdc0c50e,
579            >(_buf?)?;
580            Ok(_response.map(|x| x))
581        }
582        self.client.send_query_and_decode::<AdminWriteDataFileRequest, AdminWriteDataFileResult>(
583            (filename, payload),
584            0x57d963b6bdc0c50e,
585            fidl::encoding::DynamicFlags::empty(),
586            _decode,
587        )
588    }
589
590    type WipeStorageResponseFut = fidl::client::QueryResponseFut<
591        AdminWipeStorageResult,
592        fidl::encoding::DefaultFuchsiaResourceDialect,
593    >;
594    fn r#wipe_storage(
595        &self,
596        mut blobfs_root: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
597        mut blob_creator: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>>,
598    ) -> Self::WipeStorageResponseFut {
599        fn _decode(
600            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
601        ) -> Result<AdminWipeStorageResult, fidl::Error> {
602            let _response = fidl::client::decode_transaction_body::<
603                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
604                fidl::encoding::DefaultFuchsiaResourceDialect,
605                0x7f135b6aabbc451b,
606            >(_buf?)?;
607            Ok(_response.map(|x| x))
608        }
609        self.client.send_query_and_decode::<AdminWipeStorageRequest, AdminWipeStorageResult>(
610            (blobfs_root, blob_creator),
611            0x7f135b6aabbc451b,
612            fidl::encoding::DynamicFlags::empty(),
613            _decode,
614        )
615    }
616
617    type ShredDataVolumeResponseFut = fidl::client::QueryResponseFut<
618        AdminShredDataVolumeResult,
619        fidl::encoding::DefaultFuchsiaResourceDialect,
620    >;
621    fn r#shred_data_volume(&self) -> Self::ShredDataVolumeResponseFut {
622        fn _decode(
623            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
624        ) -> Result<AdminShredDataVolumeResult, fidl::Error> {
625            let _response = fidl::client::decode_transaction_body::<
626                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
627                fidl::encoding::DefaultFuchsiaResourceDialect,
628                0xb0d6c2e95343a10,
629            >(_buf?)?;
630            Ok(_response.map(|x| x))
631        }
632        self.client
633            .send_query_and_decode::<fidl::encoding::EmptyPayload, AdminShredDataVolumeResult>(
634                (),
635                0xb0d6c2e95343a10,
636                fidl::encoding::DynamicFlags::empty(),
637                _decode,
638            )
639    }
640
641    type StorageHostEnabledResponseFut =
642        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
643    fn r#storage_host_enabled(&self) -> Self::StorageHostEnabledResponseFut {
644        fn _decode(
645            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
646        ) -> Result<bool, fidl::Error> {
647            let _response = fidl::client::decode_transaction_body::<
648                AdminStorageHostEnabledResponse,
649                fidl::encoding::DefaultFuchsiaResourceDialect,
650                0x5934b6527ec49a35,
651            >(_buf?)?;
652            Ok(_response.enabled)
653        }
654        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
655            (),
656            0x5934b6527ec49a35,
657            fidl::encoding::DynamicFlags::empty(),
658            _decode,
659        )
660    }
661}
662
663pub struct AdminEventStream {
664    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
665}
666
667impl std::marker::Unpin for AdminEventStream {}
668
669impl futures::stream::FusedStream for AdminEventStream {
670    fn is_terminated(&self) -> bool {
671        self.event_receiver.is_terminated()
672    }
673}
674
675impl futures::Stream for AdminEventStream {
676    type Item = Result<AdminEvent, fidl::Error>;
677
678    fn poll_next(
679        mut self: std::pin::Pin<&mut Self>,
680        cx: &mut std::task::Context<'_>,
681    ) -> std::task::Poll<Option<Self::Item>> {
682        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
683            &mut self.event_receiver,
684            cx
685        )?) {
686            Some(buf) => std::task::Poll::Ready(Some(AdminEvent::decode(buf))),
687            None => std::task::Poll::Ready(None),
688        }
689    }
690}
691
692#[derive(Debug)]
693pub enum AdminEvent {}
694
695impl AdminEvent {
696    /// Decodes a message buffer as a [`AdminEvent`].
697    fn decode(
698        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
699    ) -> Result<AdminEvent, fidl::Error> {
700        let (bytes, _handles) = buf.split_mut();
701        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
702        debug_assert_eq!(tx_header.tx_id, 0);
703        match tx_header.ordinal {
704            _ => Err(fidl::Error::UnknownOrdinal {
705                ordinal: tx_header.ordinal,
706                protocol_name: <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
707            }),
708        }
709    }
710}
711
712/// A Stream of incoming requests for fuchsia.fshost/Admin.
713pub struct AdminRequestStream {
714    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
715    is_terminated: bool,
716}
717
718impl std::marker::Unpin for AdminRequestStream {}
719
720impl futures::stream::FusedStream for AdminRequestStream {
721    fn is_terminated(&self) -> bool {
722        self.is_terminated
723    }
724}
725
726impl fidl::endpoints::RequestStream for AdminRequestStream {
727    type Protocol = AdminMarker;
728    type ControlHandle = AdminControlHandle;
729
730    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
731        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
732    }
733
734    fn control_handle(&self) -> Self::ControlHandle {
735        AdminControlHandle { inner: self.inner.clone() }
736    }
737
738    fn into_inner(
739        self,
740    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
741    {
742        (self.inner, self.is_terminated)
743    }
744
745    fn from_inner(
746        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
747        is_terminated: bool,
748    ) -> Self {
749        Self { inner, is_terminated }
750    }
751}
752
753impl futures::Stream for AdminRequestStream {
754    type Item = Result<AdminRequest, fidl::Error>;
755
756    fn poll_next(
757        mut self: std::pin::Pin<&mut Self>,
758        cx: &mut std::task::Context<'_>,
759    ) -> std::task::Poll<Option<Self::Item>> {
760        let this = &mut *self;
761        if this.inner.check_shutdown(cx) {
762            this.is_terminated = true;
763            return std::task::Poll::Ready(None);
764        }
765        if this.is_terminated {
766            panic!("polled AdminRequestStream after completion");
767        }
768        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
769            |bytes, handles| {
770                match this.inner.channel().read_etc(cx, bytes, handles) {
771                    std::task::Poll::Ready(Ok(())) => {}
772                    std::task::Poll::Pending => return std::task::Poll::Pending,
773                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
774                        this.is_terminated = true;
775                        return std::task::Poll::Ready(None);
776                    }
777                    std::task::Poll::Ready(Err(e)) => {
778                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
779                            e.into(),
780                        ))))
781                    }
782                }
783
784                // A message has been received from the channel
785                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
786
787                std::task::Poll::Ready(Some(match header.ordinal {
788                    0x16306ba03192ba46 => {
789                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
790                        let mut req = fidl::new_empty!(
791                            AdminMountRequest,
792                            fidl::encoding::DefaultFuchsiaResourceDialect
793                        );
794                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminMountRequest>(&header, _body_bytes, handles, &mut req)?;
795                        let control_handle = AdminControlHandle { inner: this.inner.clone() };
796                        Ok(AdminRequest::Mount {
797                            device: req.device,
798                            name: req.name,
799                            options: req.options,
800
801                            responder: AdminMountResponder {
802                                control_handle: std::mem::ManuallyDrop::new(control_handle),
803                                tx_id: header.tx_id,
804                            },
805                        })
806                    }
807                    0x18bd0292d4f70424 => {
808                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
809                        let mut req = fidl::new_empty!(
810                            AdminUnmountRequest,
811                            fidl::encoding::DefaultFuchsiaResourceDialect
812                        );
813                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminUnmountRequest>(&header, _body_bytes, handles, &mut req)?;
814                        let control_handle = AdminControlHandle { inner: this.inner.clone() };
815                        Ok(AdminRequest::Unmount {
816                            name: req.name,
817
818                            responder: AdminUnmountResponder {
819                                control_handle: std::mem::ManuallyDrop::new(control_handle),
820                                tx_id: header.tx_id,
821                            },
822                        })
823                    }
824                    0x6540a2949ccc50e7 => {
825                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
826                        let mut req = fidl::new_empty!(
827                            AdminGetDevicePathRequest,
828                            fidl::encoding::DefaultFuchsiaResourceDialect
829                        );
830                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminGetDevicePathRequest>(&header, _body_bytes, handles, &mut req)?;
831                        let control_handle = AdminControlHandle { inner: this.inner.clone() };
832                        Ok(AdminRequest::GetDevicePath {
833                            fs_id: req.fs_id,
834
835                            responder: AdminGetDevicePathResponder {
836                                control_handle: std::mem::ManuallyDrop::new(control_handle),
837                                tx_id: header.tx_id,
838                            },
839                        })
840                    }
841                    0x57d963b6bdc0c50e => {
842                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
843                        let mut req = fidl::new_empty!(
844                            AdminWriteDataFileRequest,
845                            fidl::encoding::DefaultFuchsiaResourceDialect
846                        );
847                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminWriteDataFileRequest>(&header, _body_bytes, handles, &mut req)?;
848                        let control_handle = AdminControlHandle { inner: this.inner.clone() };
849                        Ok(AdminRequest::WriteDataFile {
850                            filename: req.filename,
851                            payload: req.payload,
852
853                            responder: AdminWriteDataFileResponder {
854                                control_handle: std::mem::ManuallyDrop::new(control_handle),
855                                tx_id: header.tx_id,
856                            },
857                        })
858                    }
859                    0x7f135b6aabbc451b => {
860                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
861                        let mut req = fidl::new_empty!(
862                            AdminWipeStorageRequest,
863                            fidl::encoding::DefaultFuchsiaResourceDialect
864                        );
865                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminWipeStorageRequest>(&header, _body_bytes, handles, &mut req)?;
866                        let control_handle = AdminControlHandle { inner: this.inner.clone() };
867                        Ok(AdminRequest::WipeStorage {
868                            blobfs_root: req.blobfs_root,
869                            blob_creator: req.blob_creator,
870
871                            responder: AdminWipeStorageResponder {
872                                control_handle: std::mem::ManuallyDrop::new(control_handle),
873                                tx_id: header.tx_id,
874                            },
875                        })
876                    }
877                    0xb0d6c2e95343a10 => {
878                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
879                        let mut req = fidl::new_empty!(
880                            fidl::encoding::EmptyPayload,
881                            fidl::encoding::DefaultFuchsiaResourceDialect
882                        );
883                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
884                        let control_handle = AdminControlHandle { inner: this.inner.clone() };
885                        Ok(AdminRequest::ShredDataVolume {
886                            responder: AdminShredDataVolumeResponder {
887                                control_handle: std::mem::ManuallyDrop::new(control_handle),
888                                tx_id: header.tx_id,
889                            },
890                        })
891                    }
892                    0x5934b6527ec49a35 => {
893                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
894                        let mut req = fidl::new_empty!(
895                            fidl::encoding::EmptyPayload,
896                            fidl::encoding::DefaultFuchsiaResourceDialect
897                        );
898                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
899                        let control_handle = AdminControlHandle { inner: this.inner.clone() };
900                        Ok(AdminRequest::StorageHostEnabled {
901                            responder: AdminStorageHostEnabledResponder {
902                                control_handle: std::mem::ManuallyDrop::new(control_handle),
903                                tx_id: header.tx_id,
904                            },
905                        })
906                    }
907                    _ => Err(fidl::Error::UnknownOrdinal {
908                        ordinal: header.ordinal,
909                        protocol_name: <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
910                    }),
911                }))
912            },
913        )
914    }
915}
916
917/// Manages fshost lifecycle
918#[derive(Debug)]
919pub enum AdminRequest {
920    /// Mounts the filesystem on the block device. The filesystem will be mounted in /fs/mnt/<name>
921    /// (in fshost's outgoing directory). This may or may not be supported depending on fshost
922    /// configuration.
923    Mount {
924        device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
925        name: String,
926        options: MountOptions,
927        responder: AdminMountResponder,
928    },
929    /// Unmounts a previously mounted filesystem.
930    Unmount { name: String, responder: AdminUnmountResponder },
931    /// Returns the device path for the filesystem with the given fs_id.
932    GetDevicePath { fs_id: u64, responder: AdminGetDevicePathResponder },
933    /// Writes `filename` into the data partition with contents from `payload`, formatting the data
934    /// partition if it isn't already formatted.  Overwrites file if it already exists.
935    ///
936    /// This can only be called while the data partition isn't already mounted, which is typically
937    /// in recovery builds where fshost is running with the `ramdisk_image` flag set.
938    WriteDataFile { filename: String, payload: fidl::Vmo, responder: AdminWriteDataFileResponder },
939    /// Reprovision the first non-ramdisk FVM volume, and format/mount the blob partition.
940    /// The formatted Blobfs instance can be accessed via the client end of `blobfs_root`; if no
941    /// handle is provided, then blobfs won't be formatted.
942    ///
943    /// If fxblob is configured, blob_creator will be connected with the fxfs BlobCreator protocol,
944    /// which should be used instead of creating blobs in the `blobfs_root`. `blobfs_root` will
945    /// still be connected and can be used to read blobs. If fxblob is configured, but no handle is
946    /// provided for blob_creator or for blobfs_root, the blob volume won't be formatted. If a
947    /// handle is provided for blob_creator but fxblob is not configured, the channel will be
948    /// closed.
949    ///
950    /// This function will pause the fshost block watcher regardless of success or failure.
951    /// Requires fshost to be started with the `ramdisk_image` config option set to true.
952    ///
953    /// **WARNING**: This will cause irreversible data loss. Use with caution.
954    ///
955    /// TODO(https://fxbug.dev/42063480): This function unbinds all child drivers of the volume to be wiped.
956    /// This can race with the fshost block device manager, which attempts to bind the FVM driver
957    /// and unseal the zxcrypt volume.
958    WipeStorage {
959        blobfs_root: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
960        blob_creator: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>>,
961        responder: AdminWipeStorageResponder,
962    },
963    /// Wipes the data volume which will get reinitialised upon next boot.  This is not
964    /// cryptographically secure; the caller should take care to reset hardware keys.
965    ShredDataVolume { responder: AdminShredDataVolumeResponder },
966    /// Returns whether fshost is configured to use storage-host.
967    StorageHostEnabled { responder: AdminStorageHostEnabledResponder },
968}
969
970impl AdminRequest {
971    #[allow(irrefutable_let_patterns)]
972    pub fn into_mount(
973        self,
974    ) -> Option<(
975        fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
976        String,
977        MountOptions,
978        AdminMountResponder,
979    )> {
980        if let AdminRequest::Mount { device, name, options, responder } = self {
981            Some((device, name, options, responder))
982        } else {
983            None
984        }
985    }
986
987    #[allow(irrefutable_let_patterns)]
988    pub fn into_unmount(self) -> Option<(String, AdminUnmountResponder)> {
989        if let AdminRequest::Unmount { name, responder } = self {
990            Some((name, responder))
991        } else {
992            None
993        }
994    }
995
996    #[allow(irrefutable_let_patterns)]
997    pub fn into_get_device_path(self) -> Option<(u64, AdminGetDevicePathResponder)> {
998        if let AdminRequest::GetDevicePath { fs_id, responder } = self {
999            Some((fs_id, responder))
1000        } else {
1001            None
1002        }
1003    }
1004
1005    #[allow(irrefutable_let_patterns)]
1006    pub fn into_write_data_file(self) -> Option<(String, fidl::Vmo, AdminWriteDataFileResponder)> {
1007        if let AdminRequest::WriteDataFile { filename, payload, responder } = self {
1008            Some((filename, payload, responder))
1009        } else {
1010            None
1011        }
1012    }
1013
1014    #[allow(irrefutable_let_patterns)]
1015    pub fn into_wipe_storage(
1016        self,
1017    ) -> Option<(
1018        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
1019        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>>,
1020        AdminWipeStorageResponder,
1021    )> {
1022        if let AdminRequest::WipeStorage { blobfs_root, blob_creator, responder } = self {
1023            Some((blobfs_root, blob_creator, responder))
1024        } else {
1025            None
1026        }
1027    }
1028
1029    #[allow(irrefutable_let_patterns)]
1030    pub fn into_shred_data_volume(self) -> Option<(AdminShredDataVolumeResponder)> {
1031        if let AdminRequest::ShredDataVolume { responder } = self {
1032            Some((responder))
1033        } else {
1034            None
1035        }
1036    }
1037
1038    #[allow(irrefutable_let_patterns)]
1039    pub fn into_storage_host_enabled(self) -> Option<(AdminStorageHostEnabledResponder)> {
1040        if let AdminRequest::StorageHostEnabled { responder } = self {
1041            Some((responder))
1042        } else {
1043            None
1044        }
1045    }
1046
1047    /// Name of the method defined in FIDL
1048    pub fn method_name(&self) -> &'static str {
1049        match *self {
1050            AdminRequest::Mount { .. } => "mount",
1051            AdminRequest::Unmount { .. } => "unmount",
1052            AdminRequest::GetDevicePath { .. } => "get_device_path",
1053            AdminRequest::WriteDataFile { .. } => "write_data_file",
1054            AdminRequest::WipeStorage { .. } => "wipe_storage",
1055            AdminRequest::ShredDataVolume { .. } => "shred_data_volume",
1056            AdminRequest::StorageHostEnabled { .. } => "storage_host_enabled",
1057        }
1058    }
1059}
1060
1061#[derive(Debug, Clone)]
1062pub struct AdminControlHandle {
1063    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1064}
1065
1066impl fidl::endpoints::ControlHandle for AdminControlHandle {
1067    fn shutdown(&self) {
1068        self.inner.shutdown()
1069    }
1070    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1071        self.inner.shutdown_with_epitaph(status)
1072    }
1073
1074    fn is_closed(&self) -> bool {
1075        self.inner.channel().is_closed()
1076    }
1077    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1078        self.inner.channel().on_closed()
1079    }
1080
1081    #[cfg(target_os = "fuchsia")]
1082    fn signal_peer(
1083        &self,
1084        clear_mask: zx::Signals,
1085        set_mask: zx::Signals,
1086    ) -> Result<(), zx_status::Status> {
1087        use fidl::Peered;
1088        self.inner.channel().signal_peer(clear_mask, set_mask)
1089    }
1090}
1091
1092impl AdminControlHandle {}
1093
1094#[must_use = "FIDL methods require a response to be sent"]
1095#[derive(Debug)]
1096pub struct AdminMountResponder {
1097    control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1098    tx_id: u32,
1099}
1100
1101/// Set the the channel to be shutdown (see [`AdminControlHandle::shutdown`])
1102/// if the responder is dropped without sending a response, so that the client
1103/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1104impl std::ops::Drop for AdminMountResponder {
1105    fn drop(&mut self) {
1106        self.control_handle.shutdown();
1107        // Safety: drops once, never accessed again
1108        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1109    }
1110}
1111
1112impl fidl::endpoints::Responder for AdminMountResponder {
1113    type ControlHandle = AdminControlHandle;
1114
1115    fn control_handle(&self) -> &AdminControlHandle {
1116        &self.control_handle
1117    }
1118
1119    fn drop_without_shutdown(mut self) {
1120        // Safety: drops once, never accessed again due to mem::forget
1121        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1122        // Prevent Drop from running (which would shut down the channel)
1123        std::mem::forget(self);
1124    }
1125}
1126
1127impl AdminMountResponder {
1128    /// Sends a response to the FIDL transaction.
1129    ///
1130    /// Sets the channel to shutdown if an error occurs.
1131    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1132        let _result = self.send_raw(result);
1133        if _result.is_err() {
1134            self.control_handle.shutdown();
1135        }
1136        self.drop_without_shutdown();
1137        _result
1138    }
1139
1140    /// Similar to "send" but does not shutdown the channel if an error occurs.
1141    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1142        let _result = self.send_raw(result);
1143        self.drop_without_shutdown();
1144        _result
1145    }
1146
1147    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1148        self.control_handle
1149            .inner
1150            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1151                result,
1152                self.tx_id,
1153                0x16306ba03192ba46,
1154                fidl::encoding::DynamicFlags::empty(),
1155            )
1156    }
1157}
1158
1159#[must_use = "FIDL methods require a response to be sent"]
1160#[derive(Debug)]
1161pub struct AdminUnmountResponder {
1162    control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1163    tx_id: u32,
1164}
1165
1166/// Set the the channel to be shutdown (see [`AdminControlHandle::shutdown`])
1167/// if the responder is dropped without sending a response, so that the client
1168/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1169impl std::ops::Drop for AdminUnmountResponder {
1170    fn drop(&mut self) {
1171        self.control_handle.shutdown();
1172        // Safety: drops once, never accessed again
1173        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1174    }
1175}
1176
1177impl fidl::endpoints::Responder for AdminUnmountResponder {
1178    type ControlHandle = AdminControlHandle;
1179
1180    fn control_handle(&self) -> &AdminControlHandle {
1181        &self.control_handle
1182    }
1183
1184    fn drop_without_shutdown(mut self) {
1185        // Safety: drops once, never accessed again due to mem::forget
1186        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1187        // Prevent Drop from running (which would shut down the channel)
1188        std::mem::forget(self);
1189    }
1190}
1191
1192impl AdminUnmountResponder {
1193    /// Sends a response to the FIDL transaction.
1194    ///
1195    /// Sets the channel to shutdown if an error occurs.
1196    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1197        let _result = self.send_raw(result);
1198        if _result.is_err() {
1199            self.control_handle.shutdown();
1200        }
1201        self.drop_without_shutdown();
1202        _result
1203    }
1204
1205    /// Similar to "send" but does not shutdown the channel if an error occurs.
1206    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1207        let _result = self.send_raw(result);
1208        self.drop_without_shutdown();
1209        _result
1210    }
1211
1212    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1213        self.control_handle
1214            .inner
1215            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1216                result,
1217                self.tx_id,
1218                0x18bd0292d4f70424,
1219                fidl::encoding::DynamicFlags::empty(),
1220            )
1221    }
1222}
1223
1224#[must_use = "FIDL methods require a response to be sent"]
1225#[derive(Debug)]
1226pub struct AdminGetDevicePathResponder {
1227    control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1228    tx_id: u32,
1229}
1230
1231/// Set the the channel to be shutdown (see [`AdminControlHandle::shutdown`])
1232/// if the responder is dropped without sending a response, so that the client
1233/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1234impl std::ops::Drop for AdminGetDevicePathResponder {
1235    fn drop(&mut self) {
1236        self.control_handle.shutdown();
1237        // Safety: drops once, never accessed again
1238        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1239    }
1240}
1241
1242impl fidl::endpoints::Responder for AdminGetDevicePathResponder {
1243    type ControlHandle = AdminControlHandle;
1244
1245    fn control_handle(&self) -> &AdminControlHandle {
1246        &self.control_handle
1247    }
1248
1249    fn drop_without_shutdown(mut self) {
1250        // Safety: drops once, never accessed again due to mem::forget
1251        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1252        // Prevent Drop from running (which would shut down the channel)
1253        std::mem::forget(self);
1254    }
1255}
1256
1257impl AdminGetDevicePathResponder {
1258    /// Sends a response to the FIDL transaction.
1259    ///
1260    /// Sets the channel to shutdown if an error occurs.
1261    pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1262        let _result = self.send_raw(result);
1263        if _result.is_err() {
1264            self.control_handle.shutdown();
1265        }
1266        self.drop_without_shutdown();
1267        _result
1268    }
1269
1270    /// Similar to "send" but does not shutdown the channel if an error occurs.
1271    pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1272        let _result = self.send_raw(result);
1273        self.drop_without_shutdown();
1274        _result
1275    }
1276
1277    fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1278        self.control_handle
1279            .inner
1280            .send::<fidl::encoding::ResultType<AdminGetDevicePathResponse, i32>>(
1281                result.map(|path| (path,)),
1282                self.tx_id,
1283                0x6540a2949ccc50e7,
1284                fidl::encoding::DynamicFlags::empty(),
1285            )
1286    }
1287}
1288
1289#[must_use = "FIDL methods require a response to be sent"]
1290#[derive(Debug)]
1291pub struct AdminWriteDataFileResponder {
1292    control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1293    tx_id: u32,
1294}
1295
1296/// Set the the channel to be shutdown (see [`AdminControlHandle::shutdown`])
1297/// if the responder is dropped without sending a response, so that the client
1298/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1299impl std::ops::Drop for AdminWriteDataFileResponder {
1300    fn drop(&mut self) {
1301        self.control_handle.shutdown();
1302        // Safety: drops once, never accessed again
1303        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1304    }
1305}
1306
1307impl fidl::endpoints::Responder for AdminWriteDataFileResponder {
1308    type ControlHandle = AdminControlHandle;
1309
1310    fn control_handle(&self) -> &AdminControlHandle {
1311        &self.control_handle
1312    }
1313
1314    fn drop_without_shutdown(mut self) {
1315        // Safety: drops once, never accessed again due to mem::forget
1316        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1317        // Prevent Drop from running (which would shut down the channel)
1318        std::mem::forget(self);
1319    }
1320}
1321
1322impl AdminWriteDataFileResponder {
1323    /// Sends a response to the FIDL transaction.
1324    ///
1325    /// Sets the channel to shutdown if an error occurs.
1326    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1327        let _result = self.send_raw(result);
1328        if _result.is_err() {
1329            self.control_handle.shutdown();
1330        }
1331        self.drop_without_shutdown();
1332        _result
1333    }
1334
1335    /// Similar to "send" but does not shutdown the channel if an error occurs.
1336    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1337        let _result = self.send_raw(result);
1338        self.drop_without_shutdown();
1339        _result
1340    }
1341
1342    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1343        self.control_handle
1344            .inner
1345            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1346                result,
1347                self.tx_id,
1348                0x57d963b6bdc0c50e,
1349                fidl::encoding::DynamicFlags::empty(),
1350            )
1351    }
1352}
1353
1354#[must_use = "FIDL methods require a response to be sent"]
1355#[derive(Debug)]
1356pub struct AdminWipeStorageResponder {
1357    control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1358    tx_id: u32,
1359}
1360
1361/// Set the the channel to be shutdown (see [`AdminControlHandle::shutdown`])
1362/// if the responder is dropped without sending a response, so that the client
1363/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1364impl std::ops::Drop for AdminWipeStorageResponder {
1365    fn drop(&mut self) {
1366        self.control_handle.shutdown();
1367        // Safety: drops once, never accessed again
1368        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1369    }
1370}
1371
1372impl fidl::endpoints::Responder for AdminWipeStorageResponder {
1373    type ControlHandle = AdminControlHandle;
1374
1375    fn control_handle(&self) -> &AdminControlHandle {
1376        &self.control_handle
1377    }
1378
1379    fn drop_without_shutdown(mut self) {
1380        // Safety: drops once, never accessed again due to mem::forget
1381        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1382        // Prevent Drop from running (which would shut down the channel)
1383        std::mem::forget(self);
1384    }
1385}
1386
1387impl AdminWipeStorageResponder {
1388    /// Sends a response to the FIDL transaction.
1389    ///
1390    /// Sets the channel to shutdown if an error occurs.
1391    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1392        let _result = self.send_raw(result);
1393        if _result.is_err() {
1394            self.control_handle.shutdown();
1395        }
1396        self.drop_without_shutdown();
1397        _result
1398    }
1399
1400    /// Similar to "send" but does not shutdown the channel if an error occurs.
1401    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1402        let _result = self.send_raw(result);
1403        self.drop_without_shutdown();
1404        _result
1405    }
1406
1407    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1408        self.control_handle
1409            .inner
1410            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1411                result,
1412                self.tx_id,
1413                0x7f135b6aabbc451b,
1414                fidl::encoding::DynamicFlags::empty(),
1415            )
1416    }
1417}
1418
1419#[must_use = "FIDL methods require a response to be sent"]
1420#[derive(Debug)]
1421pub struct AdminShredDataVolumeResponder {
1422    control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1423    tx_id: u32,
1424}
1425
1426/// Set the the channel to be shutdown (see [`AdminControlHandle::shutdown`])
1427/// if the responder is dropped without sending a response, so that the client
1428/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1429impl std::ops::Drop for AdminShredDataVolumeResponder {
1430    fn drop(&mut self) {
1431        self.control_handle.shutdown();
1432        // Safety: drops once, never accessed again
1433        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1434    }
1435}
1436
1437impl fidl::endpoints::Responder for AdminShredDataVolumeResponder {
1438    type ControlHandle = AdminControlHandle;
1439
1440    fn control_handle(&self) -> &AdminControlHandle {
1441        &self.control_handle
1442    }
1443
1444    fn drop_without_shutdown(mut self) {
1445        // Safety: drops once, never accessed again due to mem::forget
1446        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1447        // Prevent Drop from running (which would shut down the channel)
1448        std::mem::forget(self);
1449    }
1450}
1451
1452impl AdminShredDataVolumeResponder {
1453    /// Sends a response to the FIDL transaction.
1454    ///
1455    /// Sets the channel to shutdown if an error occurs.
1456    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1457        let _result = self.send_raw(result);
1458        if _result.is_err() {
1459            self.control_handle.shutdown();
1460        }
1461        self.drop_without_shutdown();
1462        _result
1463    }
1464
1465    /// Similar to "send" but does not shutdown the channel if an error occurs.
1466    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1467        let _result = self.send_raw(result);
1468        self.drop_without_shutdown();
1469        _result
1470    }
1471
1472    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1473        self.control_handle
1474            .inner
1475            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1476                result,
1477                self.tx_id,
1478                0xb0d6c2e95343a10,
1479                fidl::encoding::DynamicFlags::empty(),
1480            )
1481    }
1482}
1483
1484#[must_use = "FIDL methods require a response to be sent"]
1485#[derive(Debug)]
1486pub struct AdminStorageHostEnabledResponder {
1487    control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1488    tx_id: u32,
1489}
1490
1491/// Set the the channel to be shutdown (see [`AdminControlHandle::shutdown`])
1492/// if the responder is dropped without sending a response, so that the client
1493/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1494impl std::ops::Drop for AdminStorageHostEnabledResponder {
1495    fn drop(&mut self) {
1496        self.control_handle.shutdown();
1497        // Safety: drops once, never accessed again
1498        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1499    }
1500}
1501
1502impl fidl::endpoints::Responder for AdminStorageHostEnabledResponder {
1503    type ControlHandle = AdminControlHandle;
1504
1505    fn control_handle(&self) -> &AdminControlHandle {
1506        &self.control_handle
1507    }
1508
1509    fn drop_without_shutdown(mut self) {
1510        // Safety: drops once, never accessed again due to mem::forget
1511        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1512        // Prevent Drop from running (which would shut down the channel)
1513        std::mem::forget(self);
1514    }
1515}
1516
1517impl AdminStorageHostEnabledResponder {
1518    /// Sends a response to the FIDL transaction.
1519    ///
1520    /// Sets the channel to shutdown if an error occurs.
1521    pub fn send(self, mut enabled: bool) -> Result<(), fidl::Error> {
1522        let _result = self.send_raw(enabled);
1523        if _result.is_err() {
1524            self.control_handle.shutdown();
1525        }
1526        self.drop_without_shutdown();
1527        _result
1528    }
1529
1530    /// Similar to "send" but does not shutdown the channel if an error occurs.
1531    pub fn send_no_shutdown_on_err(self, mut enabled: bool) -> Result<(), fidl::Error> {
1532        let _result = self.send_raw(enabled);
1533        self.drop_without_shutdown();
1534        _result
1535    }
1536
1537    fn send_raw(&self, mut enabled: bool) -> Result<(), fidl::Error> {
1538        self.control_handle.inner.send::<AdminStorageHostEnabledResponse>(
1539            (enabled,),
1540            self.tx_id,
1541            0x5934b6527ec49a35,
1542            fidl::encoding::DynamicFlags::empty(),
1543        )
1544    }
1545}
1546
1547#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1548pub struct RecoveryMarker;
1549
1550impl fidl::endpoints::ProtocolMarker for RecoveryMarker {
1551    type Proxy = RecoveryProxy;
1552    type RequestStream = RecoveryRequestStream;
1553    #[cfg(target_os = "fuchsia")]
1554    type SynchronousProxy = RecoverySynchronousProxy;
1555
1556    const DEBUG_NAME: &'static str = "fuchsia.fshost.Recovery";
1557}
1558impl fidl::endpoints::DiscoverableProtocolMarker for RecoveryMarker {}
1559pub type RecoveryInitSystemPartitionTableResult = Result<(), i32>;
1560
1561pub trait RecoveryProxyInterface: Send + Sync {
1562    type InitSystemPartitionTableResponseFut: std::future::Future<Output = Result<RecoveryInitSystemPartitionTableResult, fidl::Error>>
1563        + Send;
1564    fn r#init_system_partition_table(
1565        &self,
1566        partitions: &[fidl_fuchsia_storage_partitions::PartitionInfo],
1567    ) -> Self::InitSystemPartitionTableResponseFut;
1568}
1569#[derive(Debug)]
1570#[cfg(target_os = "fuchsia")]
1571pub struct RecoverySynchronousProxy {
1572    client: fidl::client::sync::Client,
1573}
1574
1575#[cfg(target_os = "fuchsia")]
1576impl fidl::endpoints::SynchronousProxy for RecoverySynchronousProxy {
1577    type Proxy = RecoveryProxy;
1578    type Protocol = RecoveryMarker;
1579
1580    fn from_channel(inner: fidl::Channel) -> Self {
1581        Self::new(inner)
1582    }
1583
1584    fn into_channel(self) -> fidl::Channel {
1585        self.client.into_channel()
1586    }
1587
1588    fn as_channel(&self) -> &fidl::Channel {
1589        self.client.as_channel()
1590    }
1591}
1592
1593#[cfg(target_os = "fuchsia")]
1594impl RecoverySynchronousProxy {
1595    pub fn new(channel: fidl::Channel) -> Self {
1596        let protocol_name = <RecoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1597        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1598    }
1599
1600    pub fn into_channel(self) -> fidl::Channel {
1601        self.client.into_channel()
1602    }
1603
1604    /// Waits until an event arrives and returns it. It is safe for other
1605    /// threads to make concurrent requests while waiting for an event.
1606    pub fn wait_for_event(
1607        &self,
1608        deadline: zx::MonotonicInstant,
1609    ) -> Result<RecoveryEvent, fidl::Error> {
1610        RecoveryEvent::decode(self.client.wait_for_event(deadline)?)
1611    }
1612
1613    /// Wipes and re-initializes the system partition table.  This is a destructive operation!
1614    pub fn r#init_system_partition_table(
1615        &self,
1616        mut partitions: &[fidl_fuchsia_storage_partitions::PartitionInfo],
1617        ___deadline: zx::MonotonicInstant,
1618    ) -> Result<RecoveryInitSystemPartitionTableResult, fidl::Error> {
1619        let _response = self.client.send_query::<
1620            RecoveryInitSystemPartitionTableRequest,
1621            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1622        >(
1623            (partitions,),
1624            0x3dcadcbb75e2330b,
1625            fidl::encoding::DynamicFlags::empty(),
1626            ___deadline,
1627        )?;
1628        Ok(_response.map(|x| x))
1629    }
1630}
1631
1632#[cfg(target_os = "fuchsia")]
1633impl From<RecoverySynchronousProxy> for zx::Handle {
1634    fn from(value: RecoverySynchronousProxy) -> Self {
1635        value.into_channel().into()
1636    }
1637}
1638
1639#[cfg(target_os = "fuchsia")]
1640impl From<fidl::Channel> for RecoverySynchronousProxy {
1641    fn from(value: fidl::Channel) -> Self {
1642        Self::new(value)
1643    }
1644}
1645
1646#[cfg(target_os = "fuchsia")]
1647impl fidl::endpoints::FromClient for RecoverySynchronousProxy {
1648    type Protocol = RecoveryMarker;
1649
1650    fn from_client(value: fidl::endpoints::ClientEnd<RecoveryMarker>) -> Self {
1651        Self::new(value.into_channel())
1652    }
1653}
1654
1655#[derive(Debug, Clone)]
1656pub struct RecoveryProxy {
1657    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1658}
1659
1660impl fidl::endpoints::Proxy for RecoveryProxy {
1661    type Protocol = RecoveryMarker;
1662
1663    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1664        Self::new(inner)
1665    }
1666
1667    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1668        self.client.into_channel().map_err(|client| Self { client })
1669    }
1670
1671    fn as_channel(&self) -> &::fidl::AsyncChannel {
1672        self.client.as_channel()
1673    }
1674}
1675
1676impl RecoveryProxy {
1677    /// Create a new Proxy for fuchsia.fshost/Recovery.
1678    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1679        let protocol_name = <RecoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1680        Self { client: fidl::client::Client::new(channel, protocol_name) }
1681    }
1682
1683    /// Get a Stream of events from the remote end of the protocol.
1684    ///
1685    /// # Panics
1686    ///
1687    /// Panics if the event stream was already taken.
1688    pub fn take_event_stream(&self) -> RecoveryEventStream {
1689        RecoveryEventStream { event_receiver: self.client.take_event_receiver() }
1690    }
1691
1692    /// Wipes and re-initializes the system partition table.  This is a destructive operation!
1693    pub fn r#init_system_partition_table(
1694        &self,
1695        mut partitions: &[fidl_fuchsia_storage_partitions::PartitionInfo],
1696    ) -> fidl::client::QueryResponseFut<
1697        RecoveryInitSystemPartitionTableResult,
1698        fidl::encoding::DefaultFuchsiaResourceDialect,
1699    > {
1700        RecoveryProxyInterface::r#init_system_partition_table(self, partitions)
1701    }
1702}
1703
1704impl RecoveryProxyInterface for RecoveryProxy {
1705    type InitSystemPartitionTableResponseFut = fidl::client::QueryResponseFut<
1706        RecoveryInitSystemPartitionTableResult,
1707        fidl::encoding::DefaultFuchsiaResourceDialect,
1708    >;
1709    fn r#init_system_partition_table(
1710        &self,
1711        mut partitions: &[fidl_fuchsia_storage_partitions::PartitionInfo],
1712    ) -> Self::InitSystemPartitionTableResponseFut {
1713        fn _decode(
1714            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1715        ) -> Result<RecoveryInitSystemPartitionTableResult, fidl::Error> {
1716            let _response = fidl::client::decode_transaction_body::<
1717                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1718                fidl::encoding::DefaultFuchsiaResourceDialect,
1719                0x3dcadcbb75e2330b,
1720            >(_buf?)?;
1721            Ok(_response.map(|x| x))
1722        }
1723        self.client.send_query_and_decode::<
1724            RecoveryInitSystemPartitionTableRequest,
1725            RecoveryInitSystemPartitionTableResult,
1726        >(
1727            (partitions,),
1728            0x3dcadcbb75e2330b,
1729            fidl::encoding::DynamicFlags::empty(),
1730            _decode,
1731        )
1732    }
1733}
1734
1735pub struct RecoveryEventStream {
1736    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1737}
1738
1739impl std::marker::Unpin for RecoveryEventStream {}
1740
1741impl futures::stream::FusedStream for RecoveryEventStream {
1742    fn is_terminated(&self) -> bool {
1743        self.event_receiver.is_terminated()
1744    }
1745}
1746
1747impl futures::Stream for RecoveryEventStream {
1748    type Item = Result<RecoveryEvent, fidl::Error>;
1749
1750    fn poll_next(
1751        mut self: std::pin::Pin<&mut Self>,
1752        cx: &mut std::task::Context<'_>,
1753    ) -> std::task::Poll<Option<Self::Item>> {
1754        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1755            &mut self.event_receiver,
1756            cx
1757        )?) {
1758            Some(buf) => std::task::Poll::Ready(Some(RecoveryEvent::decode(buf))),
1759            None => std::task::Poll::Ready(None),
1760        }
1761    }
1762}
1763
1764#[derive(Debug)]
1765pub enum RecoveryEvent {}
1766
1767impl RecoveryEvent {
1768    /// Decodes a message buffer as a [`RecoveryEvent`].
1769    fn decode(
1770        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1771    ) -> Result<RecoveryEvent, fidl::Error> {
1772        let (bytes, _handles) = buf.split_mut();
1773        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1774        debug_assert_eq!(tx_header.tx_id, 0);
1775        match tx_header.ordinal {
1776            _ => Err(fidl::Error::UnknownOrdinal {
1777                ordinal: tx_header.ordinal,
1778                protocol_name: <RecoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1779            }),
1780        }
1781    }
1782}
1783
1784/// A Stream of incoming requests for fuchsia.fshost/Recovery.
1785pub struct RecoveryRequestStream {
1786    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1787    is_terminated: bool,
1788}
1789
1790impl std::marker::Unpin for RecoveryRequestStream {}
1791
1792impl futures::stream::FusedStream for RecoveryRequestStream {
1793    fn is_terminated(&self) -> bool {
1794        self.is_terminated
1795    }
1796}
1797
1798impl fidl::endpoints::RequestStream for RecoveryRequestStream {
1799    type Protocol = RecoveryMarker;
1800    type ControlHandle = RecoveryControlHandle;
1801
1802    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1803        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1804    }
1805
1806    fn control_handle(&self) -> Self::ControlHandle {
1807        RecoveryControlHandle { inner: self.inner.clone() }
1808    }
1809
1810    fn into_inner(
1811        self,
1812    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1813    {
1814        (self.inner, self.is_terminated)
1815    }
1816
1817    fn from_inner(
1818        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1819        is_terminated: bool,
1820    ) -> Self {
1821        Self { inner, is_terminated }
1822    }
1823}
1824
1825impl futures::Stream for RecoveryRequestStream {
1826    type Item = Result<RecoveryRequest, fidl::Error>;
1827
1828    fn poll_next(
1829        mut self: std::pin::Pin<&mut Self>,
1830        cx: &mut std::task::Context<'_>,
1831    ) -> std::task::Poll<Option<Self::Item>> {
1832        let this = &mut *self;
1833        if this.inner.check_shutdown(cx) {
1834            this.is_terminated = true;
1835            return std::task::Poll::Ready(None);
1836        }
1837        if this.is_terminated {
1838            panic!("polled RecoveryRequestStream after completion");
1839        }
1840        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1841            |bytes, handles| {
1842                match this.inner.channel().read_etc(cx, bytes, handles) {
1843                    std::task::Poll::Ready(Ok(())) => {}
1844                    std::task::Poll::Pending => return std::task::Poll::Pending,
1845                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1846                        this.is_terminated = true;
1847                        return std::task::Poll::Ready(None);
1848                    }
1849                    std::task::Poll::Ready(Err(e)) => {
1850                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1851                            e.into(),
1852                        ))))
1853                    }
1854                }
1855
1856                // A message has been received from the channel
1857                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1858
1859                std::task::Poll::Ready(Some(match header.ordinal {
1860                    0x3dcadcbb75e2330b => {
1861                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1862                        let mut req = fidl::new_empty!(
1863                            RecoveryInitSystemPartitionTableRequest,
1864                            fidl::encoding::DefaultFuchsiaResourceDialect
1865                        );
1866                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RecoveryInitSystemPartitionTableRequest>(&header, _body_bytes, handles, &mut req)?;
1867                        let control_handle = RecoveryControlHandle { inner: this.inner.clone() };
1868                        Ok(RecoveryRequest::InitSystemPartitionTable {
1869                            partitions: req.partitions,
1870
1871                            responder: RecoveryInitSystemPartitionTableResponder {
1872                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1873                                tx_id: header.tx_id,
1874                            },
1875                        })
1876                    }
1877                    _ => Err(fidl::Error::UnknownOrdinal {
1878                        ordinal: header.ordinal,
1879                        protocol_name:
1880                            <RecoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1881                    }),
1882                }))
1883            },
1884        )
1885    }
1886}
1887
1888/// Special functionality that is only intended to be used in recovery and device bringup.  All
1889/// methods require fuchsia.fshost.Netboot to be set, unless otherwise indicated.
1890#[derive(Debug)]
1891pub enum RecoveryRequest {
1892    /// Wipes and re-initializes the system partition table.  This is a destructive operation!
1893    InitSystemPartitionTable {
1894        partitions: Vec<fidl_fuchsia_storage_partitions::PartitionInfo>,
1895        responder: RecoveryInitSystemPartitionTableResponder,
1896    },
1897}
1898
1899impl RecoveryRequest {
1900    #[allow(irrefutable_let_patterns)]
1901    pub fn into_init_system_partition_table(
1902        self,
1903    ) -> Option<(
1904        Vec<fidl_fuchsia_storage_partitions::PartitionInfo>,
1905        RecoveryInitSystemPartitionTableResponder,
1906    )> {
1907        if let RecoveryRequest::InitSystemPartitionTable { partitions, responder } = self {
1908            Some((partitions, responder))
1909        } else {
1910            None
1911        }
1912    }
1913
1914    /// Name of the method defined in FIDL
1915    pub fn method_name(&self) -> &'static str {
1916        match *self {
1917            RecoveryRequest::InitSystemPartitionTable { .. } => "init_system_partition_table",
1918        }
1919    }
1920}
1921
1922#[derive(Debug, Clone)]
1923pub struct RecoveryControlHandle {
1924    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1925}
1926
1927impl fidl::endpoints::ControlHandle for RecoveryControlHandle {
1928    fn shutdown(&self) {
1929        self.inner.shutdown()
1930    }
1931    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1932        self.inner.shutdown_with_epitaph(status)
1933    }
1934
1935    fn is_closed(&self) -> bool {
1936        self.inner.channel().is_closed()
1937    }
1938    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1939        self.inner.channel().on_closed()
1940    }
1941
1942    #[cfg(target_os = "fuchsia")]
1943    fn signal_peer(
1944        &self,
1945        clear_mask: zx::Signals,
1946        set_mask: zx::Signals,
1947    ) -> Result<(), zx_status::Status> {
1948        use fidl::Peered;
1949        self.inner.channel().signal_peer(clear_mask, set_mask)
1950    }
1951}
1952
1953impl RecoveryControlHandle {}
1954
1955#[must_use = "FIDL methods require a response to be sent"]
1956#[derive(Debug)]
1957pub struct RecoveryInitSystemPartitionTableResponder {
1958    control_handle: std::mem::ManuallyDrop<RecoveryControlHandle>,
1959    tx_id: u32,
1960}
1961
1962/// Set the the channel to be shutdown (see [`RecoveryControlHandle::shutdown`])
1963/// if the responder is dropped without sending a response, so that the client
1964/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1965impl std::ops::Drop for RecoveryInitSystemPartitionTableResponder {
1966    fn drop(&mut self) {
1967        self.control_handle.shutdown();
1968        // Safety: drops once, never accessed again
1969        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1970    }
1971}
1972
1973impl fidl::endpoints::Responder for RecoveryInitSystemPartitionTableResponder {
1974    type ControlHandle = RecoveryControlHandle;
1975
1976    fn control_handle(&self) -> &RecoveryControlHandle {
1977        &self.control_handle
1978    }
1979
1980    fn drop_without_shutdown(mut self) {
1981        // Safety: drops once, never accessed again due to mem::forget
1982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1983        // Prevent Drop from running (which would shut down the channel)
1984        std::mem::forget(self);
1985    }
1986}
1987
1988impl RecoveryInitSystemPartitionTableResponder {
1989    /// Sends a response to the FIDL transaction.
1990    ///
1991    /// Sets the channel to shutdown if an error occurs.
1992    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1993        let _result = self.send_raw(result);
1994        if _result.is_err() {
1995            self.control_handle.shutdown();
1996        }
1997        self.drop_without_shutdown();
1998        _result
1999    }
2000
2001    /// Similar to "send" but does not shutdown the channel if an error occurs.
2002    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2003        let _result = self.send_raw(result);
2004        self.drop_without_shutdown();
2005        _result
2006    }
2007
2008    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2009        self.control_handle
2010            .inner
2011            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2012                result,
2013                self.tx_id,
2014                0x3dcadcbb75e2330b,
2015                fidl::encoding::DynamicFlags::empty(),
2016            )
2017    }
2018}
2019
2020#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2021pub struct StarnixVolumeProviderMarker;
2022
2023impl fidl::endpoints::ProtocolMarker for StarnixVolumeProviderMarker {
2024    type Proxy = StarnixVolumeProviderProxy;
2025    type RequestStream = StarnixVolumeProviderRequestStream;
2026    #[cfg(target_os = "fuchsia")]
2027    type SynchronousProxy = StarnixVolumeProviderSynchronousProxy;
2028
2029    const DEBUG_NAME: &'static str = "fuchsia.fshost.StarnixVolumeProvider";
2030}
2031impl fidl::endpoints::DiscoverableProtocolMarker for StarnixVolumeProviderMarker {}
2032pub type StarnixVolumeProviderMountResult = Result<(), i32>;
2033pub type StarnixVolumeProviderCreateResult = Result<(), i32>;
2034pub type StarnixVolumeProviderUnmountResult = Result<(), i32>;
2035
2036pub trait StarnixVolumeProviderProxyInterface: Send + Sync {
2037    type MountResponseFut: std::future::Future<Output = Result<StarnixVolumeProviderMountResult, fidl::Error>>
2038        + Send;
2039    fn r#mount(
2040        &self,
2041        crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2042        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2043    ) -> Self::MountResponseFut;
2044    type CreateResponseFut: std::future::Future<Output = Result<StarnixVolumeProviderCreateResult, fidl::Error>>
2045        + Send;
2046    fn r#create(
2047        &self,
2048        crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2049        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2050    ) -> Self::CreateResponseFut;
2051    type UnmountResponseFut: std::future::Future<Output = Result<StarnixVolumeProviderUnmountResult, fidl::Error>>
2052        + Send;
2053    fn r#unmount(&self) -> Self::UnmountResponseFut;
2054}
2055#[derive(Debug)]
2056#[cfg(target_os = "fuchsia")]
2057pub struct StarnixVolumeProviderSynchronousProxy {
2058    client: fidl::client::sync::Client,
2059}
2060
2061#[cfg(target_os = "fuchsia")]
2062impl fidl::endpoints::SynchronousProxy for StarnixVolumeProviderSynchronousProxy {
2063    type Proxy = StarnixVolumeProviderProxy;
2064    type Protocol = StarnixVolumeProviderMarker;
2065
2066    fn from_channel(inner: fidl::Channel) -> Self {
2067        Self::new(inner)
2068    }
2069
2070    fn into_channel(self) -> fidl::Channel {
2071        self.client.into_channel()
2072    }
2073
2074    fn as_channel(&self) -> &fidl::Channel {
2075        self.client.as_channel()
2076    }
2077}
2078
2079#[cfg(target_os = "fuchsia")]
2080impl StarnixVolumeProviderSynchronousProxy {
2081    pub fn new(channel: fidl::Channel) -> Self {
2082        let protocol_name =
2083            <StarnixVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2084        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2085    }
2086
2087    pub fn into_channel(self) -> fidl::Channel {
2088        self.client.into_channel()
2089    }
2090
2091    /// Waits until an event arrives and returns it. It is safe for other
2092    /// threads to make concurrent requests while waiting for an event.
2093    pub fn wait_for_event(
2094        &self,
2095        deadline: zx::MonotonicInstant,
2096    ) -> Result<StarnixVolumeProviderEvent, fidl::Error> {
2097        StarnixVolumeProviderEvent::decode(self.client.wait_for_event(deadline)?)
2098    }
2099
2100    /// Mounts the main starnix volume using `crypt`. `exposed_dir` will be connected to the
2101    /// exposed directory of the mounted starnix volume. Silently creates the volume if it does
2102    /// not already exist.
2103    pub fn r#mount(
2104        &self,
2105        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2106        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2107        ___deadline: zx::MonotonicInstant,
2108    ) -> Result<StarnixVolumeProviderMountResult, fidl::Error> {
2109        let _response = self.client.send_query::<
2110            StarnixVolumeProviderMountRequest,
2111            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2112        >(
2113            (crypt, exposed_dir,),
2114            0x62ae75763dde5af6,
2115            fidl::encoding::DynamicFlags::empty(),
2116            ___deadline,
2117        )?;
2118        Ok(_response.map(|x| x))
2119    }
2120
2121    /// Creates and mounts the main starnix volume using `crypt`. If the volume already exists,
2122    /// unmount and delete the volume before creating the new one. `exposed_dir` will be connected
2123    /// to the exposed directory of the mounted starnix volume.
2124    pub fn r#create(
2125        &self,
2126        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2127        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2128        ___deadline: zx::MonotonicInstant,
2129    ) -> Result<StarnixVolumeProviderCreateResult, fidl::Error> {
2130        let _response = self.client.send_query::<
2131            StarnixVolumeProviderCreateRequest,
2132            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2133        >(
2134            (crypt, exposed_dir,),
2135            0x1f172ca81a8da7c4,
2136            fidl::encoding::DynamicFlags::empty(),
2137            ___deadline,
2138        )?;
2139        Ok(_response.map(|x| x))
2140    }
2141
2142    /// Shuts down the main starnix volume. Fails if the starnix volume was not mounted.
2143    pub fn r#unmount(
2144        &self,
2145        ___deadline: zx::MonotonicInstant,
2146    ) -> Result<StarnixVolumeProviderUnmountResult, fidl::Error> {
2147        let _response = self.client.send_query::<
2148            fidl::encoding::EmptyPayload,
2149            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2150        >(
2151            (),
2152            0x5eacc7e034a09a1b,
2153            fidl::encoding::DynamicFlags::empty(),
2154            ___deadline,
2155        )?;
2156        Ok(_response.map(|x| x))
2157    }
2158}
2159
2160#[cfg(target_os = "fuchsia")]
2161impl From<StarnixVolumeProviderSynchronousProxy> for zx::Handle {
2162    fn from(value: StarnixVolumeProviderSynchronousProxy) -> Self {
2163        value.into_channel().into()
2164    }
2165}
2166
2167#[cfg(target_os = "fuchsia")]
2168impl From<fidl::Channel> for StarnixVolumeProviderSynchronousProxy {
2169    fn from(value: fidl::Channel) -> Self {
2170        Self::new(value)
2171    }
2172}
2173
2174#[cfg(target_os = "fuchsia")]
2175impl fidl::endpoints::FromClient for StarnixVolumeProviderSynchronousProxy {
2176    type Protocol = StarnixVolumeProviderMarker;
2177
2178    fn from_client(value: fidl::endpoints::ClientEnd<StarnixVolumeProviderMarker>) -> Self {
2179        Self::new(value.into_channel())
2180    }
2181}
2182
2183#[derive(Debug, Clone)]
2184pub struct StarnixVolumeProviderProxy {
2185    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2186}
2187
2188impl fidl::endpoints::Proxy for StarnixVolumeProviderProxy {
2189    type Protocol = StarnixVolumeProviderMarker;
2190
2191    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2192        Self::new(inner)
2193    }
2194
2195    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2196        self.client.into_channel().map_err(|client| Self { client })
2197    }
2198
2199    fn as_channel(&self) -> &::fidl::AsyncChannel {
2200        self.client.as_channel()
2201    }
2202}
2203
2204impl StarnixVolumeProviderProxy {
2205    /// Create a new Proxy for fuchsia.fshost/StarnixVolumeProvider.
2206    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2207        let protocol_name =
2208            <StarnixVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2209        Self { client: fidl::client::Client::new(channel, protocol_name) }
2210    }
2211
2212    /// Get a Stream of events from the remote end of the protocol.
2213    ///
2214    /// # Panics
2215    ///
2216    /// Panics if the event stream was already taken.
2217    pub fn take_event_stream(&self) -> StarnixVolumeProviderEventStream {
2218        StarnixVolumeProviderEventStream { event_receiver: self.client.take_event_receiver() }
2219    }
2220
2221    /// Mounts the main starnix volume using `crypt`. `exposed_dir` will be connected to the
2222    /// exposed directory of the mounted starnix volume. Silently creates the volume if it does
2223    /// not already exist.
2224    pub fn r#mount(
2225        &self,
2226        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2227        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2228    ) -> fidl::client::QueryResponseFut<
2229        StarnixVolumeProviderMountResult,
2230        fidl::encoding::DefaultFuchsiaResourceDialect,
2231    > {
2232        StarnixVolumeProviderProxyInterface::r#mount(self, crypt, exposed_dir)
2233    }
2234
2235    /// Creates and mounts the main starnix volume using `crypt`. If the volume already exists,
2236    /// unmount and delete the volume before creating the new one. `exposed_dir` will be connected
2237    /// to the exposed directory of the mounted starnix volume.
2238    pub fn r#create(
2239        &self,
2240        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2241        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2242    ) -> fidl::client::QueryResponseFut<
2243        StarnixVolumeProviderCreateResult,
2244        fidl::encoding::DefaultFuchsiaResourceDialect,
2245    > {
2246        StarnixVolumeProviderProxyInterface::r#create(self, crypt, exposed_dir)
2247    }
2248
2249    /// Shuts down the main starnix volume. Fails if the starnix volume was not mounted.
2250    pub fn r#unmount(
2251        &self,
2252    ) -> fidl::client::QueryResponseFut<
2253        StarnixVolumeProviderUnmountResult,
2254        fidl::encoding::DefaultFuchsiaResourceDialect,
2255    > {
2256        StarnixVolumeProviderProxyInterface::r#unmount(self)
2257    }
2258}
2259
2260impl StarnixVolumeProviderProxyInterface for StarnixVolumeProviderProxy {
2261    type MountResponseFut = fidl::client::QueryResponseFut<
2262        StarnixVolumeProviderMountResult,
2263        fidl::encoding::DefaultFuchsiaResourceDialect,
2264    >;
2265    fn r#mount(
2266        &self,
2267        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2268        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2269    ) -> Self::MountResponseFut {
2270        fn _decode(
2271            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2272        ) -> Result<StarnixVolumeProviderMountResult, fidl::Error> {
2273            let _response = fidl::client::decode_transaction_body::<
2274                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2275                fidl::encoding::DefaultFuchsiaResourceDialect,
2276                0x62ae75763dde5af6,
2277            >(_buf?)?;
2278            Ok(_response.map(|x| x))
2279        }
2280        self.client.send_query_and_decode::<
2281            StarnixVolumeProviderMountRequest,
2282            StarnixVolumeProviderMountResult,
2283        >(
2284            (crypt, exposed_dir,),
2285            0x62ae75763dde5af6,
2286            fidl::encoding::DynamicFlags::empty(),
2287            _decode,
2288        )
2289    }
2290
2291    type CreateResponseFut = fidl::client::QueryResponseFut<
2292        StarnixVolumeProviderCreateResult,
2293        fidl::encoding::DefaultFuchsiaResourceDialect,
2294    >;
2295    fn r#create(
2296        &self,
2297        mut crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2298        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2299    ) -> Self::CreateResponseFut {
2300        fn _decode(
2301            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2302        ) -> Result<StarnixVolumeProviderCreateResult, fidl::Error> {
2303            let _response = fidl::client::decode_transaction_body::<
2304                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2305                fidl::encoding::DefaultFuchsiaResourceDialect,
2306                0x1f172ca81a8da7c4,
2307            >(_buf?)?;
2308            Ok(_response.map(|x| x))
2309        }
2310        self.client.send_query_and_decode::<
2311            StarnixVolumeProviderCreateRequest,
2312            StarnixVolumeProviderCreateResult,
2313        >(
2314            (crypt, exposed_dir,),
2315            0x1f172ca81a8da7c4,
2316            fidl::encoding::DynamicFlags::empty(),
2317            _decode,
2318        )
2319    }
2320
2321    type UnmountResponseFut = fidl::client::QueryResponseFut<
2322        StarnixVolumeProviderUnmountResult,
2323        fidl::encoding::DefaultFuchsiaResourceDialect,
2324    >;
2325    fn r#unmount(&self) -> Self::UnmountResponseFut {
2326        fn _decode(
2327            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2328        ) -> Result<StarnixVolumeProviderUnmountResult, fidl::Error> {
2329            let _response = fidl::client::decode_transaction_body::<
2330                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2331                fidl::encoding::DefaultFuchsiaResourceDialect,
2332                0x5eacc7e034a09a1b,
2333            >(_buf?)?;
2334            Ok(_response.map(|x| x))
2335        }
2336        self.client.send_query_and_decode::<
2337            fidl::encoding::EmptyPayload,
2338            StarnixVolumeProviderUnmountResult,
2339        >(
2340            (),
2341            0x5eacc7e034a09a1b,
2342            fidl::encoding::DynamicFlags::empty(),
2343            _decode,
2344        )
2345    }
2346}
2347
2348pub struct StarnixVolumeProviderEventStream {
2349    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2350}
2351
2352impl std::marker::Unpin for StarnixVolumeProviderEventStream {}
2353
2354impl futures::stream::FusedStream for StarnixVolumeProviderEventStream {
2355    fn is_terminated(&self) -> bool {
2356        self.event_receiver.is_terminated()
2357    }
2358}
2359
2360impl futures::Stream for StarnixVolumeProviderEventStream {
2361    type Item = Result<StarnixVolumeProviderEvent, fidl::Error>;
2362
2363    fn poll_next(
2364        mut self: std::pin::Pin<&mut Self>,
2365        cx: &mut std::task::Context<'_>,
2366    ) -> std::task::Poll<Option<Self::Item>> {
2367        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2368            &mut self.event_receiver,
2369            cx
2370        )?) {
2371            Some(buf) => std::task::Poll::Ready(Some(StarnixVolumeProviderEvent::decode(buf))),
2372            None => std::task::Poll::Ready(None),
2373        }
2374    }
2375}
2376
2377#[derive(Debug)]
2378pub enum StarnixVolumeProviderEvent {}
2379
2380impl StarnixVolumeProviderEvent {
2381    /// Decodes a message buffer as a [`StarnixVolumeProviderEvent`].
2382    fn decode(
2383        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2384    ) -> Result<StarnixVolumeProviderEvent, fidl::Error> {
2385        let (bytes, _handles) = buf.split_mut();
2386        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2387        debug_assert_eq!(tx_header.tx_id, 0);
2388        match tx_header.ordinal {
2389            _ => Err(fidl::Error::UnknownOrdinal {
2390                ordinal: tx_header.ordinal,
2391                protocol_name:
2392                    <StarnixVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2393            }),
2394        }
2395    }
2396}
2397
2398/// A Stream of incoming requests for fuchsia.fshost/StarnixVolumeProvider.
2399pub struct StarnixVolumeProviderRequestStream {
2400    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2401    is_terminated: bool,
2402}
2403
2404impl std::marker::Unpin for StarnixVolumeProviderRequestStream {}
2405
2406impl futures::stream::FusedStream for StarnixVolumeProviderRequestStream {
2407    fn is_terminated(&self) -> bool {
2408        self.is_terminated
2409    }
2410}
2411
2412impl fidl::endpoints::RequestStream for StarnixVolumeProviderRequestStream {
2413    type Protocol = StarnixVolumeProviderMarker;
2414    type ControlHandle = StarnixVolumeProviderControlHandle;
2415
2416    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2417        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2418    }
2419
2420    fn control_handle(&self) -> Self::ControlHandle {
2421        StarnixVolumeProviderControlHandle { inner: self.inner.clone() }
2422    }
2423
2424    fn into_inner(
2425        self,
2426    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2427    {
2428        (self.inner, self.is_terminated)
2429    }
2430
2431    fn from_inner(
2432        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2433        is_terminated: bool,
2434    ) -> Self {
2435        Self { inner, is_terminated }
2436    }
2437}
2438
2439impl futures::Stream for StarnixVolumeProviderRequestStream {
2440    type Item = Result<StarnixVolumeProviderRequest, fidl::Error>;
2441
2442    fn poll_next(
2443        mut self: std::pin::Pin<&mut Self>,
2444        cx: &mut std::task::Context<'_>,
2445    ) -> std::task::Poll<Option<Self::Item>> {
2446        let this = &mut *self;
2447        if this.inner.check_shutdown(cx) {
2448            this.is_terminated = true;
2449            return std::task::Poll::Ready(None);
2450        }
2451        if this.is_terminated {
2452            panic!("polled StarnixVolumeProviderRequestStream after completion");
2453        }
2454        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2455            |bytes, handles| {
2456                match this.inner.channel().read_etc(cx, bytes, handles) {
2457                    std::task::Poll::Ready(Ok(())) => {}
2458                    std::task::Poll::Pending => return std::task::Poll::Pending,
2459                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2460                        this.is_terminated = true;
2461                        return std::task::Poll::Ready(None);
2462                    }
2463                    std::task::Poll::Ready(Err(e)) => {
2464                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2465                            e.into(),
2466                        ))))
2467                    }
2468                }
2469
2470                // A message has been received from the channel
2471                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2472
2473                std::task::Poll::Ready(Some(match header.ordinal {
2474                0x62ae75763dde5af6 => {
2475                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2476                    let mut req = fidl::new_empty!(StarnixVolumeProviderMountRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2477                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StarnixVolumeProviderMountRequest>(&header, _body_bytes, handles, &mut req)?;
2478                    let control_handle = StarnixVolumeProviderControlHandle {
2479                        inner: this.inner.clone(),
2480                    };
2481                    Ok(StarnixVolumeProviderRequest::Mount {crypt: req.crypt,
2482exposed_dir: req.exposed_dir,
2483
2484                        responder: StarnixVolumeProviderMountResponder {
2485                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2486                            tx_id: header.tx_id,
2487                        },
2488                    })
2489                }
2490                0x1f172ca81a8da7c4 => {
2491                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2492                    let mut req = fidl::new_empty!(StarnixVolumeProviderCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2493                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StarnixVolumeProviderCreateRequest>(&header, _body_bytes, handles, &mut req)?;
2494                    let control_handle = StarnixVolumeProviderControlHandle {
2495                        inner: this.inner.clone(),
2496                    };
2497                    Ok(StarnixVolumeProviderRequest::Create {crypt: req.crypt,
2498exposed_dir: req.exposed_dir,
2499
2500                        responder: StarnixVolumeProviderCreateResponder {
2501                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2502                            tx_id: header.tx_id,
2503                        },
2504                    })
2505                }
2506                0x5eacc7e034a09a1b => {
2507                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2508                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2509                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2510                    let control_handle = StarnixVolumeProviderControlHandle {
2511                        inner: this.inner.clone(),
2512                    };
2513                    Ok(StarnixVolumeProviderRequest::Unmount {
2514                        responder: StarnixVolumeProviderUnmountResponder {
2515                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2516                            tx_id: header.tx_id,
2517                        },
2518                    })
2519                }
2520                _ => Err(fidl::Error::UnknownOrdinal {
2521                    ordinal: header.ordinal,
2522                    protocol_name: <StarnixVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2523                }),
2524            }))
2525            },
2526        )
2527    }
2528}
2529
2530/// Provides access to the volume which will be used by Starnix to store its data.
2531#[derive(Debug)]
2532pub enum StarnixVolumeProviderRequest {
2533    /// Mounts the main starnix volume using `crypt`. `exposed_dir` will be connected to the
2534    /// exposed directory of the mounted starnix volume. Silently creates the volume if it does
2535    /// not already exist.
2536    Mount {
2537        crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2538        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2539        responder: StarnixVolumeProviderMountResponder,
2540    },
2541    /// Creates and mounts the main starnix volume using `crypt`. If the volume already exists,
2542    /// unmount and delete the volume before creating the new one. `exposed_dir` will be connected
2543    /// to the exposed directory of the mounted starnix volume.
2544    Create {
2545        crypt: fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2546        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2547        responder: StarnixVolumeProviderCreateResponder,
2548    },
2549    /// Shuts down the main starnix volume. Fails if the starnix volume was not mounted.
2550    Unmount { responder: StarnixVolumeProviderUnmountResponder },
2551}
2552
2553impl StarnixVolumeProviderRequest {
2554    #[allow(irrefutable_let_patterns)]
2555    pub fn into_mount(
2556        self,
2557    ) -> Option<(
2558        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2559        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2560        StarnixVolumeProviderMountResponder,
2561    )> {
2562        if let StarnixVolumeProviderRequest::Mount { crypt, exposed_dir, responder } = self {
2563            Some((crypt, exposed_dir, responder))
2564        } else {
2565            None
2566        }
2567    }
2568
2569    #[allow(irrefutable_let_patterns)]
2570    pub fn into_create(
2571        self,
2572    ) -> Option<(
2573        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
2574        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2575        StarnixVolumeProviderCreateResponder,
2576    )> {
2577        if let StarnixVolumeProviderRequest::Create { crypt, exposed_dir, responder } = self {
2578            Some((crypt, exposed_dir, responder))
2579        } else {
2580            None
2581        }
2582    }
2583
2584    #[allow(irrefutable_let_patterns)]
2585    pub fn into_unmount(self) -> Option<(StarnixVolumeProviderUnmountResponder)> {
2586        if let StarnixVolumeProviderRequest::Unmount { responder } = self {
2587            Some((responder))
2588        } else {
2589            None
2590        }
2591    }
2592
2593    /// Name of the method defined in FIDL
2594    pub fn method_name(&self) -> &'static str {
2595        match *self {
2596            StarnixVolumeProviderRequest::Mount { .. } => "mount",
2597            StarnixVolumeProviderRequest::Create { .. } => "create",
2598            StarnixVolumeProviderRequest::Unmount { .. } => "unmount",
2599        }
2600    }
2601}
2602
2603#[derive(Debug, Clone)]
2604pub struct StarnixVolumeProviderControlHandle {
2605    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2606}
2607
2608impl fidl::endpoints::ControlHandle for StarnixVolumeProviderControlHandle {
2609    fn shutdown(&self) {
2610        self.inner.shutdown()
2611    }
2612    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2613        self.inner.shutdown_with_epitaph(status)
2614    }
2615
2616    fn is_closed(&self) -> bool {
2617        self.inner.channel().is_closed()
2618    }
2619    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2620        self.inner.channel().on_closed()
2621    }
2622
2623    #[cfg(target_os = "fuchsia")]
2624    fn signal_peer(
2625        &self,
2626        clear_mask: zx::Signals,
2627        set_mask: zx::Signals,
2628    ) -> Result<(), zx_status::Status> {
2629        use fidl::Peered;
2630        self.inner.channel().signal_peer(clear_mask, set_mask)
2631    }
2632}
2633
2634impl StarnixVolumeProviderControlHandle {}
2635
2636#[must_use = "FIDL methods require a response to be sent"]
2637#[derive(Debug)]
2638pub struct StarnixVolumeProviderMountResponder {
2639    control_handle: std::mem::ManuallyDrop<StarnixVolumeProviderControlHandle>,
2640    tx_id: u32,
2641}
2642
2643/// Set the the channel to be shutdown (see [`StarnixVolumeProviderControlHandle::shutdown`])
2644/// if the responder is dropped without sending a response, so that the client
2645/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2646impl std::ops::Drop for StarnixVolumeProviderMountResponder {
2647    fn drop(&mut self) {
2648        self.control_handle.shutdown();
2649        // Safety: drops once, never accessed again
2650        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2651    }
2652}
2653
2654impl fidl::endpoints::Responder for StarnixVolumeProviderMountResponder {
2655    type ControlHandle = StarnixVolumeProviderControlHandle;
2656
2657    fn control_handle(&self) -> &StarnixVolumeProviderControlHandle {
2658        &self.control_handle
2659    }
2660
2661    fn drop_without_shutdown(mut self) {
2662        // Safety: drops once, never accessed again due to mem::forget
2663        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2664        // Prevent Drop from running (which would shut down the channel)
2665        std::mem::forget(self);
2666    }
2667}
2668
2669impl StarnixVolumeProviderMountResponder {
2670    /// Sends a response to the FIDL transaction.
2671    ///
2672    /// Sets the channel to shutdown if an error occurs.
2673    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2674        let _result = self.send_raw(result);
2675        if _result.is_err() {
2676            self.control_handle.shutdown();
2677        }
2678        self.drop_without_shutdown();
2679        _result
2680    }
2681
2682    /// Similar to "send" but does not shutdown the channel if an error occurs.
2683    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2684        let _result = self.send_raw(result);
2685        self.drop_without_shutdown();
2686        _result
2687    }
2688
2689    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2690        self.control_handle
2691            .inner
2692            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2693                result,
2694                self.tx_id,
2695                0x62ae75763dde5af6,
2696                fidl::encoding::DynamicFlags::empty(),
2697            )
2698    }
2699}
2700
2701#[must_use = "FIDL methods require a response to be sent"]
2702#[derive(Debug)]
2703pub struct StarnixVolumeProviderCreateResponder {
2704    control_handle: std::mem::ManuallyDrop<StarnixVolumeProviderControlHandle>,
2705    tx_id: u32,
2706}
2707
2708/// Set the the channel to be shutdown (see [`StarnixVolumeProviderControlHandle::shutdown`])
2709/// if the responder is dropped without sending a response, so that the client
2710/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2711impl std::ops::Drop for StarnixVolumeProviderCreateResponder {
2712    fn drop(&mut self) {
2713        self.control_handle.shutdown();
2714        // Safety: drops once, never accessed again
2715        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2716    }
2717}
2718
2719impl fidl::endpoints::Responder for StarnixVolumeProviderCreateResponder {
2720    type ControlHandle = StarnixVolumeProviderControlHandle;
2721
2722    fn control_handle(&self) -> &StarnixVolumeProviderControlHandle {
2723        &self.control_handle
2724    }
2725
2726    fn drop_without_shutdown(mut self) {
2727        // Safety: drops once, never accessed again due to mem::forget
2728        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2729        // Prevent Drop from running (which would shut down the channel)
2730        std::mem::forget(self);
2731    }
2732}
2733
2734impl StarnixVolumeProviderCreateResponder {
2735    /// Sends a response to the FIDL transaction.
2736    ///
2737    /// Sets the channel to shutdown if an error occurs.
2738    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2739        let _result = self.send_raw(result);
2740        if _result.is_err() {
2741            self.control_handle.shutdown();
2742        }
2743        self.drop_without_shutdown();
2744        _result
2745    }
2746
2747    /// Similar to "send" but does not shutdown the channel if an error occurs.
2748    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2749        let _result = self.send_raw(result);
2750        self.drop_without_shutdown();
2751        _result
2752    }
2753
2754    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2755        self.control_handle
2756            .inner
2757            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2758                result,
2759                self.tx_id,
2760                0x1f172ca81a8da7c4,
2761                fidl::encoding::DynamicFlags::empty(),
2762            )
2763    }
2764}
2765
2766#[must_use = "FIDL methods require a response to be sent"]
2767#[derive(Debug)]
2768pub struct StarnixVolumeProviderUnmountResponder {
2769    control_handle: std::mem::ManuallyDrop<StarnixVolumeProviderControlHandle>,
2770    tx_id: u32,
2771}
2772
2773/// Set the the channel to be shutdown (see [`StarnixVolumeProviderControlHandle::shutdown`])
2774/// if the responder is dropped without sending a response, so that the client
2775/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2776impl std::ops::Drop for StarnixVolumeProviderUnmountResponder {
2777    fn drop(&mut self) {
2778        self.control_handle.shutdown();
2779        // Safety: drops once, never accessed again
2780        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2781    }
2782}
2783
2784impl fidl::endpoints::Responder for StarnixVolumeProviderUnmountResponder {
2785    type ControlHandle = StarnixVolumeProviderControlHandle;
2786
2787    fn control_handle(&self) -> &StarnixVolumeProviderControlHandle {
2788        &self.control_handle
2789    }
2790
2791    fn drop_without_shutdown(mut self) {
2792        // Safety: drops once, never accessed again due to mem::forget
2793        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2794        // Prevent Drop from running (which would shut down the channel)
2795        std::mem::forget(self);
2796    }
2797}
2798
2799impl StarnixVolumeProviderUnmountResponder {
2800    /// Sends a response to the FIDL transaction.
2801    ///
2802    /// Sets the channel to shutdown if an error occurs.
2803    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2804        let _result = self.send_raw(result);
2805        if _result.is_err() {
2806            self.control_handle.shutdown();
2807        }
2808        self.drop_without_shutdown();
2809        _result
2810    }
2811
2812    /// Similar to "send" but does not shutdown the channel if an error occurs.
2813    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2814        let _result = self.send_raw(result);
2815        self.drop_without_shutdown();
2816        _result
2817    }
2818
2819    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2820        self.control_handle
2821            .inner
2822            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2823                result,
2824                self.tx_id,
2825                0x5eacc7e034a09a1b,
2826                fidl::encoding::DynamicFlags::empty(),
2827            )
2828    }
2829}
2830
2831mod internal {
2832    use super::*;
2833
2834    impl fidl::encoding::ResourceTypeMarker for AdminMountRequest {
2835        type Borrowed<'a> = &'a mut Self;
2836        fn take_or_borrow<'a>(
2837            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2838        ) -> Self::Borrowed<'a> {
2839            value
2840        }
2841    }
2842
2843    unsafe impl fidl::encoding::TypeMarker for AdminMountRequest {
2844        type Owned = Self;
2845
2846        #[inline(always)]
2847        fn inline_align(_context: fidl::encoding::Context) -> usize {
2848            8
2849        }
2850
2851        #[inline(always)]
2852        fn inline_size(_context: fidl::encoding::Context) -> usize {
2853            40
2854        }
2855    }
2856
2857    unsafe impl
2858        fidl::encoding::Encode<AdminMountRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2859        for &mut AdminMountRequest
2860    {
2861        #[inline]
2862        unsafe fn encode(
2863            self,
2864            encoder: &mut fidl::encoding::Encoder<
2865                '_,
2866                fidl::encoding::DefaultFuchsiaResourceDialect,
2867            >,
2868            offset: usize,
2869            _depth: fidl::encoding::Depth,
2870        ) -> fidl::Result<()> {
2871            encoder.debug_check_bounds::<AdminMountRequest>(offset);
2872            // Delegate to tuple encoding.
2873            fidl::encoding::Encode::<AdminMountRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2874                (
2875                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
2876                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
2877                    <MountOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.options),
2878                ),
2879                encoder, offset, _depth
2880            )
2881        }
2882    }
2883    unsafe impl<
2884            T0: fidl::encoding::Encode<
2885                fidl::encoding::Endpoint<
2886                    fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
2887                >,
2888                fidl::encoding::DefaultFuchsiaResourceDialect,
2889            >,
2890            T1: fidl::encoding::Encode<
2891                fidl::encoding::BoundedString<255>,
2892                fidl::encoding::DefaultFuchsiaResourceDialect,
2893            >,
2894            T2: fidl::encoding::Encode<MountOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
2895        >
2896        fidl::encoding::Encode<AdminMountRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2897        for (T0, T1, T2)
2898    {
2899        #[inline]
2900        unsafe fn encode(
2901            self,
2902            encoder: &mut fidl::encoding::Encoder<
2903                '_,
2904                fidl::encoding::DefaultFuchsiaResourceDialect,
2905            >,
2906            offset: usize,
2907            depth: fidl::encoding::Depth,
2908        ) -> fidl::Result<()> {
2909            encoder.debug_check_bounds::<AdminMountRequest>(offset);
2910            // Zero out padding regions. There's no need to apply masks
2911            // because the unmasked parts will be overwritten by fields.
2912            unsafe {
2913                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2914                (ptr as *mut u64).write_unaligned(0);
2915            }
2916            // Write the fields.
2917            self.0.encode(encoder, offset + 0, depth)?;
2918            self.1.encode(encoder, offset + 8, depth)?;
2919            self.2.encode(encoder, offset + 24, depth)?;
2920            Ok(())
2921        }
2922    }
2923
2924    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2925        for AdminMountRequest
2926    {
2927        #[inline(always)]
2928        fn new_empty() -> Self {
2929            Self {
2930                device: fidl::new_empty!(
2931                    fidl::encoding::Endpoint<
2932                        fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
2933                    >,
2934                    fidl::encoding::DefaultFuchsiaResourceDialect
2935                ),
2936                name: fidl::new_empty!(
2937                    fidl::encoding::BoundedString<255>,
2938                    fidl::encoding::DefaultFuchsiaResourceDialect
2939                ),
2940                options: fidl::new_empty!(
2941                    MountOptions,
2942                    fidl::encoding::DefaultFuchsiaResourceDialect
2943                ),
2944            }
2945        }
2946
2947        #[inline]
2948        unsafe fn decode(
2949            &mut self,
2950            decoder: &mut fidl::encoding::Decoder<
2951                '_,
2952                fidl::encoding::DefaultFuchsiaResourceDialect,
2953            >,
2954            offset: usize,
2955            _depth: fidl::encoding::Depth,
2956        ) -> fidl::Result<()> {
2957            decoder.debug_check_bounds::<Self>(offset);
2958            // Verify that padding bytes are zero.
2959            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2960            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2961            let mask = 0xffffffff00000000u64;
2962            let maskedval = padval & mask;
2963            if maskedval != 0 {
2964                return Err(fidl::Error::NonZeroPadding {
2965                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2966                });
2967            }
2968            fidl::decode!(
2969                fidl::encoding::Endpoint<
2970                    fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
2971                >,
2972                fidl::encoding::DefaultFuchsiaResourceDialect,
2973                &mut self.device,
2974                decoder,
2975                offset + 0,
2976                _depth
2977            )?;
2978            fidl::decode!(
2979                fidl::encoding::BoundedString<255>,
2980                fidl::encoding::DefaultFuchsiaResourceDialect,
2981                &mut self.name,
2982                decoder,
2983                offset + 8,
2984                _depth
2985            )?;
2986            fidl::decode!(
2987                MountOptions,
2988                fidl::encoding::DefaultFuchsiaResourceDialect,
2989                &mut self.options,
2990                decoder,
2991                offset + 24,
2992                _depth
2993            )?;
2994            Ok(())
2995        }
2996    }
2997
2998    impl fidl::encoding::ResourceTypeMarker for AdminWipeStorageRequest {
2999        type Borrowed<'a> = &'a mut Self;
3000        fn take_or_borrow<'a>(
3001            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3002        ) -> Self::Borrowed<'a> {
3003            value
3004        }
3005    }
3006
3007    unsafe impl fidl::encoding::TypeMarker for AdminWipeStorageRequest {
3008        type Owned = Self;
3009
3010        #[inline(always)]
3011        fn inline_align(_context: fidl::encoding::Context) -> usize {
3012            4
3013        }
3014
3015        #[inline(always)]
3016        fn inline_size(_context: fidl::encoding::Context) -> usize {
3017            8
3018        }
3019    }
3020
3021    unsafe impl
3022        fidl::encoding::Encode<
3023            AdminWipeStorageRequest,
3024            fidl::encoding::DefaultFuchsiaResourceDialect,
3025        > for &mut AdminWipeStorageRequest
3026    {
3027        #[inline]
3028        unsafe fn encode(
3029            self,
3030            encoder: &mut fidl::encoding::Encoder<
3031                '_,
3032                fidl::encoding::DefaultFuchsiaResourceDialect,
3033            >,
3034            offset: usize,
3035            _depth: fidl::encoding::Depth,
3036        ) -> fidl::Result<()> {
3037            encoder.debug_check_bounds::<AdminWipeStorageRequest>(offset);
3038            // Delegate to tuple encoding.
3039            fidl::encoding::Encode::<
3040                AdminWipeStorageRequest,
3041                fidl::encoding::DefaultFuchsiaResourceDialect,
3042            >::encode(
3043                (
3044                    <fidl::encoding::Optional<
3045                        fidl::encoding::Endpoint<
3046                            fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3047                        >,
3048                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3049                        &mut self.blobfs_root
3050                    ),
3051                    <fidl::encoding::Optional<
3052                        fidl::encoding::Endpoint<
3053                            fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>,
3054                        >,
3055                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3056                        &mut self.blob_creator,
3057                    ),
3058                ),
3059                encoder,
3060                offset,
3061                _depth,
3062            )
3063        }
3064    }
3065    unsafe impl<
3066            T0: fidl::encoding::Encode<
3067                fidl::encoding::Optional<
3068                    fidl::encoding::Endpoint<
3069                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3070                    >,
3071                >,
3072                fidl::encoding::DefaultFuchsiaResourceDialect,
3073            >,
3074            T1: fidl::encoding::Encode<
3075                fidl::encoding::Optional<
3076                    fidl::encoding::Endpoint<
3077                        fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>,
3078                    >,
3079                >,
3080                fidl::encoding::DefaultFuchsiaResourceDialect,
3081            >,
3082        >
3083        fidl::encoding::Encode<
3084            AdminWipeStorageRequest,
3085            fidl::encoding::DefaultFuchsiaResourceDialect,
3086        > for (T0, T1)
3087    {
3088        #[inline]
3089        unsafe fn encode(
3090            self,
3091            encoder: &mut fidl::encoding::Encoder<
3092                '_,
3093                fidl::encoding::DefaultFuchsiaResourceDialect,
3094            >,
3095            offset: usize,
3096            depth: fidl::encoding::Depth,
3097        ) -> fidl::Result<()> {
3098            encoder.debug_check_bounds::<AdminWipeStorageRequest>(offset);
3099            // Zero out padding regions. There's no need to apply masks
3100            // because the unmasked parts will be overwritten by fields.
3101            // Write the fields.
3102            self.0.encode(encoder, offset + 0, depth)?;
3103            self.1.encode(encoder, offset + 4, depth)?;
3104            Ok(())
3105        }
3106    }
3107
3108    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3109        for AdminWipeStorageRequest
3110    {
3111        #[inline(always)]
3112        fn new_empty() -> Self {
3113            Self {
3114                blobfs_root: fidl::new_empty!(
3115                    fidl::encoding::Optional<
3116                        fidl::encoding::Endpoint<
3117                            fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3118                        >,
3119                    >,
3120                    fidl::encoding::DefaultFuchsiaResourceDialect
3121                ),
3122                blob_creator: fidl::new_empty!(
3123                    fidl::encoding::Optional<
3124                        fidl::encoding::Endpoint<
3125                            fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>,
3126                        >,
3127                    >,
3128                    fidl::encoding::DefaultFuchsiaResourceDialect
3129                ),
3130            }
3131        }
3132
3133        #[inline]
3134        unsafe fn decode(
3135            &mut self,
3136            decoder: &mut fidl::encoding::Decoder<
3137                '_,
3138                fidl::encoding::DefaultFuchsiaResourceDialect,
3139            >,
3140            offset: usize,
3141            _depth: fidl::encoding::Depth,
3142        ) -> fidl::Result<()> {
3143            decoder.debug_check_bounds::<Self>(offset);
3144            // Verify that padding bytes are zero.
3145            fidl::decode!(
3146                fidl::encoding::Optional<
3147                    fidl::encoding::Endpoint<
3148                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3149                    >,
3150                >,
3151                fidl::encoding::DefaultFuchsiaResourceDialect,
3152                &mut self.blobfs_root,
3153                decoder,
3154                offset + 0,
3155                _depth
3156            )?;
3157            fidl::decode!(
3158                fidl::encoding::Optional<
3159                    fidl::encoding::Endpoint<
3160                        fidl::endpoints::ServerEnd<fidl_fuchsia_fxfs::BlobCreatorMarker>,
3161                    >,
3162                >,
3163                fidl::encoding::DefaultFuchsiaResourceDialect,
3164                &mut self.blob_creator,
3165                decoder,
3166                offset + 4,
3167                _depth
3168            )?;
3169            Ok(())
3170        }
3171    }
3172
3173    impl fidl::encoding::ResourceTypeMarker for AdminWriteDataFileRequest {
3174        type Borrowed<'a> = &'a mut Self;
3175        fn take_or_borrow<'a>(
3176            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3177        ) -> Self::Borrowed<'a> {
3178            value
3179        }
3180    }
3181
3182    unsafe impl fidl::encoding::TypeMarker for AdminWriteDataFileRequest {
3183        type Owned = Self;
3184
3185        #[inline(always)]
3186        fn inline_align(_context: fidl::encoding::Context) -> usize {
3187            8
3188        }
3189
3190        #[inline(always)]
3191        fn inline_size(_context: fidl::encoding::Context) -> usize {
3192            24
3193        }
3194    }
3195
3196    unsafe impl
3197        fidl::encoding::Encode<
3198            AdminWriteDataFileRequest,
3199            fidl::encoding::DefaultFuchsiaResourceDialect,
3200        > for &mut AdminWriteDataFileRequest
3201    {
3202        #[inline]
3203        unsafe fn encode(
3204            self,
3205            encoder: &mut fidl::encoding::Encoder<
3206                '_,
3207                fidl::encoding::DefaultFuchsiaResourceDialect,
3208            >,
3209            offset: usize,
3210            _depth: fidl::encoding::Depth,
3211        ) -> fidl::Result<()> {
3212            encoder.debug_check_bounds::<AdminWriteDataFileRequest>(offset);
3213            // Delegate to tuple encoding.
3214            fidl::encoding::Encode::<AdminWriteDataFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3215                (
3216                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.filename),
3217                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.payload),
3218                ),
3219                encoder, offset, _depth
3220            )
3221        }
3222    }
3223    unsafe impl<
3224            T0: fidl::encoding::Encode<
3225                fidl::encoding::BoundedString<4095>,
3226                fidl::encoding::DefaultFuchsiaResourceDialect,
3227            >,
3228            T1: fidl::encoding::Encode<
3229                fidl::encoding::HandleType<
3230                    fidl::Vmo,
3231                    { fidl::ObjectType::VMO.into_raw() },
3232                    2147483648,
3233                >,
3234                fidl::encoding::DefaultFuchsiaResourceDialect,
3235            >,
3236        >
3237        fidl::encoding::Encode<
3238            AdminWriteDataFileRequest,
3239            fidl::encoding::DefaultFuchsiaResourceDialect,
3240        > for (T0, T1)
3241    {
3242        #[inline]
3243        unsafe fn encode(
3244            self,
3245            encoder: &mut fidl::encoding::Encoder<
3246                '_,
3247                fidl::encoding::DefaultFuchsiaResourceDialect,
3248            >,
3249            offset: usize,
3250            depth: fidl::encoding::Depth,
3251        ) -> fidl::Result<()> {
3252            encoder.debug_check_bounds::<AdminWriteDataFileRequest>(offset);
3253            // Zero out padding regions. There's no need to apply masks
3254            // because the unmasked parts will be overwritten by fields.
3255            unsafe {
3256                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3257                (ptr as *mut u64).write_unaligned(0);
3258            }
3259            // Write the fields.
3260            self.0.encode(encoder, offset + 0, depth)?;
3261            self.1.encode(encoder, offset + 16, depth)?;
3262            Ok(())
3263        }
3264    }
3265
3266    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3267        for AdminWriteDataFileRequest
3268    {
3269        #[inline(always)]
3270        fn new_empty() -> Self {
3271            Self {
3272                filename: fidl::new_empty!(
3273                    fidl::encoding::BoundedString<4095>,
3274                    fidl::encoding::DefaultFuchsiaResourceDialect
3275                ),
3276                payload: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3277            }
3278        }
3279
3280        #[inline]
3281        unsafe fn decode(
3282            &mut self,
3283            decoder: &mut fidl::encoding::Decoder<
3284                '_,
3285                fidl::encoding::DefaultFuchsiaResourceDialect,
3286            >,
3287            offset: usize,
3288            _depth: fidl::encoding::Depth,
3289        ) -> fidl::Result<()> {
3290            decoder.debug_check_bounds::<Self>(offset);
3291            // Verify that padding bytes are zero.
3292            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3293            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3294            let mask = 0xffffffff00000000u64;
3295            let maskedval = padval & mask;
3296            if maskedval != 0 {
3297                return Err(fidl::Error::NonZeroPadding {
3298                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3299                });
3300            }
3301            fidl::decode!(
3302                fidl::encoding::BoundedString<4095>,
3303                fidl::encoding::DefaultFuchsiaResourceDialect,
3304                &mut self.filename,
3305                decoder,
3306                offset + 0,
3307                _depth
3308            )?;
3309            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.payload, decoder, offset + 16, _depth)?;
3310            Ok(())
3311        }
3312    }
3313
3314    impl fidl::encoding::ResourceTypeMarker for StarnixVolumeProviderCreateRequest {
3315        type Borrowed<'a> = &'a mut Self;
3316        fn take_or_borrow<'a>(
3317            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3318        ) -> Self::Borrowed<'a> {
3319            value
3320        }
3321    }
3322
3323    unsafe impl fidl::encoding::TypeMarker for StarnixVolumeProviderCreateRequest {
3324        type Owned = Self;
3325
3326        #[inline(always)]
3327        fn inline_align(_context: fidl::encoding::Context) -> usize {
3328            4
3329        }
3330
3331        #[inline(always)]
3332        fn inline_size(_context: fidl::encoding::Context) -> usize {
3333            8
3334        }
3335    }
3336
3337    unsafe impl
3338        fidl::encoding::Encode<
3339            StarnixVolumeProviderCreateRequest,
3340            fidl::encoding::DefaultFuchsiaResourceDialect,
3341        > for &mut StarnixVolumeProviderCreateRequest
3342    {
3343        #[inline]
3344        unsafe fn encode(
3345            self,
3346            encoder: &mut fidl::encoding::Encoder<
3347                '_,
3348                fidl::encoding::DefaultFuchsiaResourceDialect,
3349            >,
3350            offset: usize,
3351            _depth: fidl::encoding::Depth,
3352        ) -> fidl::Result<()> {
3353            encoder.debug_check_bounds::<StarnixVolumeProviderCreateRequest>(offset);
3354            // Delegate to tuple encoding.
3355            fidl::encoding::Encode::<
3356                StarnixVolumeProviderCreateRequest,
3357                fidl::encoding::DefaultFuchsiaResourceDialect,
3358            >::encode(
3359                (
3360                    <fidl::encoding::Endpoint<
3361                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3362                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3363                        &mut self.crypt
3364                    ),
3365                    <fidl::encoding::Endpoint<
3366                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3367                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3368                        &mut self.exposed_dir
3369                    ),
3370                ),
3371                encoder,
3372                offset,
3373                _depth,
3374            )
3375        }
3376    }
3377    unsafe impl<
3378            T0: fidl::encoding::Encode<
3379                fidl::encoding::Endpoint<
3380                    fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3381                >,
3382                fidl::encoding::DefaultFuchsiaResourceDialect,
3383            >,
3384            T1: fidl::encoding::Encode<
3385                fidl::encoding::Endpoint<
3386                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3387                >,
3388                fidl::encoding::DefaultFuchsiaResourceDialect,
3389            >,
3390        >
3391        fidl::encoding::Encode<
3392            StarnixVolumeProviderCreateRequest,
3393            fidl::encoding::DefaultFuchsiaResourceDialect,
3394        > for (T0, T1)
3395    {
3396        #[inline]
3397        unsafe fn encode(
3398            self,
3399            encoder: &mut fidl::encoding::Encoder<
3400                '_,
3401                fidl::encoding::DefaultFuchsiaResourceDialect,
3402            >,
3403            offset: usize,
3404            depth: fidl::encoding::Depth,
3405        ) -> fidl::Result<()> {
3406            encoder.debug_check_bounds::<StarnixVolumeProviderCreateRequest>(offset);
3407            // Zero out padding regions. There's no need to apply masks
3408            // because the unmasked parts will be overwritten by fields.
3409            // Write the fields.
3410            self.0.encode(encoder, offset + 0, depth)?;
3411            self.1.encode(encoder, offset + 4, depth)?;
3412            Ok(())
3413        }
3414    }
3415
3416    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3417        for StarnixVolumeProviderCreateRequest
3418    {
3419        #[inline(always)]
3420        fn new_empty() -> Self {
3421            Self {
3422                crypt: fidl::new_empty!(
3423                    fidl::encoding::Endpoint<
3424                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3425                    >,
3426                    fidl::encoding::DefaultFuchsiaResourceDialect
3427                ),
3428                exposed_dir: fidl::new_empty!(
3429                    fidl::encoding::Endpoint<
3430                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3431                    >,
3432                    fidl::encoding::DefaultFuchsiaResourceDialect
3433                ),
3434            }
3435        }
3436
3437        #[inline]
3438        unsafe fn decode(
3439            &mut self,
3440            decoder: &mut fidl::encoding::Decoder<
3441                '_,
3442                fidl::encoding::DefaultFuchsiaResourceDialect,
3443            >,
3444            offset: usize,
3445            _depth: fidl::encoding::Depth,
3446        ) -> fidl::Result<()> {
3447            decoder.debug_check_bounds::<Self>(offset);
3448            // Verify that padding bytes are zero.
3449            fidl::decode!(
3450                fidl::encoding::Endpoint<
3451                    fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3452                >,
3453                fidl::encoding::DefaultFuchsiaResourceDialect,
3454                &mut self.crypt,
3455                decoder,
3456                offset + 0,
3457                _depth
3458            )?;
3459            fidl::decode!(
3460                fidl::encoding::Endpoint<
3461                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3462                >,
3463                fidl::encoding::DefaultFuchsiaResourceDialect,
3464                &mut self.exposed_dir,
3465                decoder,
3466                offset + 4,
3467                _depth
3468            )?;
3469            Ok(())
3470        }
3471    }
3472
3473    impl fidl::encoding::ResourceTypeMarker for StarnixVolumeProviderMountRequest {
3474        type Borrowed<'a> = &'a mut Self;
3475        fn take_or_borrow<'a>(
3476            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3477        ) -> Self::Borrowed<'a> {
3478            value
3479        }
3480    }
3481
3482    unsafe impl fidl::encoding::TypeMarker for StarnixVolumeProviderMountRequest {
3483        type Owned = Self;
3484
3485        #[inline(always)]
3486        fn inline_align(_context: fidl::encoding::Context) -> usize {
3487            4
3488        }
3489
3490        #[inline(always)]
3491        fn inline_size(_context: fidl::encoding::Context) -> usize {
3492            8
3493        }
3494    }
3495
3496    unsafe impl
3497        fidl::encoding::Encode<
3498            StarnixVolumeProviderMountRequest,
3499            fidl::encoding::DefaultFuchsiaResourceDialect,
3500        > for &mut StarnixVolumeProviderMountRequest
3501    {
3502        #[inline]
3503        unsafe fn encode(
3504            self,
3505            encoder: &mut fidl::encoding::Encoder<
3506                '_,
3507                fidl::encoding::DefaultFuchsiaResourceDialect,
3508            >,
3509            offset: usize,
3510            _depth: fidl::encoding::Depth,
3511        ) -> fidl::Result<()> {
3512            encoder.debug_check_bounds::<StarnixVolumeProviderMountRequest>(offset);
3513            // Delegate to tuple encoding.
3514            fidl::encoding::Encode::<
3515                StarnixVolumeProviderMountRequest,
3516                fidl::encoding::DefaultFuchsiaResourceDialect,
3517            >::encode(
3518                (
3519                    <fidl::encoding::Endpoint<
3520                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3521                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3522                        &mut self.crypt
3523                    ),
3524                    <fidl::encoding::Endpoint<
3525                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3526                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3527                        &mut self.exposed_dir
3528                    ),
3529                ),
3530                encoder,
3531                offset,
3532                _depth,
3533            )
3534        }
3535    }
3536    unsafe impl<
3537            T0: fidl::encoding::Encode<
3538                fidl::encoding::Endpoint<
3539                    fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3540                >,
3541                fidl::encoding::DefaultFuchsiaResourceDialect,
3542            >,
3543            T1: fidl::encoding::Encode<
3544                fidl::encoding::Endpoint<
3545                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3546                >,
3547                fidl::encoding::DefaultFuchsiaResourceDialect,
3548            >,
3549        >
3550        fidl::encoding::Encode<
3551            StarnixVolumeProviderMountRequest,
3552            fidl::encoding::DefaultFuchsiaResourceDialect,
3553        > for (T0, T1)
3554    {
3555        #[inline]
3556        unsafe fn encode(
3557            self,
3558            encoder: &mut fidl::encoding::Encoder<
3559                '_,
3560                fidl::encoding::DefaultFuchsiaResourceDialect,
3561            >,
3562            offset: usize,
3563            depth: fidl::encoding::Depth,
3564        ) -> fidl::Result<()> {
3565            encoder.debug_check_bounds::<StarnixVolumeProviderMountRequest>(offset);
3566            // Zero out padding regions. There's no need to apply masks
3567            // because the unmasked parts will be overwritten by fields.
3568            // Write the fields.
3569            self.0.encode(encoder, offset + 0, depth)?;
3570            self.1.encode(encoder, offset + 4, depth)?;
3571            Ok(())
3572        }
3573    }
3574
3575    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3576        for StarnixVolumeProviderMountRequest
3577    {
3578        #[inline(always)]
3579        fn new_empty() -> Self {
3580            Self {
3581                crypt: fidl::new_empty!(
3582                    fidl::encoding::Endpoint<
3583                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3584                    >,
3585                    fidl::encoding::DefaultFuchsiaResourceDialect
3586                ),
3587                exposed_dir: fidl::new_empty!(
3588                    fidl::encoding::Endpoint<
3589                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3590                    >,
3591                    fidl::encoding::DefaultFuchsiaResourceDialect
3592                ),
3593            }
3594        }
3595
3596        #[inline]
3597        unsafe fn decode(
3598            &mut self,
3599            decoder: &mut fidl::encoding::Decoder<
3600                '_,
3601                fidl::encoding::DefaultFuchsiaResourceDialect,
3602            >,
3603            offset: usize,
3604            _depth: fidl::encoding::Depth,
3605        ) -> fidl::Result<()> {
3606            decoder.debug_check_bounds::<Self>(offset);
3607            // Verify that padding bytes are zero.
3608            fidl::decode!(
3609                fidl::encoding::Endpoint<
3610                    fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3611                >,
3612                fidl::encoding::DefaultFuchsiaResourceDialect,
3613                &mut self.crypt,
3614                decoder,
3615                offset + 0,
3616                _depth
3617            )?;
3618            fidl::decode!(
3619                fidl::encoding::Endpoint<
3620                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3621                >,
3622                fidl::encoding::DefaultFuchsiaResourceDialect,
3623                &mut self.exposed_dir,
3624                decoder,
3625                offset + 4,
3626                _depth
3627            )?;
3628            Ok(())
3629        }
3630    }
3631
3632    impl MountOptions {
3633        #[inline(always)]
3634        fn max_ordinal_present(&self) -> u64 {
3635            if let Some(_) = self.write_compression_algorithm {
3636                return 4;
3637            }
3638            if let Some(_) = self.verbose {
3639                return 3;
3640            }
3641            if let Some(_) = self.collect_metrics {
3642                return 2;
3643            }
3644            if let Some(_) = self.read_only {
3645                return 1;
3646            }
3647            0
3648        }
3649    }
3650
3651    impl fidl::encoding::ResourceTypeMarker for MountOptions {
3652        type Borrowed<'a> = &'a mut Self;
3653        fn take_or_borrow<'a>(
3654            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3655        ) -> Self::Borrowed<'a> {
3656            value
3657        }
3658    }
3659
3660    unsafe impl fidl::encoding::TypeMarker for MountOptions {
3661        type Owned = Self;
3662
3663        #[inline(always)]
3664        fn inline_align(_context: fidl::encoding::Context) -> usize {
3665            8
3666        }
3667
3668        #[inline(always)]
3669        fn inline_size(_context: fidl::encoding::Context) -> usize {
3670            16
3671        }
3672    }
3673
3674    unsafe impl fidl::encoding::Encode<MountOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
3675        for &mut MountOptions
3676    {
3677        unsafe fn encode(
3678            self,
3679            encoder: &mut fidl::encoding::Encoder<
3680                '_,
3681                fidl::encoding::DefaultFuchsiaResourceDialect,
3682            >,
3683            offset: usize,
3684            mut depth: fidl::encoding::Depth,
3685        ) -> fidl::Result<()> {
3686            encoder.debug_check_bounds::<MountOptions>(offset);
3687            // Vector header
3688            let max_ordinal: u64 = self.max_ordinal_present();
3689            encoder.write_num(max_ordinal, offset);
3690            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3691            // Calling encoder.out_of_line_offset(0) is not allowed.
3692            if max_ordinal == 0 {
3693                return Ok(());
3694            }
3695            depth.increment()?;
3696            let envelope_size = 8;
3697            let bytes_len = max_ordinal as usize * envelope_size;
3698            #[allow(unused_variables)]
3699            let offset = encoder.out_of_line_offset(bytes_len);
3700            let mut _prev_end_offset: usize = 0;
3701            if 1 > max_ordinal {
3702                return Ok(());
3703            }
3704
3705            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3706            // are envelope_size bytes.
3707            let cur_offset: usize = (1 - 1) * envelope_size;
3708
3709            // Zero reserved fields.
3710            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3711
3712            // Safety:
3713            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3714            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3715            //   envelope_size bytes, there is always sufficient room.
3716            fidl::encoding::encode_in_envelope_optional::<
3717                bool,
3718                fidl::encoding::DefaultFuchsiaResourceDialect,
3719            >(
3720                self.read_only.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3721                encoder,
3722                offset + cur_offset,
3723                depth,
3724            )?;
3725
3726            _prev_end_offset = cur_offset + envelope_size;
3727            if 2 > max_ordinal {
3728                return Ok(());
3729            }
3730
3731            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3732            // are envelope_size bytes.
3733            let cur_offset: usize = (2 - 1) * envelope_size;
3734
3735            // Zero reserved fields.
3736            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3737
3738            // Safety:
3739            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3740            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3741            //   envelope_size bytes, there is always sufficient room.
3742            fidl::encoding::encode_in_envelope_optional::<
3743                bool,
3744                fidl::encoding::DefaultFuchsiaResourceDialect,
3745            >(
3746                self.collect_metrics
3747                    .as_ref()
3748                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3749                encoder,
3750                offset + cur_offset,
3751                depth,
3752            )?;
3753
3754            _prev_end_offset = cur_offset + envelope_size;
3755            if 3 > max_ordinal {
3756                return Ok(());
3757            }
3758
3759            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3760            // are envelope_size bytes.
3761            let cur_offset: usize = (3 - 1) * envelope_size;
3762
3763            // Zero reserved fields.
3764            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3765
3766            // Safety:
3767            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3768            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3769            //   envelope_size bytes, there is always sufficient room.
3770            fidl::encoding::encode_in_envelope_optional::<
3771                bool,
3772                fidl::encoding::DefaultFuchsiaResourceDialect,
3773            >(
3774                self.verbose.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3775                encoder,
3776                offset + cur_offset,
3777                depth,
3778            )?;
3779
3780            _prev_end_offset = cur_offset + envelope_size;
3781            if 4 > max_ordinal {
3782                return Ok(());
3783            }
3784
3785            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3786            // are envelope_size bytes.
3787            let cur_offset: usize = (4 - 1) * envelope_size;
3788
3789            // Zero reserved fields.
3790            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3791
3792            // Safety:
3793            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3794            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3795            //   envelope_size bytes, there is always sufficient room.
3796            fidl::encoding::encode_in_envelope_optional::<
3797                fidl::encoding::BoundedString<32>,
3798                fidl::encoding::DefaultFuchsiaResourceDialect,
3799            >(
3800                self.write_compression_algorithm.as_ref().map(
3801                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
3802                ),
3803                encoder,
3804                offset + cur_offset,
3805                depth,
3806            )?;
3807
3808            _prev_end_offset = cur_offset + envelope_size;
3809
3810            Ok(())
3811        }
3812    }
3813
3814    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for MountOptions {
3815        #[inline(always)]
3816        fn new_empty() -> Self {
3817            Self::default()
3818        }
3819
3820        unsafe fn decode(
3821            &mut self,
3822            decoder: &mut fidl::encoding::Decoder<
3823                '_,
3824                fidl::encoding::DefaultFuchsiaResourceDialect,
3825            >,
3826            offset: usize,
3827            mut depth: fidl::encoding::Depth,
3828        ) -> fidl::Result<()> {
3829            decoder.debug_check_bounds::<Self>(offset);
3830            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3831                None => return Err(fidl::Error::NotNullable),
3832                Some(len) => len,
3833            };
3834            // Calling decoder.out_of_line_offset(0) is not allowed.
3835            if len == 0 {
3836                return Ok(());
3837            };
3838            depth.increment()?;
3839            let envelope_size = 8;
3840            let bytes_len = len * envelope_size;
3841            let offset = decoder.out_of_line_offset(bytes_len)?;
3842            // Decode the envelope for each type.
3843            let mut _next_ordinal_to_read = 0;
3844            let mut next_offset = offset;
3845            let end_offset = offset + bytes_len;
3846            _next_ordinal_to_read += 1;
3847            if next_offset >= end_offset {
3848                return Ok(());
3849            }
3850
3851            // Decode unknown envelopes for gaps in ordinals.
3852            while _next_ordinal_to_read < 1 {
3853                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3854                _next_ordinal_to_read += 1;
3855                next_offset += envelope_size;
3856            }
3857
3858            let next_out_of_line = decoder.next_out_of_line();
3859            let handles_before = decoder.remaining_handles();
3860            if let Some((inlined, num_bytes, num_handles)) =
3861                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3862            {
3863                let member_inline_size =
3864                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3865                if inlined != (member_inline_size <= 4) {
3866                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3867                }
3868                let inner_offset;
3869                let mut inner_depth = depth.clone();
3870                if inlined {
3871                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3872                    inner_offset = next_offset;
3873                } else {
3874                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3875                    inner_depth.increment()?;
3876                }
3877                let val_ref = self.read_only.get_or_insert_with(|| {
3878                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
3879                });
3880                fidl::decode!(
3881                    bool,
3882                    fidl::encoding::DefaultFuchsiaResourceDialect,
3883                    val_ref,
3884                    decoder,
3885                    inner_offset,
3886                    inner_depth
3887                )?;
3888                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3889                {
3890                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3891                }
3892                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3893                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3894                }
3895            }
3896
3897            next_offset += envelope_size;
3898            _next_ordinal_to_read += 1;
3899            if next_offset >= end_offset {
3900                return Ok(());
3901            }
3902
3903            // Decode unknown envelopes for gaps in ordinals.
3904            while _next_ordinal_to_read < 2 {
3905                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3906                _next_ordinal_to_read += 1;
3907                next_offset += envelope_size;
3908            }
3909
3910            let next_out_of_line = decoder.next_out_of_line();
3911            let handles_before = decoder.remaining_handles();
3912            if let Some((inlined, num_bytes, num_handles)) =
3913                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3914            {
3915                let member_inline_size =
3916                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3917                if inlined != (member_inline_size <= 4) {
3918                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3919                }
3920                let inner_offset;
3921                let mut inner_depth = depth.clone();
3922                if inlined {
3923                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3924                    inner_offset = next_offset;
3925                } else {
3926                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3927                    inner_depth.increment()?;
3928                }
3929                let val_ref = self.collect_metrics.get_or_insert_with(|| {
3930                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
3931                });
3932                fidl::decode!(
3933                    bool,
3934                    fidl::encoding::DefaultFuchsiaResourceDialect,
3935                    val_ref,
3936                    decoder,
3937                    inner_offset,
3938                    inner_depth
3939                )?;
3940                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3941                {
3942                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3943                }
3944                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3945                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3946                }
3947            }
3948
3949            next_offset += envelope_size;
3950            _next_ordinal_to_read += 1;
3951            if next_offset >= end_offset {
3952                return Ok(());
3953            }
3954
3955            // Decode unknown envelopes for gaps in ordinals.
3956            while _next_ordinal_to_read < 3 {
3957                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3958                _next_ordinal_to_read += 1;
3959                next_offset += envelope_size;
3960            }
3961
3962            let next_out_of_line = decoder.next_out_of_line();
3963            let handles_before = decoder.remaining_handles();
3964            if let Some((inlined, num_bytes, num_handles)) =
3965                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3966            {
3967                let member_inline_size =
3968                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3969                if inlined != (member_inline_size <= 4) {
3970                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3971                }
3972                let inner_offset;
3973                let mut inner_depth = depth.clone();
3974                if inlined {
3975                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3976                    inner_offset = next_offset;
3977                } else {
3978                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3979                    inner_depth.increment()?;
3980                }
3981                let val_ref = self.verbose.get_or_insert_with(|| {
3982                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
3983                });
3984                fidl::decode!(
3985                    bool,
3986                    fidl::encoding::DefaultFuchsiaResourceDialect,
3987                    val_ref,
3988                    decoder,
3989                    inner_offset,
3990                    inner_depth
3991                )?;
3992                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3993                {
3994                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3995                }
3996                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3997                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3998                }
3999            }
4000
4001            next_offset += envelope_size;
4002            _next_ordinal_to_read += 1;
4003            if next_offset >= end_offset {
4004                return Ok(());
4005            }
4006
4007            // Decode unknown envelopes for gaps in ordinals.
4008            while _next_ordinal_to_read < 4 {
4009                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4010                _next_ordinal_to_read += 1;
4011                next_offset += envelope_size;
4012            }
4013
4014            let next_out_of_line = decoder.next_out_of_line();
4015            let handles_before = decoder.remaining_handles();
4016            if let Some((inlined, num_bytes, num_handles)) =
4017                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4018            {
4019                let member_inline_size =
4020                    <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
4021                        decoder.context,
4022                    );
4023                if inlined != (member_inline_size <= 4) {
4024                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4025                }
4026                let inner_offset;
4027                let mut inner_depth = depth.clone();
4028                if inlined {
4029                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4030                    inner_offset = next_offset;
4031                } else {
4032                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4033                    inner_depth.increment()?;
4034                }
4035                let val_ref = self.write_compression_algorithm.get_or_insert_with(|| {
4036                    fidl::new_empty!(
4037                        fidl::encoding::BoundedString<32>,
4038                        fidl::encoding::DefaultFuchsiaResourceDialect
4039                    )
4040                });
4041                fidl::decode!(
4042                    fidl::encoding::BoundedString<32>,
4043                    fidl::encoding::DefaultFuchsiaResourceDialect,
4044                    val_ref,
4045                    decoder,
4046                    inner_offset,
4047                    inner_depth
4048                )?;
4049                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4050                {
4051                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4052                }
4053                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4054                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4055                }
4056            }
4057
4058            next_offset += envelope_size;
4059
4060            // Decode the remaining unknown envelopes.
4061            while next_offset < end_offset {
4062                _next_ordinal_to_read += 1;
4063                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4064                next_offset += envelope_size;
4065            }
4066
4067            Ok(())
4068        }
4069    }
4070}