RTEMS CPU Kit with SuperCore  4.10.99.0
Data Structures | Typedefs | Functions | Variables
File System Node Handler
IO Library

File system node handler. More...

Collaboration diagram for File System Node 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.
typedef int(* rtems_filesystem_close_t )(rtems_libio_t *iop)
 Closes a node.
typedef ssize_t(* rtems_filesystem_read_t )(rtems_libio_t *iop, void *buffer, size_t count)
 Reads from a node.
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.
typedef ssize_t(* rtems_filesystem_write_t )(rtems_libio_t *iop, const void *buffer, size_t count)
 Writes to a node.
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.
typedef int(* rtems_filesystem_ioctl_t )(rtems_libio_t *iop, ioctl_command_t request, void *buffer)
 IO control of a node.
typedef off_t(* rtems_filesystem_lseek_t )(rtems_libio_t *iop, off_t offset, int whence)
 Moves the read/write file offset.
typedef int(* rtems_filesystem_fstat_t )(const rtems_filesystem_location_info_t *loc, struct stat *buf)
 Gets a node status.
typedef int(* rtems_filesystem_ftruncate_t )(rtems_libio_t *iop, off_t length)
 Truncates a file to a specified length.
typedef int(* rtems_filesystem_fsync_t )(rtems_libio_t *iop)
 Synchronizes changes to a file.
typedef int(* rtems_filesystem_fdatasync_t )(rtems_libio_t *iop)
 Synchronizes the data of a file.
typedef int(* rtems_filesystem_fcntl_t )(rtems_libio_t *iop, int cmd)
 File control.
typedef int(* rtems_filesystem_poll_t )(rtems_libio_t *iop, int events)
 Poll and select support.
typedef int(* rtems_filesystem_kqfilter_t )(rtems_libio_t *iop, struct knote *kn)
 Kernel event filter support.

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.
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.
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.
off_t rtems_filesystem_default_lseek_file (rtems_libio_t *iop, off_t offset, int whence)
 Default lseek() handler for files.
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.
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.
int rtems_filesystem_default_kqfilter (rtems_libio_t *iop, struct knote *kn)
 Default kernel event filter handler.

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

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().
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().

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().
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().

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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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

int rtems_filesystem_default_close ( rtems_libio_t iop)
Return values:
0Always.
See also:
rtems_filesystem_close_t.
int rtems_filesystem_default_fcntl ( rtems_libio_t iop,
int  cmd 
)
Return values:
0Always.
See also:
rtems_filesystem_fcntl_t.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
int rtems_filesystem_default_poll ( rtems_libio_t iop,
int  events 
)

Default poll handler.

Return values:
POLLERRAlways.
See also:
rtems_filesystem_poll_t.
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.
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.
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.
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.