/// Reads directory entries from an extent leaf node.
Reads directory entries from an extent leaf node.
Reads directory entries from an extent leaf node .
fn read_dir_entries(
        &self,
        extent: &Extent,
        entries: &mut Vec<Arc<DirEntry2>>,
    ) -> Result<(), ParsingError> {
        let block_size = self.block_size()?;
        let target_block_offset = extent.target_block_num() * block_size;
        // The `e2d_reclen` of the last entry will be large enough fill the
        // remaining space of the block.
        for block_index in 0..extent.e_len.get() {
            let mut dir_entry_offset = 0u64;
            while (dir_entry_offset + size_of::<DirEntryHeader>() as u64) < block_size {
                let offset =
                    dir_entry_offset + target_block_offset + (block_index as u64 * block_size);
                let de_header = DirEntryHeader::from_reader_with_offset(
                    self.reader.clone(),
                    offset,
                    ParsingError::InvalidDirEntry2(offset),
                )?;
                let mut de = DirEntry2 {
                    e2d_ino: de_header.e2d_ino,
                    e2d_reclen: de_header.e2d_reclen,
                    e2d_namlen: de_header.e2d_namlen,
                    e2d_type: de_header.e2d_type,
                    e2d_name: [0u8; 255],
                };
                self.reader.read(
                    offset + size_of::<DirEntryHeader>() as u64,
                    &mut de.e2d_name[..de.e2d_namlen as usize],
                )?;
                dir_entry_offset += de.e2d_reclen.get() as u64;
                if de.e2d_ino.get() != 0 {
                    entries.push(Arc::new(de));
                }
            }
        }
        Ok(())
    }
fn read_dir_entries ( & self , extent : & Extent , entries : & mut Vec < Arc < DirEntry2 > > , ) -> Result < ( ) , ParsingError > { let block_size = self . block_size ( ) ? ; let target_block_offset = extent . target_block_num ( ) * block_size ; // The `e2d_reclen` of the last entry will be large enough fill the // remaining space of the block. for block_index in 0 .. extent . e_len . get ( ) { let mut dir_entry_offset = 0u64 ; while ( dir_entry_offset + size_of :: < DirEntryHeader > ( ) as u64 ) < block_size { let offset = dir_entry_offset + target_block_offset + ( block_index as u64 * block_size ) ; let de_header = DirEntryHeader :: from_reader_with_offset ( self . reader . clone ( ) , offset , ParsingError :: InvalidDirEntry2 ( offset ) , ) ? ; let mut de = DirEntry2 { e2d_ino : de_header . e2d_ino , e2d_reclen : de_header . e2d_reclen , e2d_namlen : de_header . e2d_namlen , e2d_type : de_header . e2d_type , e2d_name : [ 0u8 ; 255 ] , } ; self . reader . read ( offset + size_of :: < DirEntryHeader > ( ) as u64 , & mut de . e2d_name [ .. de . e2d_namlen as usize ] , ) ? ; dir_entry_offset += de . e2d_reclen . get ( ) as u64 ; if de . e2d_ino . get ( ) != 0 { entries . push ( Arc :: new ( de ) ) ; } } } Ok ( ( ) ) }
Reads directory entries from an extent leaf node.
Reads directory entries from an extent leaf node .
&self
extent
&Extent
entries
&mut Vec<Arc<DirEntry2>>