pub(crate) extern "C" fn create(
        device: *mut c_void,
        ctx: *mut c_void,
    ) -> i32 {
        let nexus = unsafe { Nexus::from_raw(device) };
        debug!("{}: Creating IO channels at {:p}", nexus.bdev.name(), ctx);

        let ch = NexusChannel::from_raw(ctx);
        let mut channels = Box::new(NexusChannelInner {
            writers: Vec::new(),
            readers: Vec::new(),
            previous: 0,
            device,
        });

        nexus
            .children
            .iter_mut()
            .filter(|c| c.state() == ChildState::Open)
            .for_each(|c| match (c.handle(), c.handle()) {
                (Ok(w), Ok(r)) => {
                    channels.writers.push(w);
                    channels.readers.push(r);
                }
                _ => {
                    c.set_state(ChildState::Faulted(Reason::CantOpen));
                    error!("Failed to get handle for {}, skipping bdev", c)
                }
            });
        ch.inner = Box::into_raw(channels);
        0
    }
/// allocates an io channel per child
allocates an io channel per child
allocates an io channel per child
pub(crate) extern "C" fn create(
        device: *mut c_void,
        ctx: *mut c_void,
    ) -> i32 {
        let nexus = unsafe { Nexus::from_raw(device) };
        debug!("{}: Creating IO channels at {:p}", nexus.bdev.name(), ctx);
        let ch = NexusChannel::from_raw(ctx);
        let mut channels = Box::new(NexusChannelInner {
            writers: Vec::new(),
            readers: Vec::new(),
            previous: 0,
            device,
        });
        nexus
            .children
            .iter_mut()
            .filter(|c| c.state() == ChildState::Open)
            .for_each(|c| match (c.handle(), c.handle()) {
                (Ok(w), Ok(r)) => {
                    channels.writers.push(w);
                    channels.readers.push(r);
                }
                _ => {
                    c.set_state(ChildState::Faulted(Reason::CantOpen));
                    error!("Failed to get handle for {}, skipping bdev", c)
                }
            });
        ch.inner = Box::into_raw(channels);
        0
    }
pub ( crate ) extern " " fn create ( device : * mut c_void , ctx : * mut c_void , ) -> i32 { let nexus = unsafe { Nexus :: from_raw ( device ) } ; debug ! ( " " nexus bdev name ( ) ctx ) ; let ch = NexusChannel :: from_raw ( ctx ) ; let mut channels = Box :: new ( NexusChannelInner { writers : Vec :: new ( ) , readers : Vec :: new ( ) , previous : 0 , device , } ) ; nexus . children . iter_mut ( ) . filter ( | c | c . state ( ) == ChildState :: Open ) . for_each ( | c | match ( c . handle ( ) , c . handle ( ) ) { ( Ok ( w ) , Ok ( r ) ) => { channels . writers . push ( w ) ; channels . readers . push ( r ) ; } _ => { c . set_state ( ChildState :: Faulted ( Reason :: CantOpen ) ) ; error ! ( " " c ) } } ) ; ch . inner = Box :: into_raw ( channels ) ; 0 }
allocates an io channel per child
allocates an io channel per child
device
*mut c_void
ctx
*mut c_void