RTEMS  5.0.0
Files | Data Structures | Typedefs | Functions | Variables
File System Node Handler

File system node handler. More...

Files

file  default_kqfilter.c
 Default Kernel Event Filter Handler.
 
file  default_mmap.c
 Default MMAP Handler.
 
file  default_poll.c
 Default Poll Handler.
 
file  default_readv.c
 Default Read IO Vector Handler.
 
file  default_writev.c
 Default Read IO Vector Handler.
 

Data Structures

struct  _rtems_filesystem_file_handlers_r
 File system node operations table. More...
 

Typedefs

typedef int(* rtems_filesystem_open_t) (rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
 Opens a node. More...
 
typedef int(* rtems_filesystem_close_t) (rtems_libio_t *iop)
 Closes a node. More...
 
typedef ssize_t(* rtems_filesystem_read_t) (rtems_libio_t *iop, void *buffer, size_t count)
 Reads from a node. More...
 
typedef ssize_t(* rtems_filesystem_readv_t) (rtems_libio_t *iop, const struct iovec *iov, int iovcnt, ssize_t total)
 Reads an IO vector from a node. More...
 
typedef ssize_t(* rtems_filesystem_write_t) (rtems_libio_t *iop, const void *buffer, size_t count)
 Writes to a node. More...
 
typedef ssize_t(* rtems_filesystem_writev_t) (rtems_libio_t *iop, const struct iovec *iov, int iovcnt, ssize_t total)
 Writes an IO vector to a node. More...
 
typedef int(* rtems_filesystem_ioctl_t) (rtems_libio_t *iop, ioctl_command_t request, void *buffer)
 IO control of a node. More...
 
typedef off_t(* rtems_filesystem_lseek_t) (rtems_libio_t *iop, off_t offset, int whence)
 Moves the read/write file offset. More...
 
typedef int(* rtems_filesystem_fstat_t) (const rtems_filesystem_location_info_t *loc, struct stat *buf)
 Gets a node status. More...
 
typedef int(* rtems_filesystem_ftruncate_t) (rtems_libio_t *iop, off_t length)
 Truncates a file to a specified length. More...
 
typedef int(* rtems_filesystem_fsync_t) (rtems_libio_t *iop)
 Synchronizes changes to a file. More...
 
typedef int(* rtems_filesystem_fdatasync_t) (rtems_libio_t *iop)
 Synchronizes the data of a file. More...
 
typedef int(* rtems_filesystem_fcntl_t) (rtems_libio_t *iop, int cmd)
 File control. More...
 
typedef int(* rtems_filesystem_poll_t) (rtems_libio_t *iop, int events)
 Poll and select support. More...
 
typedef int(* rtems_filesystem_kqfilter_t) (rtems_libio_t *iop, struct knote *kn)
 Kernel event filter support. More...
 
typedef int(* rtems_filesystem_mmap_t) (rtems_libio_t *iop, void **addr, size_t len, int prot, off_t off)
 MMAP support. More...
 

Functions

int rtems_filesystem_default_open (rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
 
int rtems_filesystem_default_close (rtems_libio_t *iop)
 
ssize_t rtems_filesystem_default_read (rtems_libio_t *iop, void *buffer, size_t count)
 
ssize_t rtems_filesystem_default_readv (rtems_libio_t *iop, const struct iovec *iov, int iovcnt, ssize_t total)
 Calls the read handler for each IO vector entry. More...
 
ssize_t rtems_filesystem_default_write (rtems_libio_t *iop, const void *buffer, size_t count)
 
ssize_t rtems_filesystem_default_writev (rtems_libio_t *iop, const struct iovec *iov, int iovcnt, ssize_t total)
 Calls the write handler for each IO vector entry. More...
 
int rtems_filesystem_default_ioctl (rtems_libio_t *iop, ioctl_command_t request, void *buffer)
 
off_t rtems_filesystem_default_lseek (rtems_libio_t *iop, off_t offset, int whence)
 
off_t rtems_filesystem_default_lseek_directory (rtems_libio_t *iop, off_t offset, int whence)
 An offset 0 with a whence of SEEK_SET will perform a directory rewind operation. More...
 
off_t rtems_filesystem_default_lseek_file (rtems_libio_t *iop, off_t offset, int whence)
 Default lseek() handler for files. More...
 
int rtems_filesystem_default_fstat (const rtems_filesystem_location_info_t *loc, struct stat *buf)
 Sets the mode to S_IRWXU | S_IRWXG | S_IRWXO. More...
 
int rtems_filesystem_default_ftruncate (rtems_libio_t *iop, off_t length)
 
int rtems_filesystem_default_ftruncate_directory (rtems_libio_t *iop, off_t length)
 
int rtems_filesystem_default_fsync_or_fdatasync (rtems_libio_t *iop)
 
int rtems_filesystem_default_fsync_or_fdatasync_success (rtems_libio_t *iop)
 
int rtems_filesystem_default_fcntl (rtems_libio_t *iop, int cmd)
 
int rtems_filesystem_default_poll (rtems_libio_t *iop, int events)
 Default poll handler. More...
 
int rtems_filesystem_default_kqfilter (rtems_libio_t *iop, struct knote *kn)
 Default kernel event filter handler. More...
 
int rtems_filesystem_default_mmap (rtems_libio_t *iop, void **addr, size_t len, int prot, off_t off)
 Default MMAP handler. More...
 

Variables

const rtems_filesystem_file_handlers_r rtems_filesystem_handlers_default
 File system node handler table with default node handlers.
 

Detailed Description

File system node handler.

Typedef Documentation

◆ rtems_filesystem_close_t

typedef int(* rtems_filesystem_close_t) (rtems_libio_t *iop)

Closes a node.

Parameters
[in,out]iopThe IO pointer.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_close().

◆ rtems_filesystem_fcntl_t

typedef int(* rtems_filesystem_fcntl_t) (rtems_libio_t *iop, int cmd)

File control.

Parameters
[in,out]iopThe IO pointer.
[in]cmdControl command.
Return values
0Successful operation.
errnoAn error occurred. This value is assigned to errno.
See also
rtems_filesystem_default_fcntl().

◆ rtems_filesystem_fdatasync_t

typedef int(* rtems_filesystem_fdatasync_t) (rtems_libio_t *iop)

Synchronizes the data of a file.

Parameters
[in,out]iopThe IO pointer.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_fsync_or_fdatasync() and rtems_filesystem_default_fsync_or_fdatasync_success().

◆ rtems_filesystem_fstat_t

typedef int(* rtems_filesystem_fstat_t) (const rtems_filesystem_location_info_t *loc, struct stat *buf)

Gets a node status.

Parameters
[in,out]iopThe IO pointer.
[out]statThe buffer to status information.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_fstat().

◆ rtems_filesystem_fsync_t

typedef int(* rtems_filesystem_fsync_t) (rtems_libio_t *iop)

Synchronizes changes to a file.

Parameters
[in,out]iopThe IO pointer.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_fsync_or_fdatasync() and rtems_filesystem_default_fsync_or_fdatasync_success().

◆ rtems_filesystem_ftruncate_t

typedef int(* rtems_filesystem_ftruncate_t) (rtems_libio_t *iop, off_t length)

Truncates a file to a specified length.

Parameters
[in,out]iopThe IO pointer.
[in]lengthThe new length in characters.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_ftruncate() and rtems_filesystem_default_ftruncate_directory().

◆ rtems_filesystem_ioctl_t

typedef int(* rtems_filesystem_ioctl_t) (rtems_libio_t *iop, ioctl_command_t request, void *buffer)

IO control of a node.

Parameters
[in,out]iopThe IO pointer.
[in]requestThe IO control request.
[in,out]bufferThe buffer for IO control request data.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_ioctl().

◆ rtems_filesystem_kqfilter_t

typedef int(* rtems_filesystem_kqfilter_t) (rtems_libio_t *iop, struct knote *kn)

Kernel event filter support.

Parameters
[in,out]iopThe IO pointer.
[in]knThe kernel event note.
Return values
0Successful operation.
errorAn error occurred. This is usually EINVAL.
See also
rtems_filesystem_default_kqfilter().

◆ rtems_filesystem_lseek_t

typedef off_t(* rtems_filesystem_lseek_t) (rtems_libio_t *iop, off_t offset, int whence)

Moves the read/write file offset.

Parameters
[in,out]iopThe IO pointer.
[in]offsetThe offset.
[in]whenceThe reference position for the offset.
Return values
non-negativeThe new offset from the beginning of the file.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_lseek(), rtems_filesystem_default_lseek_file(), and rtems_filesystem_default_lseek_directory().

◆ rtems_filesystem_mmap_t

typedef int(* rtems_filesystem_mmap_t) (rtems_libio_t *iop, void **addr, size_t len, int prot, off_t off)

MMAP support.

Parameters
[in,out]iopThe IO pointer.
[in,out]addrThe starting address of the mapped memory.
[in]lenThe maximum number of bytes to map.
[in]protThe desired memory protection.
[in]offThe offset within the file descriptor to map.
Return values
0Successful operation.
errorAn error occurred. This is usually EINVAL.
See also
rtems_filesystem_default_mmap().

◆ rtems_filesystem_open_t

typedef int(* rtems_filesystem_open_t) (rtems_libio_t *iop, const char *path, int oflag, mode_t mode)

Opens a node.

Parameters
[in,out]iopThe IO pointer.
[in]pathThe path.
[in]oflagThe open flags.
[in]modeOptional mode for node creation.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_open().

◆ rtems_filesystem_poll_t

typedef int(* rtems_filesystem_poll_t) (rtems_libio_t *iop, int events)

Poll and select support.

Parameters
[in,out]iopThe IO pointer.
[in]eventsThe poll events.
Returns
The poll return events.
See also
rtems_filesystem_default_poll().

◆ rtems_filesystem_read_t

typedef ssize_t(* rtems_filesystem_read_t) (rtems_libio_t *iop, void *buffer, size_t count)

Reads from a node.

This handler is responsible to update the offset field of the IO descriptor.

Parameters
[in,out]iopThe IO pointer.
[out]bufferThe buffer for read data.
[in]countThe size of the buffer in characters.
Return values
non-negativeCount of read characters.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_read().

◆ rtems_filesystem_readv_t

typedef ssize_t(* rtems_filesystem_readv_t) (rtems_libio_t *iop, const struct iovec *iov, int iovcnt, ssize_t total)

Reads an IO vector from a node.

This handler is responsible to update the offset field of the IO descriptor.

Parameters
[in,out]iopThe IO pointer.
[in]iovThe IO vector with buffer for read data. The caller must ensure that the IO vector values are valid.
[in]iovcntThe count of buffers in the IO vector.
[in]totalThe total count of bytes in the buffers in the IO vector.
Return values
non-negativeCount of read characters.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_readv().

◆ rtems_filesystem_write_t

typedef ssize_t(* rtems_filesystem_write_t) (rtems_libio_t *iop, const void *buffer, size_t count)

Writes to a node.

This handler is responsible to update the offset field of the IO descriptor.

Parameters
[in,out]iopThe IO pointer.
[out]bufferThe buffer for write data.
[in]countThe size of the buffer in characters.
Return values
non-negativeCount of written characters.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_write().

◆ rtems_filesystem_writev_t

typedef ssize_t(* rtems_filesystem_writev_t) (rtems_libio_t *iop, const struct iovec *iov, int iovcnt, ssize_t total)

Writes an IO vector to a node.

This handler is responsible to update the offset field of the IO descriptor.

Parameters
[in,out]iopThe IO pointer.
[in]iovThe IO vector with buffer for write data. The caller must ensure that the IO vector values are valid.
[in]iovcntThe count of buffers in the IO vector.
[in]totalThe total count of bytes in the buffers in the IO vector.
Return values
non-negativeCount of written characters.
-1An error occurred. The errno is set to indicate the error.
See also
rtems_filesystem_default_writev().

Function Documentation

◆ rtems_filesystem_default_close()

int rtems_filesystem_default_close ( rtems_libio_t iop)
Return values
0Always.
See also
rtems_filesystem_close_t.

◆ rtems_filesystem_default_fcntl()

int rtems_filesystem_default_fcntl ( rtems_libio_t iop,
int  cmd 
)
Return values
0Always.
See also
rtems_filesystem_fcntl_t.

◆ rtems_filesystem_default_fstat()

int rtems_filesystem_default_fstat ( const rtems_filesystem_location_info_t loc,
struct stat *  buf 
)

Sets the mode to S_IRWXU | S_IRWXG | S_IRWXO.

Return values
0Always.
See also
rtems_filesystem_fstat_t.

◆ rtems_filesystem_default_fsync_or_fdatasync()

int rtems_filesystem_default_fsync_or_fdatasync ( rtems_libio_t iop)
Return values
-1Always. The errno is set to EINVAL.
See also
rtems_filesystem_fsync_t and rtems_filesystem_fdatasync_t.

◆ rtems_filesystem_default_fsync_or_fdatasync_success()

int rtems_filesystem_default_fsync_or_fdatasync_success ( rtems_libio_t iop)
Return values
0Always.
See also
rtems_filesystem_fsync_t and rtems_filesystem_fdatasync_t.

◆ rtems_filesystem_default_ftruncate()

int rtems_filesystem_default_ftruncate ( rtems_libio_t iop,
off_t  length 
)
Return values
-1Always. The errno is set to EINVAL.
See also
rtems_filesystem_ftruncate_t.

◆ rtems_filesystem_default_ftruncate_directory()

int rtems_filesystem_default_ftruncate_directory ( rtems_libio_t iop,
off_t  length 
)
Return values
-1Always. The errno is set to EISDIR.
See also
rtems_filesystem_ftruncate_t.

◆ rtems_filesystem_default_ioctl()

int rtems_filesystem_default_ioctl ( rtems_libio_t iop,
ioctl_command_t  request,
void *  buffer 
)
Return values
-1Always. The errno is set to ENOTTY.
See also
rtems_filesystem_ioctl_t.

◆ rtems_filesystem_default_kqfilter()

int rtems_filesystem_default_kqfilter ( rtems_libio_t iop,
struct knote *  kn 
)

Default kernel event filter handler.

Return values
EINVALAlways.
See also
rtems_filesystem_kqfilter_t.

◆ rtems_filesystem_default_lseek()

off_t rtems_filesystem_default_lseek ( rtems_libio_t iop,
off_t  offset,
int  whence 
)
Return values
-1Always. The errno is set to ESPIPE.
See also
rtems_filesystem_lseek_t.

◆ rtems_filesystem_default_lseek_directory()

off_t rtems_filesystem_default_lseek_directory ( rtems_libio_t iop,
off_t  offset,
int  whence 
)

An offset 0 with a whence of SEEK_SET will perform a directory rewind operation.

This function has no protection against concurrent access.

Return values
-1The offset is not zero or the whence is not SEEK_SET.
0Successful rewind operation.
See also
rtems_filesystem_lseek_t.

◆ rtems_filesystem_default_lseek_file()

off_t rtems_filesystem_default_lseek_file ( rtems_libio_t iop,
off_t  offset,
int  whence 
)

Default lseek() handler for files.

The fstat() handler will be used to obtain the file size in case whence is SEEK_END.

This function has no protection against concurrent access.

Return values
-1An error occurred. In case an integer overflow occurred, then the errno will be set to EOVERFLOW. In case the new offset is negative, then the errno will be set to EINVAL. In case the whence is SEEK_END and the fstat() handler to obtain the current file size returned an error status, then the errno will be set by the fstat() handler.
offsetThe new offset.
See also
rtems_filesystem_lseek_t.

◆ rtems_filesystem_default_mmap()

int rtems_filesystem_default_mmap ( rtems_libio_t iop,
void **  addr,
size_t  len,
int  prot,
off_t  off 
)

Default MMAP handler.

Return values
ENOTSUPAlways.
See also
rtems_filesystem_mmap_t.

◆ rtems_filesystem_default_open()

int rtems_filesystem_default_open ( rtems_libio_t iop,
const char *  path,
int  oflag,
mode_t  mode 
)
Return values
0Always.
See also
rtems_filesystem_open_t.

◆ rtems_filesystem_default_poll()

int rtems_filesystem_default_poll ( rtems_libio_t iop,
int  events 
)

Default poll handler.

Return values
POLLERRAlways.
See also
rtems_filesystem_poll_t.

◆ rtems_filesystem_default_read()

ssize_t rtems_filesystem_default_read ( rtems_libio_t iop,
void *  buffer,
size_t  count 
)
Return values
-1Always. The errno is set to ENOTSUP.
See also
rtems_filesystem_read_t.

◆ rtems_filesystem_default_readv()

ssize_t rtems_filesystem_default_readv ( rtems_libio_t iop,
const struct iovec *  iov,
int  iovcnt,
ssize_t  total 
)

Calls the read handler for each IO vector entry.

See also
rtems_filesystem_readv_t.

◆ rtems_filesystem_default_write()

ssize_t rtems_filesystem_default_write ( rtems_libio_t iop,
const void *  buffer,
size_t  count 
)
Return values
-1Always. The errno is set to ENOTSUP.
See also
rtems_filesystem_write_t.

◆ rtems_filesystem_default_writev()

ssize_t rtems_filesystem_default_writev ( rtems_libio_t iop,
const struct iovec *  iov,
int  iovcnt,
ssize_t  total 
)

Calls the write handler for each IO vector entry.

See also
rtems_filesystem_write_t.