pub fn new(
        name: &str,
        size: u64,
        uuid: Option<&str>,
        child_bdevs: Option<&[String]>,
    ) -> Box<Self> {
        let mut b = Box::new(spdk_bdev::default());

        b.name = c_str!(name);
        b.product_name = c_str!(NEXUS_PRODUCT_ID);
        b.fn_table = nexus::fn_table().unwrap();
        b.module = nexus::module().unwrap();
        b.blocklen = 0;
        b.blockcnt = 0;
        b.required_alignment = 9;

        let cfg = Config::get();

        let mut n = Box::new(Nexus {
            name: name.to_string(),
            child_count: 0,
            children: Vec::new(),
            bdev: Bdev::from(&*b as *const _ as *mut spdk_bdev),
            state: std::sync::Mutex::new(NexusState::Init),
            bdev_raw: Box::into_raw(b),
            data_ent_offset: 0,
            share_handle: None,
            size,
            nexus_target: None,
            max_io_attempts: cfg.err_store_opts.max_io_attempts,
        });

        n.bdev.set_uuid(match uuid {
            Some(uuid) => Some(uuid.to_string()),
            None => None,
        });

        if let Some(child_bdevs) = child_bdevs {
            n.register_children(child_bdevs);
        }

        // store a reference to the Self in the bdev structure.
        unsafe {
            (*n.bdev.as_ptr()).ctxt = n.as_ref() as *const _ as *mut c_void;
        }
        n
    }
/// create a new nexus instance with optionally directly attaching
/// children to it.
create a new nexus instance with optionally directly attaching
children to it.
create a new nexus instance with optionally directly attaching children to it .
pub fn new(
        name: &str,
        size: u64,
        uuid: Option<&str>,
        child_bdevs: Option<&[String]>,
    ) -> Box<Self> {
        let mut b = Box::new(spdk_bdev::default());
        b.name = c_str!(name);
        b.product_name = c_str!(NEXUS_PRODUCT_ID);
        b.fn_table = nexus::fn_table().unwrap();
        b.module = nexus::module().unwrap();
        b.blocklen = 0;
        b.blockcnt = 0;
        b.required_alignment = 9;
        let cfg = Config::get();
        let mut n = Box::new(Nexus {
            name: name.to_string(),
            child_count: 0,
            children: Vec::new(),
            bdev: Bdev::from(&*b as *const _ as *mut spdk_bdev),
            state: std::sync::Mutex::new(NexusState::Init),
            bdev_raw: Box::into_raw(b),
            data_ent_offset: 0,
            share_handle: None,
            size,
            nexus_target: None,
            max_io_attempts: cfg.err_store_opts.max_io_attempts,
        });
        n.bdev.set_uuid(match uuid {
            Some(uuid) => Some(uuid.to_string()),
            None => None,
        });
        if let Some(child_bdevs) = child_bdevs {
            n.register_children(child_bdevs);
        }
        // store a reference to the Self in the bdev structure.
        unsafe {
            (*n.bdev.as_ptr()).ctxt = n.as_ref() as *const _ as *mut c_void;
        }
        n
    }
pub fn new ( name : & str , size : u64 , uuid : Option < & str > , child_bdevs : Option < & [ String ] > , ) -> Box < Self > { let mut b = Box :: new ( spdk_bdev :: default ( ) ) ; b . name = c_str ! ( name ) ; b . product_name = c_str ! ( NEXUS_PRODUCT_ID ) ; b . fn_table = nexus :: fn_table ( ) . unwrap ( ) ; b . module = nexus :: module ( ) . unwrap ( ) ; b . blocklen = 0 ; b . blockcnt = 0 ; b . required_alignment = 9 ; let cfg = Config :: get ( ) ; let mut n = Box :: new ( Nexus { name : name . to_string ( ) , child_count : 0 , children : Vec :: new ( ) , bdev : Bdev :: from ( & * b as * const _ as * mut spdk_bdev ) , state : std :: sync :: Mutex :: new ( NexusState :: Init ) , bdev_raw : Box :: into_raw ( b ) , data_ent_offset : 0 , share_handle : None , size , nexus_target : None , max_io_attempts : cfg . err_store_opts . max_io_attempts , } ) ; n . bdev . set_uuid ( match uuid { Some ( uuid ) => Some ( uuid . to_string ( ) ) , None => None , } ) ; if let Some ( child_bdevs ) = child_bdevs { n . register_children ( child_bdevs ) ; } // store a reference to the Self in the bdev structure. unsafe { ( * n . bdev . as_ptr ( ) ) . ctxt = n . as_ref ( ) as * const _ as * mut c_void ; } n }
create a new nexus instance with optionally directly attaching
children to it.
create a new nexus instance with optionally directly attaching children to it .
name
&str
size
u64
uuid
Option<&str>
child_bdevs
Option<&[String]>