RTEMS 6.1-rc6
Loading...
Searching...
No Matches
rtems-rfs-rtems.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
13/*
14 * COPYRIGHT (c) 2010 Chris Johns <chrisj@rtems.org>
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#if !defined(RTEMS_RFS_RTEMS_DEFINED)
39#define RTEMS_RFS_RTEMS_DEFINED
40
41#include <stdbool.h>
42#include <stdint.h>
43#include <errno.h>
44
48#define RTEMS_RFS_RTEMS_ERROR 0
49
53#define RTEMS_RFS_RTEMS_TRACE 0
54
59#if !RTEMS_RFS_RTEMS_ERROR
60#define rtems_rfs_rtems_error(_m, _e) \
61 (((errno = (_e)) == 0) ? 0 : -1)
62#else
74int rtems_rfs_rtems_error (const char* mesg, int error);
75#endif
76
82#define RTEMS_RFS_RTEMS_DEBUG_ALL (0xffffffff)
83#define RTEMS_RFS_RTEMS_DEBUG_ERROR_MSGS (1 << 0)
84#define RTEMS_RFS_RTEMS_DEBUG_EVAL_PATH (1 << 1)
85#define RTEMS_RFS_RTEMS_DEBUG_EVAL_FOR_MAKE (1 << 2)
86#define RTEMS_RFS_RTEMS_DEBUG_EVAL_PERMS (1 << 3)
87#define RTEMS_RFS_RTEMS_DEBUG_MKNOD (1 << 4)
88#define RTEMS_RFS_RTEMS_DEBUG_RMNOD (1 << 5)
89#define RTEMS_RFS_RTEMS_DEBUG_LINK (1 << 6)
90#define RTEMS_RFS_RTEMS_DEBUG_UNLINK (1 << 7)
91#define RTEMS_RFS_RTEMS_DEBUG_CHOWN (1 << 8)
92#define RTEMS_RFS_RTEMS_DEBUG_READLINK (1 << 9)
93#define RTEMS_RFS_RTEMS_DEBUG_FCHMOD (1 << 10)
94#define RTEMS_RFS_RTEMS_DEBUG_STAT (1 << 11)
95#define RTEMS_RFS_RTEMS_DEBUG_RENAME (1 << 12)
96#define RTEMS_RFS_RTEMS_DEBUG_DIR_RMNOD (1 << 13)
97#define RTEMS_RFS_RTEMS_DEBUG_FILE_OPEN (1 << 14)
98#define RTEMS_RFS_RTEMS_DEBUG_FILE_CLOSE (1 << 15)
99#define RTEMS_RFS_RTEMS_DEBUG_FILE_READ (1 << 16)
100#define RTEMS_RFS_RTEMS_DEBUG_FILE_WRITE (1 << 17)
101#define RTEMS_RFS_RTEMS_DEBUG_FILE_LSEEK (1 << 18)
102#define RTEMS_RFS_RTEMS_DEBUG_FILE_FTRUNC (1 << 19)
103
114#if RTEMS_RFS_RTEMS_TRACE
115bool rtems_rfs_rtems_trace (uint32_t mask);
116#else
117#define rtems_rfs_rtems_trace(_m) (0)
118#endif
119
127#if RTEMS_RFS_RTEMS_TRACE
128void rtems_rfs_rtems_trace_set_mask (uint32_t mask);
129#else
130#define rtems_rfs_rtems_trace_set_mask(_m)
131#endif
132
140#if RTEMS_RFS_RTEMS_TRACE
141void rtems_rfs_rtems_trace_clear_mask (uint32_t mask);
142#else
143#define rtems_rfs_rtems_trace_clear_mask(_m)
144#endif
145
149#if RTEMS_RFS_RTEMS_TRACE
150int rtems_rfs_rtems_trace_shell_command (int argc, char *argv[]);
151#endif
152
156#include <rtems/libio_.h>
157#include <rtems/fs.h>
158
163{
175#define rtems_rfs_rtems_pathloc_dev(_loc) \
176 ((rtems_rfs_file_system*)((_loc)->mt_entry->fs_info))
177
184#define rtems_rfs_rtems_set_pathloc_ino(_loc, _ino) \
185 (_loc)->node_access = (void*)((intptr_t)(_ino))
186
193#define rtems_rfs_rtems_get_pathloc_ino(_loc) \
194 ((rtems_rfs_ino) (intptr_t)((_loc)->node_access))
195
202#define rtems_rfs_rtems_set_pathloc_doff(_loc, _doff) \
203 (_loc)->node_access_2 = (void*)((intptr_t)(_doff))
204
211#define rtems_rfs_rtems_get_pathloc_doff(_loc) \
212 ((uint32_t) (intptr_t)((_loc)->node_access_2))
213
220#define rtems_rfs_rtems_get_iop_ino(_iop) \
221 ((intptr_t)(_iop)->pathinfo.node_access)
222
229#define rtems_rfs_rtems_get_iop_file_handle(_iop) \
230 ((rtems_rfs_file_handle*)(_iop)->pathinfo.node_access_2)
231
238#define rtems_rfs_rtems_set_iop_file_handle(_iop, _fh) \
239 (_iop)->pathinfo.node_access_2 = (_fh)
240
247#define rtems_rfs_rtems_handlers(_h) \
248 &rtems_rfs_rtems_ ## _h ## _handlers
249
262
269uint16_t rtems_rfs_rtems_imode (mode_t mode);
270
277mode_t rtems_rfs_rtems_mode (int imode);
278
282static inline void
283 rtems_rfs_rtems_lock (rtems_rfs_file_system* fs)
284{
286 rtems_rfs_mutex_lock (&rtems->access);
287}
288
292static inline void
293 rtems_rfs_rtems_unlock (rtems_rfs_file_system* fs)
294{
297 rtems_rfs_mutex_unlock (&rtems->access);
298}
299
304extern const rtems_filesystem_file_handlers_r rtems_rfs_rtems_device_handlers;
306extern const rtems_filesystem_file_handlers_r rtems_rfs_rtems_file_handlers;
307
312 struct stat* buf);
313
321 const rtems_filesystem_location_info_t* pathloc);
322
330
331#endif
Basic Filesystem Types.
LibIO Internal Interface.
int rtems_rfs_buffers_release(rtems_rfs_file_system *fs)
Definition: rtems-rfs-buffer.c:485
RTEMS File System Data.
#define rtems_rfs_fs_user(_fs)
Definition: rtems-rfs-file-system.h:383
RTEMS File System Information Node.
RTEMS File System Mutex.
uint32_t rtems_rfs_mutex
Definition: rtems-rfs-mutex.h:60
int rtems_rfs_rtems_fstat(const rtems_filesystem_location_info_t *pathloc, struct stat *buf)
Definition: rtems-rfs-rtems.c:433
const rtems_filesystem_file_handlers_r rtems_rfs_rtems_link_handlers
Definition: rtems-rfs-rtems.c:708
uint16_t rtems_rfs_rtems_imode(mode_t mode)
Definition: rtems-rfs-rtems-utils.c:73
#define rtems_rfs_rtems_trace_clear_mask(_m)
Definition: rtems-rfs-rtems.h:143
bool rtems_rfs_rtems_set_handlers(rtems_filesystem_location_info_t *pathloc, rtems_rfs_inode_handle *inode)
Definition: rtems-rfs-rtems-utils.c:51
#define rtems_rfs_rtems_error(_m, _e)
Definition: rtems-rfs-rtems.h:60
#define rtems_rfs_rtems_trace_set_mask(_m)
Definition: rtems-rfs-rtems.h:130
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:580
const rtems_filesystem_file_handlers_r rtems_rfs_rtems_dir_handlers
Definition: rtems-rfs-rtems-dir.c:174
#define rtems_rfs_rtems_trace(_m)
Definition: rtems-rfs-rtems.h:117
int rtems_rfs_rtems_fdatasync(rtems_libio_t *iop)
Definition: rtems-rfs-rtems.c:610
mode_t rtems_rfs_rtems_mode(int imode)
Definition: rtems-rfs-rtems-utils.c:82
File system node operations table.
Definition: libio.h:1021
Definition: rtems-rfs-file-system.h:135
Definition: rtems-rfs-inode.h:201
File system location.
Definition: fs.h:72
An open file data structure.
Definition: libio.h:1338
Definition: rtems-rfs-rtems.h:163
rtems_rfs_mutex access
Definition: rtems-rfs-rtems.h:167