Skip to main content

write_dir_entry

Function write_dir_entry 

Source
pub fn write_dir_entry<W: Write>(
    writer: &mut W,
    name: &str,
    inode: u32,
    mode: u16,
    link_inode: Option<u32>,
    link_mode: Option<u16>,
    block_size: u32,
    left: &mut i32,
) -> Result<()>
Expand description

Write a single directory entry.

left tracks the number of remaining bytes in the current directory block. If there is not enough room for both this entry and a trailing terminator (12 bytes minimum), the current block is finished first with a zero-inode terminator before writing this entry at the start of a new block.

When link_inode is Some, the entry’s inode number is taken from link_inode and the file type is derived from link_mode (the target inode’s mode). Otherwise, inode and mode are used directly.