RTEMS  5.1
rtems-rfs-block.h
Go to the documentation of this file.
1 
13 /*
14  * COPYRIGHT (c) 2010 Chris Johns <chrisj@rtems.org>
15  *
16  * The license and distribution terms for this file may be
17  * found in the file LICENSE in this distribution or at
18  * http://www.rtems.org/license/LICENSE.
19  */
20 
21 
22 #if !defined (_RTEMS_RFS_BLOCK_H_)
23 #define _RTEMS_RFS_BLOCK_H_
24 
29 
38 #define rtems_rfs_block_get_number(_h, _b) \
39  ((rtems_rfs_block_no) \
40  (rtems_rfs_read_u32 (rtems_rfs_buffer_data (_h) + \
41  ((_b) * sizeof (rtems_rfs_block_no)))))
42 
51 #define rtems_rfs_block_set_number(_h, _b, _n) \
52  do { \
53  rtems_rfs_write_u32 (rtems_rfs_buffer_data (_h) + \
54  ((_b) * sizeof (rtems_rfs_block_no)), (_n)); \
55  rtems_rfs_buffer_mark_dirty (_h); \
56  } while (0)
57 
92 typedef struct rtems_rfs_block_map_s
93 {
97  bool dirty;
98 
103 
108 
118 
124 
130 
135 
140 
145 
147 
151 #define rtems_rfs_block_map_is_dirty(_m) ((_m)->dirty)
152 
156 #define rtems_rfs_block_map_count(_m) ((_m)->size.count)
157 
161 #define rtems_rfs_block_map_size(_m) (&((_m)->size))
162 
166 #define rtems_rfs_block_map_size_offset(_m) ((_m)->size.offset)
167 
171 #define rtems_rfs_block_map_last(_m) \
172  rtems_rfs_block_pos_last_block (&(_m)->bpos, &(_m)->size)
173 
177 #define rtems_rfs_block_map_past_end(_m, _p) \
178  rtems_rfs_block_pos_past_end (_p, &(_m)->size)
179 
183 #define rtems_rfs_block_map_pos(_f, _m) \
184  rtems_rfs_block_get_pos (_f, &(_m)->bpos)
185 
189 #define rtems_rfs_block_map_block(_m) ((_m)->bpos.bno)
190 
194 #define rtems_rfs_block_map_block_offset(_m) ((_m)->bpos.boff)
195 
202 static inline void
203 rtems_rfs_block_map_set_size_offset (rtems_rfs_block_map* map,
204  rtems_rfs_block_off offset)
205 {
206  map->size.offset = offset;
207  map->dirty = true;
208 }
209 
216 static inline void
217 rtems_rfs_block_map_set_size (rtems_rfs_block_map* map,
219 {
221  map->dirty = true;
222 }
236  rtems_rfs_inode_handle* inode,
238 
251 
265  rtems_rfs_block_pos* bpos,
266  rtems_rfs_buffer_block* block);
267 
282  rtems_rfs_pos_rel offset,
283  rtems_rfs_buffer_block* block);
284 
298  rtems_rfs_buffer_block* block);
299 
314  size_t blocks,
315  rtems_rfs_block_no* new_block);
316 
330  size_t blocks);
331 
343 
344 #endif
RTEMS File Systems Block Position and Size Management.
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)
Definition: rtems-rfs-block.c:233
RTEMS File System Data.
Definition: rtems-rfs-block-pos.h:141
bool dirty
Definition: rtems-rfs-block.h:97
#define RTEMS_RFS_INODE_BLOCKS
Definition: rtems-rfs-file-system.h:67
uint32_t blocks[RTEMS_RFS_INODE_BLOCKS]
Definition: rtems-rfs-block.h:134
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)
Definition: rtems-rfs-block.c:333
#define rtems_rfs_block_copy_size(_lhs, _rhs)
Definition: rtems-rfs-block-pos.h:163
RTEMS File System Data.
Definition: rtems-rfs-file-system.h:123
uint32_t rtems_rfs_buffer_block
Definition: rtems-rfs-buffer.h:62
rtems_rfs_inode_block rtems_rfs_block_no
Definition: rtems-rfs-block-pos.h:39
uint32_t rtems_rfs_block_off
Definition: rtems-rfs-block-pos.h:44
int rtems_rfs_block_map_next_block(rtems_rfs_file_system *fs, rtems_rfs_block_map *map, rtems_rfs_buffer_block *block)
Definition: rtems-rfs-block.c:345
int rtems_rfs_block_map_shrink(rtems_rfs_file_system *fs, rtems_rfs_block_map *map, size_t blocks)
Definition: rtems-rfs-block.c:649
rtems_rfs_block_no last_data_block
Definition: rtems-rfs-block.h:129
rtems_rfs_inode_handle * inode
Definition: rtems-rfs-block.h:102
rtems_rfs_block_pos bpos
Definition: rtems-rfs-block.h:117
rtems_rfs_buffer_handle singly_buffer
Definition: rtems-rfs-block.h:139
Definition: rtems-rfs-inode.h:181
Definition: rtems-rfs-block-pos.h:51
rtems_rfs_block_no last_map_block
Definition: rtems-rfs-block.h:123
Definition: rtems-rfs-block.h:92
int rtems_rfs_block_map_close(rtems_rfs_file_system *fs, rtems_rfs_block_map *map)
Definition: rtems-rfs-block.c:146
rtems_rfs_buffer_handle doubly_buffer
Definition: rtems-rfs-block.h:144
rtems_rfs_block_size size
Definition: rtems-rfs-block.h:107
Maps Blocks to the Media Interface Layers.
int rtems_rfs_block_map_free_all(rtems_rfs_file_system *fs, rtems_rfs_block_map *map)
Definition: rtems-rfs-block.c:796
Definition: rtems-rfs-buffer.h:91
Definition: mm.c:60
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)
Definition: rtems-rfs-block.c:406
unsigned size
Definition: tte.h:74
int64_t rtems_rfs_pos_rel
Definition: rtems-rfs-file-system.h:95
struct rtems_rfs_block_map_s rtems_rfs_block_map
int rtems_rfs_block_map_open(rtems_rfs_file_system *fs, rtems_rfs_inode_handle *inode, rtems_rfs_block_map *map)
Definition: rtems-rfs-block.c:95