RTEMS
5.0.0
|
#include <rtems-rfs-block.h>
A block map manges the block lists that originate from an inode. The inode contains a number of block numbers. A block map takes those block numbers and manages them.
The blocks cannot have all ones as a block number nor block 0. The block map is series of block numbers in a blocks. The size of the map determines the way the block numbers are stored. The map uses the following:
Direct access has the blocks numbers in the inode slots. The Single Indirect Access has block numbers in the inode slots that pointer to a table of block numbers that point to data blocks. The Double Indirect Access has block numbers in the inode that point to Single Indirect block tables.
The inode can hold a number of Direct, Single Indirect, and Double Indirect block tables. The move from Direct to Single occurs then the block count in the map is above the number of slots in the inode. The move from Single to Double occurs when the map block count is greated than the block numbers per block multipled by the slots in the inode. The move from Single to Double occurs when the map block count is over the block numbers per block squared multipled by the number of slots in the inode.
The block map can managed files of the follow size verses block size with 5 inode slots:
uint32_t rtems_rfs_block_map_s::blocks[RTEMS_RFS_INODE_BLOCKS] |
The block map.
rtems_rfs_block_pos rtems_rfs_block_map_s::bpos |
The block map position. Used to navigate the map when seeking. The find call is to a position in the file/directory and is a block number plus offset. The block find only needs to locate a block and not worry about the offset while a seek can be less than a block size yet move across a block boundary. Therefore the position a block map has to maintain must include the offset so seeks work.
bool rtems_rfs_block_map_s::dirty |
Is the map dirty ?
rtems_rfs_buffer_handle rtems_rfs_block_map_s::doubly_buffer |
Doubly Buffer handle.
rtems_rfs_inode_handle* rtems_rfs_block_map_s::inode |
The inode this map is attached to.
rtems_rfs_block_no rtems_rfs_block_map_s::last_data_block |
The last data block allocated. This is used as the goal when allocating a new data block.
rtems_rfs_block_no rtems_rfs_block_map_s::last_map_block |
The last map block allocated. This is used as the goal when allocating a new map block.
rtems_rfs_buffer_handle rtems_rfs_block_map_s::singly_buffer |
Singly Buffer handle.
rtems_rfs_block_size rtems_rfs_block_map_s::size |
The size of the map.