pub fn add_namespace(&self, bdev: &Bdev) -> Result<(), Error> {
        let opts = spdk_nvmf_ns_opts {
            nguid: bdev.uuid().as_bytes(),
            ..Default::default()
        };
        let ns_id = unsafe {
            spdk_nvmf_subsystem_add_ns(
                self.0.as_ptr(),
                bdev.as_ptr(),
                &opts as *const _,
                size_of::<spdk_bdev_nvme_opts>() as u64,
                ptr::null_mut(),
            )
        };

        // the first namespace should be 1 and we do not (currently) use
        // more than one namespace

        if ns_id < 1 {
            Err(Error::Namespace {
                bdev: bdev.name(),
                msg: "failed to add namespace ID".to_string(),
            })
        } else {
            info!("added NS ID {}", ns_id);
            Ok(())
        }
    }
/// add the given bdev to this namespace
add the given bdev to this namespace
add the given bdev to this namespace
pub fn add_namespace(&self, bdev: &Bdev) -> Result<(), Error> {
        let opts = spdk_nvmf_ns_opts {
            nguid: bdev.uuid().as_bytes(),
            ..Default::default()
        };
        let ns_id = unsafe {
            spdk_nvmf_subsystem_add_ns(
                self.0.as_ptr(),
                bdev.as_ptr(),
                &opts as *const _,
                size_of::<spdk_bdev_nvme_opts>() as u64,
                ptr::null_mut(),
            )
        };
        // the first namespace should be 1 and we do not (currently) use
        // more than one namespace
        if ns_id < 1 {
            Err(Error::Namespace {
                bdev: bdev.name(),
                msg: "failed to add namespace ID".to_string(),
            })
        } else {
            info!("added NS ID {}", ns_id);
            Ok(())
        }
    }
pub fn add_namespace ( & self , bdev : & Bdev ) -> Result < ( ) , Error > { let opts = spdk_nvmf_ns_opts { nguid : bdev . uuid ( ) . as_bytes ( ) , .. Default :: default ( ) } ; let ns_id = unsafe { spdk_nvmf_subsystem_add_ns ( self . 0 . as_ptr ( ) , bdev . as_ptr ( ) , & opts as * const _ , size_of :: < spdk_bdev_nvme_opts > ( ) as u64 , ptr :: null_mut ( ) , ) } ; // the first namespace should be 1 and we do not (currently) use // more than one namespace if ns_id < 1 { Err ( Error :: Namespace { bdev : bdev . name ( ) , msg : " " . to_string ( ) , } ) } else { info ! ( " " ns_id ) ; Ok ( ( ) ) } }
add the given bdev to this namespace
add the given bdev to this namespace
&self
bdev
&Bdev