/// Read next packet from the kernel driver
Read next packet from the kernel driver
Read next packet from the kernel driver
fn next_packet<'a>(&mut self, buffer: &'a mut [u8]) -> io::Result<Option<&'a [u8]>> {
        loop {
            match self.channel.read(buffer) {
                // Received packet from the kernel driver, return it
                Ok(len) => return Ok(Some(&buffer[..len])),
                // Error while reading from the kernel driver
                Err(err) => match err.raw_os_error() {
                    // Operation interrupted. Accordingly to FUSE, this is safe to retry
                    Some(libc::ENOENT) => continue,
                    // Interrupted system call, retry
                    Some(libc::EINTR) => continue,
                    // Explicitly try again
                    Some(libc::EAGAIN) => continue,
                    // Filesystem was unmounted, quit the loop
                    Some(libc::ENODEV) => break,
                    // Some other error occured, return it
                    _ => return Err(err),
                },
            }
        }
        Ok(None)
    }
fn next_packet < ' a > ( & mut self , buffer : & ' a mut [ u8 ] ) -> io :: Result < Option < & ' a [ u8 ] > > { loop { match self . channel . read ( buffer ) { // Received packet from the kernel driver, return it Ok ( len ) => return Ok ( Some ( & buffer [ .. len ] ) ) , // Error while reading from the kernel driver Err ( err ) => match err . raw_os_error ( ) { // Operation interrupted. Accordingly to FUSE, this is safe to retry Some ( libc :: ENOENT ) => continue , // Interrupted system call, retry Some ( libc :: EINTR ) => continue , // Explicitly try again Some ( libc :: EAGAIN ) => continue , // Filesystem was unmounted, quit the loop Some ( libc :: ENODEV ) => break , // Some other error occured, return it _ => return Err ( err ) , } , } } Ok ( None ) }
Read next packet from the kernel driver
Read next packet from the kernel driver
&mut self
buffer
&'a mut [u8]