pub fn start_with_blobfs(
        blobfs: BlobfsRamdisk,
        system_image_merkle: Option<impl Into<String>>,
    ) -> Result<Self, Error> {
        let system_image_merkle = system_image_merkle.map(|m| m.into());

        let pkgfs_root_handle_info = HandleInfo::new(HandleType::User0, 0);
        let (proxy, pkgfs_root_server_end) = fidl::endpoints::create_proxy::<DirectoryMarker>()?;

        let pkgsvr_bin = CString::new("/pkg/bin/pkgsvr").unwrap();
        let system_image_flag =
            system_image_merkle.as_ref().map(|s| CString::new(s.clone()).unwrap());

        let mut argv: Vec<&CStr> = vec![&pkgsvr_bin];
        if let Some(system_image_flag) = system_image_flag.as_ref() {
            argv.push(system_image_flag)
        }

        let process = fdio::spawn_etc(
            &fuchsia_runtime::job_default(),
            SpawnOptions::CLONE_ALL,
            &pkgsvr_bin,
            &argv,
            None,
            &mut [
                SpawnAction::add_handle(
                    pkgfs_root_handle_info,
                    pkgfs_root_server_end.into_channel().into(),
                ),
                SpawnAction::add_namespace_entry(
                    &CString::new("/blob").unwrap(),
                    blobfs.root_dir_handle().context("getting blobfs root dir handle")?.into(),
                ),
            ],
        )
        .map_err(|(status, _)| status)
        .context("spawning 'pkgsvr'")?;

        Ok(PkgfsRamdisk { blobfs, proxy, process: process.into(), system_image_merkle })
    }
/// Starts a package server backed by the provided blobfs.
///
/// If system_image_merkle is Some, uses that as the starting system_image package.
Starts a package server backed by the provided blobfs.
If system_image_merkle is Some, uses that as the starting system_image package.
Starts a package server backed by the provided blobfs . If system_image_merkle is Some uses that as the starting system_image package .
pub fn start_with_blobfs(
        blobfs: BlobfsRamdisk,
        system_image_merkle: Option<impl Into<String>>,
    ) -> Result<Self, Error> {
        let system_image_merkle = system_image_merkle.map(|m| m.into());
        let pkgfs_root_handle_info = HandleInfo::new(HandleType::User0, 0);
        let (proxy, pkgfs_root_server_end) = fidl::endpoints::create_proxy::<DirectoryMarker>()?;
        let pkgsvr_bin = CString::new("/pkg/bin/pkgsvr").unwrap();
        let system_image_flag =
            system_image_merkle.as_ref().map(|s| CString::new(s.clone()).unwrap());
        let mut argv: Vec<&CStr> = vec![&pkgsvr_bin];
        if let Some(system_image_flag) = system_image_flag.as_ref() {
            argv.push(system_image_flag)
        }
        let process = fdio::spawn_etc(
            &fuchsia_runtime::job_default(),
            SpawnOptions::CLONE_ALL,
            &pkgsvr_bin,
            &argv,
            None,
            &mut [
                SpawnAction::add_handle(
                    pkgfs_root_handle_info,
                    pkgfs_root_server_end.into_channel().into(),
                ),
                SpawnAction::add_namespace_entry(
                    &CString::new("/blob").unwrap(),
                    blobfs.root_dir_handle().context("getting blobfs root dir handle")?.into(),
                ),
            ],
        )
        .map_err(|(status, _)| status)
        .context("spawning 'pkgsvr'")?;
        Ok(PkgfsRamdisk { blobfs, proxy, process: process.into(), system_image_merkle })
    }
pub fn start_with_blobfs ( blobfs : BlobfsRamdisk , system_image_merkle : Option < impl Into < String > > , ) -> Result < Self , Error > { let system_image_merkle = system_image_merkle . map ( | m | m . into ( ) ) ; let pkgfs_root_handle_info = HandleInfo :: new ( HandleType :: User0 , 0 ) ; let ( proxy , pkgfs_root_server_end ) = fidl :: endpoints :: create_proxy :: < DirectoryMarker > ( ) ? ; let pkgsvr_bin = CString :: new ( " " ) . unwrap ( ) ; let system_image_flag = system_image_merkle . as_ref ( ) . map ( | s | CString :: new ( s . clone ( ) ) . unwrap ( ) ) ; let mut argv : Vec < & CStr > = vec ! [ pkgsvr_bin ] ; if let Some ( system_image_flag ) = system_image_flag . as_ref ( ) { argv . push ( system_image_flag ) } let process = fdio :: spawn_etc ( & fuchsia_runtime :: job_default ( ) , SpawnOptions :: CLONE_ALL , & pkgsvr_bin , & argv , None , & mut [ SpawnAction :: add_handle ( pkgfs_root_handle_info , pkgfs_root_server_end . into_channel ( ) . into ( ) , ) , SpawnAction :: add_namespace_entry ( & CString :: new ( " " ) . unwrap ( ) , blobfs . root_dir_handle ( ) . context ( " " ) ? . into ( ) , ) , ] , ) . map_err ( | ( status , _ ) | status ) . context ( " " ) ? ; Ok ( PkgfsRamdisk { blobfs , proxy , process : process . into ( ) , system_image_merkle } ) }
Starts a package server backed by the provided blobfs.
Starts a package server backed by the provided blobfs .
blobfs
BlobfsRamdisk
system_image_merkle
Option<impl Into<String>>