pub async fn route_and_open_storage_capability(
    use_decl: UseStorageDecl,
    open_mode: u32,
    target: &Arc<ComponentInstance>,
    server_chan: &mut zx::Channel,
    bind_reason: &BindReason,
) -> Result<(), ModelError> {
    let (storage_source_info, relative_moniker) = route_storage(use_decl, target).await?;
    let dir_source = storage_source_info.storage_provider.clone();
    let relative_moniker_2 = relative_moniker.clone();
    let storage_dir_proxy = storage::open_isolated_storage(
        storage_source_info,
        relative_moniker,
        target.instance_id().as_ref(),
        open_mode,
        bind_reason,
    )
    .await
    .map_err(|e| ModelError::from(e))?;

    // clone the final connection to connect the channel we're routing to its destination
    let server_chan = channel::take_channel(server_chan);
    storage_dir_proxy.clone(fio::CLONE_FLAG_SAME_RIGHTS, ServerEnd::new(server_chan)).map_err(
        |e| {
            let moniker = match &dir_source {
                Some(r) => ExtendedMoniker::ComponentInstance(r.abs_moniker.clone()),
                None => ExtendedMoniker::ComponentManager,
            };
            ModelError::from(OpenResourceError::open_storage_failed(
                &moniker,
                &relative_moniker_2,
                "",
                e,
            ))
        },
    )?;
    Ok(())
}
/// Routes a storage capability from `target` to its source and opens its backing directory
/// capability, binding to the component instance if necessary.
///
/// If the capability is not allowed to be routed to the `target`, per the
/// [`crate::model::policy::GlobalPolicyChecker`], the capability is not opened and an error
/// is returned.
///
/// See [`fidl_fuchsia_io::Directory::Open`] for how the `flags`, `open_mode`, `relative_path`,
/// and `server_chan` parameters are used in the open call.
Routes a storage capability from `target` to its source and opens its backing directory
capability, binding to the component instance if necessary.




Routes a storage capability from ` target ` to its source and opens its backing directory capability binding to the component instance if necessary .
pub async fn route_and_open_storage_capability(
    use_decl: UseStorageDecl,
    open_mode: u32,
    target: &Arc<ComponentInstance>,
    server_chan: &mut zx::Channel,
    bind_reason: &BindReason,
) -> Result<(), ModelError> {
    let (storage_source_info, relative_moniker) = route_storage(use_decl, target).await?;
    let dir_source = storage_source_info.storage_provider.clone();
    let relative_moniker_2 = relative_moniker.clone();
    let storage_dir_proxy = storage::open_isolated_storage(
        storage_source_info,
        relative_moniker,
        target.instance_id().as_ref(),
        open_mode,
        bind_reason,
    )
    .await
    .map_err(|e| ModelError::from(e))?;
    // clone the final connection to connect the channel we're routing to its destination
    let server_chan = channel::take_channel(server_chan);
    storage_dir_proxy.clone(fio::CLONE_FLAG_SAME_RIGHTS, ServerEnd::new(server_chan)).map_err(
        |e| {
            let moniker = match &dir_source {
                Some(r) => ExtendedMoniker::ComponentInstance(r.abs_moniker.clone()),
                None => ExtendedMoniker::ComponentManager,
            };
            ModelError::from(OpenResourceError::open_storage_failed(
                &moniker,
                &relative_moniker_2,
                "",
                e,
            ))
        },
    )?;
    Ok(())
}
pub async fn route_and_open_storage_capability ( use_decl : UseStorageDecl , open_mode : u32 , target : & Arc < ComponentInstance > , server_chan : & mut zx :: Channel , bind_reason : & BindReason , ) -> Result < ( ) , ModelError > { let ( storage_source_info , relative_moniker ) = route_storage ( use_decl , target ) . await ? ; let dir_source = storage_source_info . storage_provider . clone ( ) ; let relative_moniker_2 = relative_moniker . clone ( ) ; let storage_dir_proxy = storage :: open_isolated_storage ( storage_source_info , relative_moniker , target . instance_id ( ) . as_ref ( ) , open_mode , bind_reason , ) . await . map_err ( | e | ModelError :: from ( e ) ) ? ; // clone the final connection to connect the channel we're routing to its destination let server_chan = channel :: take_channel ( server_chan ) ; storage_dir_proxy . clone ( fio :: CLONE_FLAG_SAME_RIGHTS , ServerEnd :: new ( server_chan ) ) . map_err ( | e | { let moniker = match & dir_source { Some ( r ) => ExtendedMoniker :: ComponentInstance ( r . abs_moniker . clone ( ) ) , None => ExtendedMoniker :: ComponentManager , } ; ModelError :: from ( OpenResourceError :: open_storage_failed ( & moniker , & relative_moniker_2 , " " , e , ) ) } , ) ? ; Ok ( ( ) ) }
Routes a storage capability from `target` to its source and opens its backing directory
capability, binding to the component instance if necessary.
Routes a storage capability from ` target ` to its source and opens its backing directory capability binding to the component instance if necessary .
use_decl
UseStorageDecl
open_mode
u32
target
&Arc<ComponentInstance>
server_chan
&mut zx::Channel
bind_reason
&BindReason
use_decl
UseStorageDecl
open_mode
u32
target
&Arc<ComponentInstance>
server_chan
&mut zx::Channel
bind_reason
&BindReason