29 #if !defined (_RTEMS_RFS_BLOCK_POS_H_) 30 #define _RTEMS_RFS_BLOCK_POS_H_ 32 #include <rtems/rfs/rtems-rfs-file-system.h> 33 #include <rtems/rfs/rtems-rfs-inode.h> 78 #define rtems_rfs_block_copy_bpos(_lhs, _rhs) \ 79 do { (_lhs)->bno = (_rhs)->bno; \ 80 (_lhs)->boff = (_rhs)->boff; \ 81 (_lhs)->block = (_rhs)->block; } while (0) 163 #define rtems_rfs_block_copy_size(_lhs, _rhs) \ 164 do { (_lhs)->count = (_rhs)->count; \ 165 (_lhs)->offset = (_rhs)->offset; } while (0) 170 #define rtems_rfs_block_pos_last_block(_p, _s) \ 171 ((((_p)->bno == 0) && ((_s)->count == 0)) || ((_p)->bno == ((_s)->count - 1))) 176 #define rtems_rfs_block_pos_past_end(_p, _s) \ 177 (((_p)->bno && ((_s)->count == 0)) || \ 178 ((_p)->bno >= (_s)->count) || \ 179 (((_p)->bno == ((_s)->count - 1)) && ((_p)->boff > (_s)->offset))) 184 #define rtems_rfs_block_pos_block_past_end(_p, _s) \ 185 (((_p)->bno && ((_s)->count == 0)) || ((_p)->bno >= (_s)->count)) 191 #define rtems_rfs_block_size_get_bpos(_s, _b) \ 192 do { (_b)->bno = (_s)->count; \ 193 (_b)->boff = (_s)->offset; \ 195 if ((_b)->boff) --(_b)->bno; } while (0) 200 #define rtems_rfs_block_size_equal(_lhs, _rhs) \ 201 (((_lhs)->count == (_rhs)->count) && ((_lhs)->offset == (_rhs)->offset)) struct rtems_rfs_block_size_s rtems_rfs_block_size
A block size is the number of blocks less one plus the offset where the offset must be less than the ...
A block size is the number of blocks less one plus the offset where the offset must be less than the ...
Definition: rtems-rfs-block-pos.h:141
rtems_rfs_pos rtems_rfs_block_get_size(rtems_rfs_file_system *fs, rtems_rfs_block_size *size)
Calculate the position given the number of blocks and the offset.
Definition: rtems-rfs-block.c:78
void rtems_rfs_block_get_block_size(rtems_rfs_file_system *fs, rtems_rfs_pos pos, rtems_rfs_block_size *size)
Set the size given a position.
Definition: rtems-rfs-block.c:64
uint32_t rtems_rfs_inode_block
The size of a block value on disk.
Definition: rtems-rfs-inode.h:89
struct rtems_rfs_block_pos_s rtems_rfs_block_pos
A block position is a block number times the block size plus the offset.
RFS File System data.
Definition: rtems-rfs-file-system.h:123
uint64_t rtems_rfs_pos
Absolute position.
Definition: rtems-rfs-file-system.h:90
rtems_rfs_inode_block rtems_rfs_block_no
The block number is the same type as the inode block number.
Definition: rtems-rfs-block-pos.h:39
uint32_t rtems_rfs_block_off
The offset into a block.
Definition: rtems-rfs-block-pos.h:44
rtems_rfs_block_off offset
The offset into the block.
Definition: rtems-rfs-block-pos.h:153
rtems_rfs_pos rtems_rfs_block_get_pos(rtems_rfs_file_system *fs, rtems_rfs_block_pos *bpos)
Given a block position compute the absolute offset.
Definition: rtems-rfs-block.c:57
rtems_rfs_block_off boff
The offset into the block.
Definition: rtems-rfs-block-pos.h:62
A block position is a block number times the block size plus the offset.
Definition: rtems-rfs-block-pos.h:51
rtems_rfs_block_no count
The count of blocks in a map.
Definition: rtems-rfs-block-pos.h:147
rtems_rfs_block_no block
The block number that the bpos + boff map to.
Definition: rtems-rfs-block-pos.h:68
void rtems_rfs_block_get_bpos(rtems_rfs_file_system *fs, rtems_rfs_pos pos, rtems_rfs_block_pos *bpos)
Given a position compute the block number and block offset.
Definition: rtems-rfs-block.c:48
int64_t rtems_rfs_pos_rel
Relative position.
Definition: rtems-rfs-file-system.h:95
rtems_rfs_block_no bno
The block index in the map.
Definition: rtems-rfs-block-pos.h:57