RTEMS: cpukit/libfs/src/rfs/rtems-rfs-rtems.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
rtems-rfs-rtems.h
Go to the documentation of this file.
1
11/*
12 * COPYRIGHT (c) 2010 Chris Johns <chrisj@rtems.org>
13 *
14 * The license and distribution terms for this file may be
15 * found in the file LICENSE in this distribution or at
16 * http://www.rtems.org/license/LICENSE.
17 */
18
19#if !defined(RTEMS_RFS_RTEMS_DEFINED)
20#define RTEMS_RFS_RTEMS_DEFINED
21
22#include <stdbool.h>
23#include <stdint.h>
24#include <errno.h>
25
29#define RTEMS_RFS_RTEMS_ERROR 0
30
34#define RTEMS_RFS_RTEMS_TRACE 0
35
40#if !RTEMS_RFS_RTEMS_ERROR
41#define rtems_rfs_rtems_error(_m, _e) \
42 (((errno = (_e)) == 0) ? 0 : -1)
43#else
55int rtems_rfs_rtems_error (const char* mesg, int error);
56#endif
57
63#define RTEMS_RFS_RTEMS_DEBUG_ALL (0xffffffff)
64#define RTEMS_RFS_RTEMS_DEBUG_ERROR_MSGS (1 << 0)
65#define RTEMS_RFS_RTEMS_DEBUG_EVAL_PATH (1 << 1)
66#define RTEMS_RFS_RTEMS_DEBUG_EVAL_FOR_MAKE (1 << 2)
67#define RTEMS_RFS_RTEMS_DEBUG_EVAL_PERMS (1 << 3)
68#define RTEMS_RFS_RTEMS_DEBUG_MKNOD (1 << 4)
69#define RTEMS_RFS_RTEMS_DEBUG_RMNOD (1 << 5)
70#define RTEMS_RFS_RTEMS_DEBUG_LINK (1 << 6)
71#define RTEMS_RFS_RTEMS_DEBUG_UNLINK (1 << 7)
72#define RTEMS_RFS_RTEMS_DEBUG_CHOWN (1 << 8)
73#define RTEMS_RFS_RTEMS_DEBUG_READLINK (1 << 9)
74#define RTEMS_RFS_RTEMS_DEBUG_FCHMOD (1 << 10)
75#define RTEMS_RFS_RTEMS_DEBUG_STAT (1 << 11)
76#define RTEMS_RFS_RTEMS_DEBUG_RENAME (1 << 12)
77#define RTEMS_RFS_RTEMS_DEBUG_DIR_RMNOD (1 << 13)
78#define RTEMS_RFS_RTEMS_DEBUG_FILE_OPEN (1 << 14)
79#define RTEMS_RFS_RTEMS_DEBUG_FILE_CLOSE (1 << 15)
80#define RTEMS_RFS_RTEMS_DEBUG_FILE_READ (1 << 16)
81#define RTEMS_RFS_RTEMS_DEBUG_FILE_WRITE (1 << 17)
82#define RTEMS_RFS_RTEMS_DEBUG_FILE_LSEEK (1 << 18)
83#define RTEMS_RFS_RTEMS_DEBUG_FILE_FTRUNC (1 << 19)
84
95#if RTEMS_RFS_RTEMS_TRACE
96bool rtems_rfs_rtems_trace (uint32_t mask);
97#else
98#define rtems_rfs_rtems_trace(_m) (0)
99#endif
100
108#if RTEMS_RFS_RTEMS_TRACE
109void rtems_rfs_rtems_trace_set_mask (uint32_t mask);
110#else
111#define rtems_rfs_rtems_trace_set_mask(_m)
112#endif
113
121#if RTEMS_RFS_RTEMS_TRACE
122void rtems_rfs_rtems_trace_clear_mask (uint32_t mask);
123#else
124#define rtems_rfs_rtems_trace_clear_mask(_m)
125#endif
126
130#if RTEMS_RFS_RTEMS_TRACE
131int rtems_rfs_rtems_trace_shell_command (int argc, char *argv[]);
132#endif
133
134#include <rtems/rfs/rtems-rfs-file-system.h>
135#include <rtems/rfs/rtems-rfs-inode.h>
136#include <rtems/rfs/rtems-rfs-mutex.h>
137#include <rtems/libio_.h>
138#include <rtems/fs.h>
139
143 typedef struct rtems_rfs_rtems_private
144{
148 rtems_rfs_mutex access;
149} rtems_rfs_rtems_private;
156#define rtems_rfs_rtems_pathloc_dev(_loc) \
157 ((rtems_rfs_file_system*)((_loc)->mt_entry->fs_info))
158
165#define rtems_rfs_rtems_set_pathloc_ino(_loc, _ino) \
166 (_loc)->node_access = (void*)((intptr_t)(_ino))
167
174#define rtems_rfs_rtems_get_pathloc_ino(_loc) \
175 ((rtems_rfs_ino) (intptr_t)((_loc)->node_access))
176
183#define rtems_rfs_rtems_set_pathloc_doff(_loc, _doff) \
184 (_loc)->node_access_2 = (void*)((intptr_t)(_doff))
185
192#define rtems_rfs_rtems_get_pathloc_doff(_loc) \
193 ((uint32_t) (intptr_t)((_loc)->node_access_2))
194
201#define rtems_rfs_rtems_get_iop_ino(_iop) \
202 ((intptr_t)(_iop)->pathinfo.node_access)
203
210#define rtems_rfs_rtems_get_iop_file_handle(_iop) \
211 ((rtems_rfs_file_handle*)(_iop)->pathinfo.node_access_2)
212
219#define rtems_rfs_rtems_set_iop_file_handle(_iop, _fh) \
220 (_iop)->pathinfo.node_access_2 = (_fh)
221
228#define rtems_rfs_rtems_handlers(_h) \
229 &rtems_rfs_rtems_ ## _h ## _handlers
230
241bool rtems_rfs_rtems_set_handlers (rtems_filesystem_location_info_t* pathloc,
242 rtems_rfs_inode_handle* inode);
243
250uint16_t rtems_rfs_rtems_imode (mode_t mode);
251
258mode_t rtems_rfs_rtems_mode (int imode);
259
263static inline void
264 rtems_rfs_rtems_lock (rtems_rfs_file_system* fs)
265{
266 rtems_rfs_rtems_private* rtems = rtems_rfs_fs_user (fs);
267 rtems_rfs_mutex_lock (&rtems->access);
268}
269
273static inline void
274 rtems_rfs_rtems_unlock (rtems_rfs_file_system* fs)
275{
276 rtems_rfs_rtems_private* rtems = rtems_rfs_fs_user (fs);
277 rtems_rfs_buffers_release (fs);
278 rtems_rfs_mutex_unlock (&rtems->access);
279}
280
284extern const rtems_filesystem_file_handlers_r rtems_rfs_rtems_dir_handlers;
285extern const rtems_filesystem_file_handlers_r rtems_rfs_rtems_device_handlers;
286extern const rtems_filesystem_file_handlers_r rtems_rfs_rtems_link_handlers;
287extern const rtems_filesystem_file_handlers_r rtems_rfs_rtems_file_handlers;
288
292int rtems_rfs_rtems_fstat (const rtems_filesystem_location_info_t* pathloc,
293 struct stat* buf);
294
301int rtems_rfs_rtems_rmnod (const rtems_filesystem_location_info_t* parent_pathloc,
302 const rtems_filesystem_location_info_t* pathloc);
303
310int rtems_rfs_rtems_fdatasync (rtems_libio_t* iop);
311
312#endif
fs.h
Basic Filesystem Types.
libio_.h
LibIO Internal Interface.
rtems_rfs_buffers_release
int rtems_rfs_buffers_release(rtems_rfs_file_system *fs)
Definition: rtems-rfs-buffer.c:466
rtems-rfs-file-system.h
RTEMS File System Data.
rtems_rfs_fs_user
#define rtems_rfs_fs_user(_fs)
Definition: rtems-rfs-file-system.h:364
rtems-rfs-inode.h
RTEMS File System Information Node.
rtems-rfs-mutex.h
RTEMS File System Mutex.
rtems_rfs_mutex
uint32_t rtems_rfs_mutex
Definition: rtems-rfs-mutex.h:41
rtems_rfs_rtems_fstat
int rtems_rfs_rtems_fstat(const rtems_filesystem_location_info_t *pathloc, struct stat *buf)
Definition: rtems-rfs-rtems.c:416
rtems_rfs_rtems_link_handlers
const rtems_filesystem_file_handlers_r rtems_rfs_rtems_link_handlers
Definition: rtems-rfs-rtems.c:691
rtems_rfs_rtems_imode
uint16_t rtems_rfs_rtems_imode(mode_t mode)
Definition: rtems-rfs-rtems-utils.c:54
rtems_rfs_rtems_trace_clear_mask
#define rtems_rfs_rtems_trace_clear_mask(_m)
Definition: rtems-rfs-rtems.h:124
rtems_rfs_rtems_set_handlers
bool rtems_rfs_rtems_set_handlers(rtems_filesystem_location_info_t *pathloc, rtems_rfs_inode_handle *inode)
Definition: rtems-rfs-rtems-utils.c:32
rtems_rfs_rtems_error
#define rtems_rfs_rtems_error(_m, _e)
Definition: rtems-rfs-rtems.h:41
rtems_rfs_rtems_trace_set_mask
#define rtems_rfs_rtems_trace_set_mask(_m)
Definition: rtems-rfs-rtems.h:111
rtems_rfs_rtems_rmnod
int rtems_rfs_rtems_rmnod(const rtems_filesystem_location_info_t *parent_pathloc, const rtems_filesystem_location_info_t *pathloc)
Definition: rtems-rfs-rtems.c:563
rtems_rfs_rtems_dir_handlers
const rtems_filesystem_file_handlers_r rtems_rfs_rtems_dir_handlers
Definition: rtems-rfs-rtems-dir.c:155
rtems_rfs_rtems_trace
#define rtems_rfs_rtems_trace(_m)
Definition: rtems-rfs-rtems.h:98
rtems_rfs_rtems_fdatasync
int rtems_rfs_rtems_fdatasync(rtems_libio_t *iop)
Definition: rtems-rfs-rtems.c:593
rtems_rfs_rtems_mode
mode_t rtems_rfs_rtems_mode(int imode)
Definition: rtems-rfs-rtems-utils.c:63
_rtems_filesystem_file_handlers_r
File system node operations table.
Definition: libio.h:1005
_rtems_rfs_file_system
Definition: rtems-rfs-file-system.h:116
_rtems_rfs_inode_handle
Definition: rtems-rfs-inode.h:182
rtems_filesystem_location_info_tt
File system location.
Definition: fs.h:53
rtems_libio_tt
An open file data structure.
Definition: libio.h:1320
rtems_rfs_rtems_private
Definition: rtems-rfs-rtems.h:144
rtems_rfs_rtems_private::access
rtems_rfs_mutex access
Definition: rtems-rfs-rtems.h:148