RTEMS  5.0.0
Data Structures | Macros | Typedefs | Functions | Variables
#include <stdbool.h>
#include <stdint.h>
#include <errno.h>
#include <rtems/rfs/rtems-rfs-file-system.h>
#include <rtems/rfs/rtems-rfs-inode.h>
#include <rtems/rfs/rtems-rfs-mutex.h>
#include <rtems/libio_.h>
#include <rtems/fs.h>

Go to the source code of this file.

Data Structures

struct  rtems_rfs_rtems_private
 

Macros

#define RTEMS_RFS_RTEMS_ERROR   0
 
#define RTEMS_RFS_RTEMS_TRACE   0
 
#define rtems_rfs_rtems_error(_m, _e)   (((errno = (_e)) == 0) ? 0 : -1)
 
#define RTEMS_RFS_RTEMS_DEBUG_ALL   (0xffffffff)
 
#define RTEMS_RFS_RTEMS_DEBUG_ERROR_MSGS   (1 << 0)
 
#define RTEMS_RFS_RTEMS_DEBUG_EVAL_PATH   (1 << 1)
 
#define RTEMS_RFS_RTEMS_DEBUG_EVAL_FOR_MAKE   (1 << 2)
 
#define RTEMS_RFS_RTEMS_DEBUG_EVAL_PERMS   (1 << 3)
 
#define RTEMS_RFS_RTEMS_DEBUG_MKNOD   (1 << 4)
 
#define RTEMS_RFS_RTEMS_DEBUG_RMNOD   (1 << 5)
 
#define RTEMS_RFS_RTEMS_DEBUG_LINK   (1 << 6)
 
#define RTEMS_RFS_RTEMS_DEBUG_UNLINK   (1 << 7)
 
#define RTEMS_RFS_RTEMS_DEBUG_CHOWN   (1 << 8)
 
#define RTEMS_RFS_RTEMS_DEBUG_READLINK   (1 << 9)
 
#define RTEMS_RFS_RTEMS_DEBUG_FCHMOD   (1 << 10)
 
#define RTEMS_RFS_RTEMS_DEBUG_STAT   (1 << 11)
 
#define RTEMS_RFS_RTEMS_DEBUG_RENAME   (1 << 12)
 
#define RTEMS_RFS_RTEMS_DEBUG_DIR_RMNOD   (1 << 13)
 
#define RTEMS_RFS_RTEMS_DEBUG_FILE_OPEN   (1 << 14)
 
#define RTEMS_RFS_RTEMS_DEBUG_FILE_CLOSE   (1 << 15)
 
#define RTEMS_RFS_RTEMS_DEBUG_FILE_READ   (1 << 16)
 
#define RTEMS_RFS_RTEMS_DEBUG_FILE_WRITE   (1 << 17)
 
#define RTEMS_RFS_RTEMS_DEBUG_FILE_LSEEK   (1 << 18)
 
#define RTEMS_RFS_RTEMS_DEBUG_FILE_FTRUNC   (1 << 19)
 
#define rtems_rfs_rtems_trace(_m)   (0)
 
#define rtems_rfs_rtems_trace_set_mask(_m)
 
#define rtems_rfs_rtems_trace_clear_mask(_m)
 
#define rtems_rfs_rtems_pathloc_dev(_loc)   ((rtems_rfs_file_system*)((_loc)->mt_entry->fs_info))
 
#define rtems_rfs_rtems_set_pathloc_ino(_loc, _ino)   (_loc)->node_access = (void*)((intptr_t)(_ino))
 
#define rtems_rfs_rtems_get_pathloc_ino(_loc)   ((rtems_rfs_ino) (intptr_t)((_loc)->node_access))
 
#define rtems_rfs_rtems_set_pathloc_doff(_loc, _doff)   (_loc)->node_access_2 = (void*)((intptr_t)(_doff))
 
#define rtems_rfs_rtems_get_pathloc_doff(_loc)   ((uint32_t) (intptr_t)((_loc)->node_access_2))
 
#define rtems_rfs_rtems_get_iop_ino(_iop)   ((intptr_t)(_iop)->pathinfo.node_access)
 
#define rtems_rfs_rtems_get_iop_file_handle(_iop)   ((rtems_rfs_file_handle*)(_iop)->pathinfo.node_access_2)
 
#define rtems_rfs_rtems_set_iop_file_handle(_iop, _fh)   (_iop)->pathinfo.node_access_2 = (_fh)
 
#define rtems_rfs_rtems_handlers(_h)   &rtems_rfs_rtems_ ## _h ## _handlers
 

Typedefs

typedef struct rtems_rfs_rtems_private rtems_rfs_rtems_private
 

Functions

bool rtems_rfs_rtems_set_handlers (rtems_filesystem_location_info_t *pathloc, rtems_rfs_inode_handle *inode)
 
uint16_t rtems_rfs_rtems_imode (mode_t mode)
 
mode_t rtems_rfs_rtems_mode (int imode)
 
int rtems_rfs_rtems_fstat (const rtems_filesystem_location_info_t *pathloc, struct stat *buf)
 
int rtems_rfs_rtems_rmnod (const rtems_filesystem_location_info_t *parent_pathloc, const rtems_filesystem_location_info_t *pathloc)
 
int rtems_rfs_rtems_fdatasync (rtems_libio_t *iop)
 

Variables

const rtems_filesystem_file_handlers_r rtems_rfs_rtems_dir_handlers
 
const rtems_filesystem_file_handlers_r rtems_rfs_rtems_device_handlers
 
const rtems_filesystem_file_handlers_r rtems_rfs_rtems_link_handlers
 
const rtems_filesystem_file_handlers_r rtems_rfs_rtems_file_handlers
 

Detailed Description

RTEMS File System RTEMS Header file.

This file is not to be installed. It binds the RFS file system to RTEMS.

Macro Definition Documentation

◆ RTEMS_RFS_RTEMS_DEBUG_ALL

#define RTEMS_RFS_RTEMS_DEBUG_ALL   (0xffffffff)

Trace message defines the RTEMS bindings of the RTEMS RFS. This is a development tool where can edit the values below to control the various trace output.

◆ RTEMS_RFS_RTEMS_ERROR

#define RTEMS_RFS_RTEMS_ERROR   0

RTEMS RFS RTEMS Error Enable. Set to 1 for printing of errors. Default is off.

◆ rtems_rfs_rtems_error

#define rtems_rfs_rtems_error (   _m,
  _e 
)    (((errno = (_e)) == 0) ? 0 : -1)

If we are not handling errors provide a define that removes the strings from the code.

◆ rtems_rfs_rtems_get_iop_file_handle

#define rtems_rfs_rtems_get_iop_file_handle (   _iop)    ((rtems_rfs_file_handle*)(_iop)->pathinfo.node_access_2)

Get the file handle from the I/O pointer.

Parameters
_iopThe I/O pointer.
Returns
filehandle The file handle

◆ rtems_rfs_rtems_get_iop_ino

#define rtems_rfs_rtems_get_iop_ino (   _iop)    ((intptr_t)(_iop)->pathinfo.node_access)

Get the ino from the I/O pointer.

Parameters
[in]_iopis the I/O pointer.
Returns
ino

◆ rtems_rfs_rtems_get_pathloc_doff

#define rtems_rfs_rtems_get_pathloc_doff (   _loc)    ((uint32_t) (intptr_t)((_loc)->node_access_2))

Get the directory offset (doff) given a path location.

Parameters
[in]_locis a pointer to the path location.
Returns
uin32_t The doff in the path location.

◆ rtems_rfs_rtems_get_pathloc_ino

#define rtems_rfs_rtems_get_pathloc_ino (   _loc)    ((rtems_rfs_ino) (intptr_t)((_loc)->node_access))

Get the inode number (ino) given a path location.

Parameters
[in]_locis a pointer to the path location.
Returns
rtems_rfs_ino The inode number in the path location.

◆ rtems_rfs_rtems_handlers

#define rtems_rfs_rtems_handlers (   _h)    &rtems_rfs_rtems_ ## _h ## _handlers

Create the name of the handler's table given the type of handlers.

Parameters
[in]_his the name of the handlers.
Returns
label The name of the handler's table.

◆ rtems_rfs_rtems_pathloc_dev

#define rtems_rfs_rtems_pathloc_dev (   _loc)    ((rtems_rfs_file_system*)((_loc)->mt_entry->fs_info))

Return the file system structure given a path location.

Parameters
[in]_locis a pointer to the path location.
Returns
rtems_rfs_file_system*

◆ rtems_rfs_rtems_set_iop_file_handle

#define rtems_rfs_rtems_set_iop_file_handle (   _iop,
  _fh 
)    (_iop)->pathinfo.node_access_2 = (_fh)

Set the file handle in the I/O pointer.

Parameters
[in]_iopis the I/O pointer.
[in]_fhis the file handle.

◆ rtems_rfs_rtems_set_pathloc_doff

#define rtems_rfs_rtems_set_pathloc_doff (   _loc,
  _doff 
)    (_loc)->node_access_2 = (void*)((intptr_t)(_doff))

Set the directory offset (doff) into the path location.

Parameters
[in]_locis a pointer to the path location.
[in]_doffis the doff to set in the path location.

◆ rtems_rfs_rtems_set_pathloc_ino

#define rtems_rfs_rtems_set_pathloc_ino (   _loc,
  _ino 
)    (_loc)->node_access = (void*)((intptr_t)(_ino))

Set the inode number (ino) into the path location.

Parameters
[in]_locis a pointer to the path location.
[in]_inois the ino to set in the path location.

◆ RTEMS_RFS_RTEMS_TRACE

#define RTEMS_RFS_RTEMS_TRACE   0

RTEMS RFS RTEMS Trace Enable. Set to 1 for printing of errors. Default is off.

◆ rtems_rfs_rtems_trace

#define rtems_rfs_rtems_trace (   _m)    (0)

Call to check if this part is bring traced. If RTEMS_RFS_RTEMS_TRACE is defined to 0 the code is dead code elminiated when built with -Os, -O2, or higher.

Parameters
[in]maskis the part of the API to trace.
Return values
trueTracing is active for the mask.
falseDo not trace.

◆ rtems_rfs_rtems_trace_clear_mask

#define rtems_rfs_rtems_trace_clear_mask (   _m)

Clear the mask.

Parameters
[in]maskis the mask bits to clear.
Return values
maskThe previous mask.

◆ rtems_rfs_rtems_trace_set_mask

#define rtems_rfs_rtems_trace_set_mask (   _m)

Set the mask.

Parameters
[in]maskis the mask bits to set.
Return values
maskThe previous mask.

Typedef Documentation

◆ rtems_rfs_rtems_private

Add shell trace shell command. Private RFS RTEMS Port data.

Function Documentation

◆ rtems_rfs_rtems_fdatasync()

int rtems_rfs_rtems_fdatasync ( rtems_libio_t iop)

The following routine does a sync on an inode node. Currently it flushes everything related to this device.

Parameters
iopThe following routine does a sync on an inode node. Currently it flushes everything related to this device.
iop
Returns
int

◆ rtems_rfs_rtems_fstat()

int rtems_rfs_rtems_fstat ( const rtems_filesystem_location_info_t pathloc,
struct stat *  buf 
)

The following routine does a stat on a node.

◆ rtems_rfs_rtems_imode()

uint16_t rtems_rfs_rtems_imode ( mode_t  mode)

Convert the system mode flags to inode mode flags.

Parameters
[in]modeis the system mode flags.
Returns
uint16_t The inode mode flags.

◆ rtems_rfs_rtems_mode()

mode_t rtems_rfs_rtems_mode ( int  imode)

Convert the inode mode flags to system mode flags.

Parameters
[in]imodeis the inode mode flags
Returns
mode_t The system mode flags.

◆ rtems_rfs_rtems_rmnod()

int rtems_rfs_rtems_rmnod ( const rtems_filesystem_location_info_t parent_pathloc,
const rtems_filesystem_location_info_t pathloc 
)

Routine to remove a node from the RFS file system.

Parameters
parent_pathloc
pathlocRoutine to remove a node from the RFS file system.
parent_pathloc
pathloc
Returns
int

◆ rtems_rfs_rtems_set_handlers()

bool rtems_rfs_rtems_set_handlers ( rtems_filesystem_location_info_t pathloc,
rtems_rfs_inode_handle inode 
)

Set the handlers in the path location based on the mode of the inode.

Parameters
[in]locis a pointer to the path location to set the handlers in.
[in]inodeis the inode handle to check the mode of for the type of handlers.
Return values
trueThe handlers have been set.
falseThere are no handlers for the mode.

Variable Documentation

◆ rtems_rfs_rtems_dir_handlers

const rtems_filesystem_file_handlers_r rtems_rfs_rtems_dir_handlers

The handlers.

◆ rtems_rfs_rtems_link_handlers

const rtems_filesystem_file_handlers_r rtems_rfs_rtems_link_handlers

Handler table for RFS link nodes