pub async fn start(self) -> Result<String, Error> {
        extern "C" fn start_cb(
            ss: *mut spdk_nvmf_subsystem,
            arg: *mut c_void,
            status: i32,
        ) {
            let s = unsafe { Box::from_raw(arg as *mut oneshot::Sender<i32>) };
            let ss = NvmfSubsystem::from(ss);
            if status != 0 {
                error!(
                    "Failed start subsystem state {} -- destroying it",
                    ss.get_nqn()
                );
                ss.destroy();
            }

            s.send(status).unwrap();
        }

        self.add_listener().await?;

        let (s, r) = oneshot::channel::<i32>();

        unsafe {
            spdk_nvmf_subsystem_start(
                self.0.as_ptr(),
                Some(start_cb),
                cb_arg(s),
            )
        }
        .to_result(|e| Error::Subsystem {
            source: Errno::from_i32(e),
            nqn: self.get_nqn(),
            msg: "out of memory".to_string(),
        })?;

        r.await.unwrap().to_result(|e| Error::Subsystem {
            source: Errno::from_i32(e),
            nqn: self.get_nqn(),
            msg: "failed to start the subsystem".to_string(),
        })?;

        info!("started {:?}", self.get_nqn());
        Ok(self.get_nqn())
    }
/// start the subsystem previously created -- note that we destroy it on
/// failure to ensure the state is not in limbo and to avoid leaking
/// resources
start the subsystem previously created -- note that we destroy it on
failure to ensure the state is not in limbo and to avoid leaking
resources
start the subsystem previously created -- note that we destroy it on failure to ensure the state is not in limbo and to avoid leaking resources
pub async fn start(self) -> Result<String, Error> {
        extern "C" fn start_cb(
            ss: *mut spdk_nvmf_subsystem,
            arg: *mut c_void,
            status: i32,
        ) {
            let s = unsafe { Box::from_raw(arg as *mut oneshot::Sender<i32>) };
            let ss = NvmfSubsystem::from(ss);
            if status != 0 {
                error!(
                    "Failed start subsystem state {} -- destroying it",
                    ss.get_nqn()
                );
                ss.destroy();
            }
            s.send(status).unwrap();
        }
        self.add_listener().await?;
        let (s, r) = oneshot::channel::<i32>();
        unsafe {
            spdk_nvmf_subsystem_start(
                self.0.as_ptr(),
                Some(start_cb),
                cb_arg(s),
            )
        }
        .to_result(|e| Error::Subsystem {
            source: Errno::from_i32(e),
            nqn: self.get_nqn(),
            msg: "out of memory".to_string(),
        })?;
        r.await.unwrap().to_result(|e| Error::Subsystem {
            source: Errno::from_i32(e),
            nqn: self.get_nqn(),
            msg: "failed to start the subsystem".to_string(),
        })?;
        info!("started {:?}", self.get_nqn());
        Ok(self.get_nqn())
    }
pub async fn start ( self ) -> Result < String , Error > { extern " " fn start_cb ( ss : * mut spdk_nvmf_subsystem , arg : * mut c_void , status : i32 , ) { let s = unsafe { Box :: from_raw ( arg as * mut oneshot :: Sender < i32 > ) } ; let ss = NvmfSubsystem :: from ( ss ) ; if status != 0 { error ! ( " " ss get_nqn ( ) ) ; ss . destroy ( ) ; } s . send ( status ) . unwrap ( ) ; } self . add_listener ( ) . await ? ; let ( s , r ) = oneshot :: channel :: < i32 > ( ) ; unsafe { spdk_nvmf_subsystem_start ( self . 0 . as_ptr ( ) , Some ( start_cb ) , cb_arg ( s ) , ) } . to_result ( | e | Error :: Subsystem { source : Errno :: from_i32 ( e ) , nqn : self . get_nqn ( ) , msg : " " . to_string ( ) , } ) ? ; r . await . unwrap ( ) . to_result ( | e | Error :: Subsystem { source : Errno :: from_i32 ( e ) , nqn : self . get_nqn ( ) , msg : " " . to_string ( ) , } ) ? ; info ! ( " " self get_nqn ( ) ) ; Ok ( self . get_nqn ( ) ) }
start the subsystem previously created -- note that we destroy it on
failure to ensure the state is not in limbo and to avoid leaking
resources
start the subsystem previously created -- note that we destroy it on failure to ensure the state is not in limbo and to avoid leaking resources
self