Data Structures |
| struct | rtems_rfs_block_map_s |
| | A block map manges the block lists that originate from an inode. More...
|
Defines |
| #define | rtems_rfs_block_get_number(_h, _b) |
| | Get a block number in the media format and return it in the host format.
|
| #define | rtems_rfs_block_set_number(_h, _b, _n) |
| | Set a block number in the media format given a number in the host format.
|
|
#define | rtems_rfs_block_map_is_dirty(_m) ((_m)->dirty) |
| | Is the map dirty ?
|
|
#define | rtems_rfs_block_map_count(_m) ((_m)->size.count) |
| | Return the block count in the map.
|
|
#define | rtems_rfs_block_map_size(_m) (&((_m)->size)) |
| | Return the map's size element.
|
|
#define | rtems_rfs_block_map_size_offset(_m) ((_m)->size.offset) |
| | Return the size offset for the map.
|
|
#define | rtems_rfs_block_map_last(_m) rtems_rfs_block_pos_last_block (&(_m)->bpos, &(_m)->size) |
| | Are we at the last block in the map ?
|
|
#define | rtems_rfs_block_map_past_end(_m, _p) rtems_rfs_block_pos_past_end (_p, &(_m)->size) |
| | Is the position past the end of the block ?
|
|
#define | rtems_rfs_block_map_pos(_f, _m) rtems_rfs_block_get_pos (_f, &(_m)->bpos) |
| | Return the current position in the map.
|
|
#define | rtems_rfs_block_map_block(_m) ((_m)->bpos.bno) |
| | Return the map's current block number.
|
|
#define | rtems_rfs_block_map_block_offset(_m) ((_m)->bpos.boff) |
| | Return the map's current block offset.
|
Typedefs |
typedef struct
rtems_rfs_block_map_s | rtems_rfs_block_map |
| | A block map manges the block lists that originate from an inode.
|
Functions |
| int | rtems_rfs_block_map_open (rtems_rfs_file_system *fs, rtems_rfs_inode_handle *inode, rtems_rfs_block_map *map) |
| | Open a block map.
|
| int | rtems_rfs_block_map_close (rtems_rfs_file_system *fs, rtems_rfs_block_map *map) |
| | Close the map.
|
| int | rtems_rfs_block_map_find (rtems_rfs_file_system *fs, rtems_rfs_block_map *map, rtems_rfs_block_pos *bpos, rtems_rfs_buffer_block *block) |
| | Find a block number in the map from the position provided.
|
| int | rtems_rfs_block_map_seek (rtems_rfs_file_system *fs, rtems_rfs_block_map *map, rtems_rfs_pos_rel offset, rtems_rfs_buffer_block *block) |
| | Seek around the map.
|
| int | rtems_rfs_block_map_next_block (rtems_rfs_file_system *fs, rtems_rfs_block_map *map, rtems_rfs_buffer_block *block) |
| | Seek to the next block.
|
| int | rtems_rfs_block_map_grow (rtems_rfs_file_system *fs, rtems_rfs_block_map *map, size_t blocks, rtems_rfs_block_no *new_block) |
| | Grow the block map by the specified number of blocks.
|
| int | rtems_rfs_block_map_shrink (rtems_rfs_file_system *fs, rtems_rfs_block_map *map, size_t blocks) |
| | Grow the block map by the specified number of blocks.
|
| int | rtems_rfs_block_map_free_all (rtems_rfs_file_system *fs, rtems_rfs_block_map *map) |
| | Free all blocks in the map.
|
RTEMS File Systems Block Management.
RTEMS File Systems Block Management.
These functions manage the blocks used in the file system.
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,
- Single Indirect Access, and
- Double Indirect Access.
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:
- 41,943,040 bytes for a 512 byte block size,
- 335,544,320 bytes for a 1024 byte block size,
- 2,684,354,560 bytes for a 2048 byte block size, and
- 21,474,836,480 bytes for a 4096 byte block size.