RTEMS  5.0.0
rtems-rfs-file.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 #if !defined (_RTEMS_RFS_FILE_H_)
22 #define _RTEMS_RFS_FILE_H_
23 
24 #include <rtems/libio_.h>
25 
30 
37 typedef struct _rtems_rfs_file_shared
38 {
43 
48 
53 
59 
65 
70 
75 
80 
86 
88 
96 static inline rtems_rfs_time
97 rtems_rfs_file_shared_get_atime (rtems_rfs_file_shared* shared)
98 {
99  return shared->atime;
100 }
101 
109 static inline rtems_rfs_time
110 rtems_rfs_file_shared_get_mtime (rtems_rfs_file_shared* shared)
111 {
112  return shared->mtime;
113 }
114 
122 static inline rtems_rfs_time
123 rtems_rfs_file_shared_get_ctime (rtems_rfs_file_shared* shared)
124 {
125  return shared->ctime;
126 }
127 
135 static inline uint32_t
136 rtems_rfs_file_shared_get_block_count (rtems_rfs_file_shared* shared)
137 {
138  return shared->size.count;
139 }
140 
148 static inline uint16_t
149 rtems_rfs_file_shared_get_block_offset (rtems_rfs_file_shared* shared)
150 {
151  return shared->size.offset;
152 }
153 
162 static inline rtems_rfs_pos
163 rtems_rfs_file_shared_get_size (rtems_rfs_file_system* fs,
164  rtems_rfs_file_shared* shared)
165 {
166  return rtems_rfs_block_get_size (fs, &shared->size);
167 }
168 
172 #define RTEMS_RFS_FILE_NO_ATIME_UPDATE (1 << 0)
175 #define RTEMS_RFS_FILE_NO_MTIME_UPDATE (1 << 1)
178 #define RTEMS_RFS_FILE_NO_LENGTH_UPDATE (1 << 2)
185 typedef struct _rtems_rfs_file_handle
186 {
190  int flags;
200  rtems_rfs_block_pos bpos;
205  rtems_rfs_file_shared* shared;
208 
212 #define rtems_rfs_file_data(_f) \
213  (rtems_rfs_buffer_data (&(_f)->buffer) + (_f)->bpos.boff)
214 
218 #define rtems_rfs_file_fs(_f) ((_f)->shared->fs)
219 
223 #define rtems_rfs_file_inode(_f) (&(_f)->shared->inode)
228 #define rtems_rfs_file_map(_f) (&(_f)->shared->map)
233 #define rtems_rfs_file_bpos(_f) (&(_f)->bpos)
238 #define rtems_rfs_file_block(_f) ((_f)->bpos.bno)
243 #define rtems_rfs_file_block_offset(_f) ((_f)->bpos.boff)
248 #define rtems_rfs_file_set_bpos(_f, _p) \
249  rtems_rfs_block_get_bpos (rtems_rfs_file_fs (_f), _p, (&(_f)->bpos))
250 
254 #define rtems_rfs_file_buffer(_f) (&(_f)->buffer)
255 
259 #define rtems_rfs_file_update_atime(_f) \
260  (((_f)->flags & RTEMS_RFS_FILE_NO_ATIME_UPDATE) == 0)
261 
265 #define rtems_rfs_file_update_mtime(_f) \
266  (((_f)->flags & RTEMS_RFS_FILE_NO_MTIME_UPDATE) == 0)
267 
271 #define rtems_rfs_file_update_length(_f) \
272  (((_f)->flags & RTEMS_RFS_FILE_NO_LENGTH_UPDATE) == 0)
273 
277 #define rtems_rfs_file_get_size(_f) \
278  (&(_f)->shared->size)
279 
283 #define rtems_rfs_file_size(_f) \
284  rtems_rfs_file_shared_get_size (rtems_rfs_file_fs (_f), (_f)->shared)
285 
289 #define rtems_rfs_file_size_count(_f) \
290  rtems_rfs_file_shared_get_block_count ((_f)->shared)
291 
295 #define rtems_rfs_file_size_offset(_f) \
296  rtems_rfs_file_shared_get_block_offset ((_f)->shared)
297 
309  rtems_rfs_ino ino,
310  int oflag,
311  rtems_rfs_file_handle** handle);
312 
323  rtems_rfs_file_handle* handle);
324 
342  size_t* available,
343  bool read);
344 
360  size_t size,
361  bool read);
362 
374 
387  rtems_rfs_pos pos,
388  rtems_rfs_pos* new_pos);
389 
401 
413  rtems_rfs_ino ino);
414 
415 
416 #endif
Definition: chain.h:65
ssize_t read(int fd, void *buffer, size_t count)
Definition: read.c:27
rtems_chain_node link
Definition: rtems-rfs-file.h:42
RTEMS File System Data.
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)
Definition: rtems-rfs-block.c:78
int rtems_rfs_file_io_start(rtems_rfs_file_handle *handle, size_t *available, bool read)
Definition: rtems-rfs-file.c:221
rtems_rfs_time atime
Definition: rtems-rfs-file.h:69
rtems_rfs_file_shared * rtems_rfs_file_get_shared(rtems_rfs_file_system *fs, rtems_rfs_ino ino)
Definition: rtems-rfs-file.c:620
RTEMS File System Data.
rtems_rfs_time mtime
Definition: rtems-rfs-file.h:74
Definition: rtems-rfs-file-system.h:123
int rtems_rfs_file_set_size(rtems_rfs_file_handle *handle, rtems_rfs_pos size)
Definition: rtems-rfs-file.c:470
uint64_t rtems_rfs_pos
Definition: rtems-rfs-file-system.h:90
int rtems_rfs_file_seek(rtems_rfs_file_handle *handle, rtems_rfs_pos pos, rtems_rfs_pos *new_pos)
Definition: rtems-rfs-file.c:406
uint32_t rtems_rfs_ino
Definition: rtems-rfs-inode.h:78
rtems_rfs_block_map map
Definition: rtems-rfs-file.h:58
rtems_rfs_block_off offset
Definition: rtems-rfs-block-pos.h:153
Definition: rtems-rfs-file.h:37
int rtems_rfs_file_io_release(rtems_rfs_file_handle *handle)
Definition: rtems-rfs-file.c:396
Definition: rtems-rfs-inode.h:181
Definition: rtems-rfs-file.h:191
rtems_rfs_block_size size
Definition: rtems-rfs-file.h:64
Definition: rtems-rfs-block-pos.h:51
RTEMS File System Information Node.
rtems_rfs_block_no count
Definition: rtems-rfs-block-pos.h:147
Definition: rtems-rfs-block.h:92
rtems_rfs_file_system * fs
Definition: rtems-rfs-file.h:85
int rtems_rfs_file_close(rtems_rfs_file_system *fs, rtems_rfs_file_handle *handle)
Definition: rtems-rfs-file.c:144
rtems_rfs_time ctime
Definition: rtems-rfs-file.h:79
LibIO Internal Interface.
RTEMS File Systems Block Management.
rtems_rfs_inode_handle inode
Definition: rtems-rfs-file.h:52
uint32_t rtems_rfs_time
Definition: rtems-rfs-inode.h:83
int rtems_rfs_file_io_end(rtems_rfs_file_handle *handle, size_t size, bool read)
Definition: rtems-rfs-file.c:309
struct _rtems_rfs_file_shared rtems_rfs_file_shared
Definition: rtems-rfs-buffer.h:91
int references
Definition: rtems-rfs-file.h:47
int rtems_rfs_file_open(rtems_rfs_file_system *fs, rtems_rfs_ino ino, int oflag, rtems_rfs_file_handle **handle)
Definition: rtems-rfs-file.c:32
struct _rtems_rfs_file_handle rtems_rfs_file_handle