RTEMS
|
Basic IO API. More...
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioccom.h>
#include <sys/statvfs.h>
#include <sys/uio.h>
#include <unistd.h>
#include <termios.h>
#include <rtems.h>
#include <rtems/fs.h>
#include <rtems/chain.h>
#include <rtems/score/atomic.h>
Go to the source code of this file.
Classes | |
struct | rtems_filesystem_eval_path_context_t |
Path evaluation context. More... | |
struct | _rtems_filesystem_operations_table |
File system operations table. More... | |
struct | _rtems_filesystem_file_handlers_r |
File system node operations table. More... | |
struct | rtems_filesystem_limits_and_options_t |
Contain file system specific information which is required to support fpathconf(). More... | |
struct | rtems_libio_tt |
An open file data structure. More... | |
struct | rtems_libio_rw_args_t |
Paramameter block for read/write. More... | |
struct | rtems_libio_open_close_args_t |
Parameter block for open/close. More... | |
struct | rtems_libio_ioctl_args_t |
Parameter block for ioctl. More... | |
union | __rtems_dev_t |
struct | rtems_filesystem_mount_table_entry_tt |
Mount table entry. More... | |
struct | rtems_filesystem_table_t |
File system table entry. More... | |
struct | rtems_filesystem_mount_configuration |
struct | rtems_termios_callbacks |
Macros | |
#define | rtems_filesystem_split_dev_t(_dev, _major, _minor) |
#define | rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options) |
The pathconf setting for a file system. | |
#define | rtems_filesystem_type(_mte) ((_mte)->type) |
The type of file system. Its name. | |
#define | rtems_filesystem_mount_point(_mte) ((_mte)->target) |
The mount point of a file system. | |
#define | rtems_filesystem_mount_device(_mte) ((_mte)->dev) |
The device entry of a file system. | |
Flag Values | |
#define | LIBIO_FLAGS_NO_DELAY 0x0001U /* return immediately if no data */ |
#define | LIBIO_FLAGS_READ 0x0002U /* reading */ |
#define | LIBIO_FLAGS_WRITE 0x0004U /* writing */ |
#define | LIBIO_FLAGS_OPEN 0x0100U /* device is open */ |
#define | LIBIO_FLAGS_APPEND 0x0200U /* all writes append */ |
#define | LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800U /* close on process exec() */ |
#define | LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE) |
#define | LIBIO_FLAGS_REFERENCE_INC 0x1000U |
Permission Macros | |
#define | RTEMS_FS_PERMS_READ 0x4 |
#define | RTEMS_FS_PERMS_WRITE 0x2 |
#define | RTEMS_FS_PERMS_EXEC 0x1 |
#define | RTEMS_FS_PERMS_RWX (RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE | RTEMS_FS_PERMS_EXEC) |
#define | RTEMS_FS_FOLLOW_HARD_LINK 0x8 |
#define | RTEMS_FS_FOLLOW_SYM_LINK 0x10 |
#define | RTEMS_FS_FOLLOW_LINK (RTEMS_FS_FOLLOW_HARD_LINK | RTEMS_FS_FOLLOW_SYM_LINK) |
#define | RTEMS_FS_MAKE 0x20 |
#define | RTEMS_FS_EXCLUSIVE 0x40 |
#define | RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS 0x80 |
#define | RTEMS_FS_REJECT_TERMINAL_DOT 0x100 |
File System Types | |
#define | RTEMS_FILESYSTEM_TYPE_IMFS "imfs" |
#define | RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs" |
#define | RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs" |
#define | RTEMS_FILESYSTEM_TYPE_NFS "nfs" |
#define | RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs" |
#define | RTEMS_FILESYSTEM_TYPE_RFS "rfs" |
#define | RTEMS_FILESYSTEM_TYPE_JFFS2 "jffs2" |
Typedefs | |
typedef void(* | rtems_filesystem_mt_entry_lock_t) (const rtems_filesystem_mount_table_entry_t *mt_entry) |
Locks a file system instance. More... | |
typedef void(* | rtems_filesystem_mt_entry_unlock_t) (const rtems_filesystem_mount_table_entry_t *mt_entry) |
Unlocks a file system instance. More... | |
typedef void(* | rtems_filesystem_eval_path_t) (rtems_filesystem_eval_path_context_t *ctx) |
Path evaluation. More... | |
typedef int(* | rtems_filesystem_link_t) (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *targetloc, const char *name, size_t namelen) |
Creates a new link for the existing file. More... | |
typedef int(* | rtems_filesystem_fchmod_t) (const rtems_filesystem_location_info_t *loc, mode_t mode) |
Changes the mode of a node. More... | |
typedef int(* | rtems_filesystem_chown_t) (const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group) |
Changes owner and group of a node. More... | |
typedef int(* | rtems_filesystem_clonenode_t) (rtems_filesystem_location_info_t *loc) |
Clones a location. More... | |
typedef void(* | rtems_filesystem_freenode_t) (const rtems_filesystem_location_info_t *loc) |
Frees the location of a node. More... | |
typedef int(* | rtems_filesystem_mount_t) (rtems_filesystem_mount_table_entry_t *mt_entry) |
Mounts a file system instance in a mount point (directory). More... | |
typedef int(* | rtems_filesystem_fsmount_me_t) (rtems_filesystem_mount_table_entry_t *mt_entry, const void *data) |
Initializes a file system instance. More... | |
typedef int(* | rtems_filesystem_unmount_t) (rtems_filesystem_mount_table_entry_t *mt_entry) |
Unmounts a file system instance in a mount point (directory). More... | |
typedef void(* | rtems_filesystem_fsunmount_me_t) (rtems_filesystem_mount_table_entry_t *mt_entry) |
Destroys a file system instance. More... | |
typedef bool(* | rtems_filesystem_are_nodes_equal_t) (const rtems_filesystem_location_info_t *a, const rtems_filesystem_location_info_t *b) |
Tests if the node of one location is equal to the node of the other location. More... | |
typedef int(* | rtems_filesystem_mknod_t) (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, mode_t mode, dev_t dev) |
Creates a new node. More... | |
typedef int(* | rtems_filesystem_rmnod_t) (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc) |
Removes a node. More... | |
typedef int(* | rtems_filesystem_utime_t) (const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime) |
Set node access and modification times. More... | |
typedef int(* | rtems_filesystem_symlink_t) (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, const char *target) |
Makes a symbolic link to a node. More... | |
typedef ssize_t(* | rtems_filesystem_readlink_t) (const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize) |
Reads the contents of a symbolic link. More... | |
typedef int(* | rtems_filesystem_rename_t) (const rtems_filesystem_location_info_t *oldparentloc, const rtems_filesystem_location_info_t *oldloc, const rtems_filesystem_location_info_t *newparentloc, const char *name, size_t namelen) |
Renames a node. More... | |
typedef int(* | rtems_filesystem_statvfs_t) (const rtems_filesystem_location_info_t *loc, struct statvfs *buf) |
Gets file system information. More... | |
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... | |
typedef off_t | rtems_off64_t |
typedef struct rtems_filesystem_table_t | rtems_filesystem_table_t |
File system table entry. | |
typedef bool(* | rtems_per_filesystem_routine) (const rtems_filesystem_table_t *fs_entry, void *arg) |
Per file system type routine. More... | |
typedef bool(* | rtems_filesystem_mt_entry_visitor) (const rtems_filesystem_mount_table_entry_t *mt_entry, void *arg) |
Mount table entry visitor. More... | |
typedef struct rtems_termios_callbacks | rtems_termios_callbacks |
typedef rtems_termios_iproc_status_code(* | rtems_termios_isig_handler) (unsigned char c, struct rtems_termios_tty *tty) |
Type for ISIG (VINTR/VKILL) handler. More... | |
External I/O Handlers | |
typedef int(* | rtems_libio_open_t) (const char *pathname, uint32_t flag, uint32_t mode) |
typedef int(* | rtems_libio_close_t) (int fd) |
typedef ssize_t(* | rtems_libio_read_t) (int fd, void *buffer, size_t count) |
typedef ssize_t(* | rtems_libio_write_t) (int fd, const void *buffer, size_t count) |
typedef int(* | rtems_libio_ioctl_t) (int fd, uint32_t command, void *buffer) |
typedef off_t(* | rtems_libio_lseek_t) (int fd, off_t offset, int whence) |
Enumerations | |
enum | rtems_filesystem_options_t { RTEMS_FILESYSTEM_READ_ONLY, RTEMS_FILESYSTEM_READ_WRITE, RTEMS_FILESYSTEM_BAD_OPTIONS } |
File system options. | |
enum | rtems_termios_iproc_status_code { RTEMS_TERMIOS_IPROC_CONTINUE, RTEMS_TERMIOS_IPROC_INTERRUPT, RTEMS_TERMIOS_IPROC_DONE } |
The status code returned by all Termios input processing (iproc) functions and input signal (isig) handlers. More... | |
Functions | |
void | rtems_filesystem_default_lock (const rtems_filesystem_mount_table_entry_t *mt_entry) |
Obtains the IO library mutex. More... | |
void | rtems_filesystem_default_unlock (const rtems_filesystem_mount_table_entry_t *mt_entry) |
Releases the IO library mutex. More... | |
void | rtems_filesystem_default_eval_path (rtems_filesystem_eval_path_context_t *ctx) |
Terminates the path evaluation and replaces the current location with the null location. More... | |
int | rtems_filesystem_default_link (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *targetloc, const char *name, size_t namelen) |
bool | rtems_filesystem_default_are_nodes_equal (const rtems_filesystem_location_info_t *a, const rtems_filesystem_location_info_t *b) |
Tests if the node access pointer of one location is equal to the node access pointer of the other location. More... | |
int | rtems_filesystem_default_mknod (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, mode_t mode, dev_t dev) |
int | rtems_filesystem_default_rmnod (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc) |
int | rtems_filesystem_default_fchmod (const rtems_filesystem_location_info_t *loc, mode_t mode) |
int | rtems_filesystem_default_chown (const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group) |
int | rtems_filesystem_default_clonenode (rtems_filesystem_location_info_t *loc) |
void | rtems_filesystem_default_freenode (const rtems_filesystem_location_info_t *loc) |
int | rtems_filesystem_default_mount (rtems_filesystem_mount_table_entry_t *mt_entry) |
int | rtems_filesystem_default_unmount (rtems_filesystem_mount_table_entry_t *mt_entry) |
void | rtems_filesystem_default_fsunmount (rtems_filesystem_mount_table_entry_t *mt_entry) |
int | rtems_filesystem_default_utime (const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime) |
int | rtems_filesystem_default_symlink (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, const char *target) |
ssize_t | rtems_filesystem_default_readlink (const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize) |
int | rtems_filesystem_default_rename (const rtems_filesystem_location_info_t *oldparentloc, const rtems_filesystem_location_info_t *oldloc, const rtems_filesystem_location_info_t *newparentloc, const char *name, size_t namelen) |
int | rtems_filesystem_default_statvfs (const rtems_filesystem_location_info_t *loc, struct statvfs *buf) |
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... | |
rtems_filesystem_fsmount_me_t | rtems_filesystem_get_mount_handler (const char *type) |
Gets the mount handler for the file system type. More... | |
static unsigned int | rtems_libio_iop_flags (const rtems_libio_t *iop) |
static bool | rtems_libio_iop_is_no_delay (const rtems_libio_t *iop) |
Returns true if this is a no delay iop, otherwise returns false. More... | |
static bool | rtems_libio_iop_is_readable (const rtems_libio_t *iop) |
Returns true if this is a readable iop, otherwise returns false. More... | |
static bool | rtems_libio_iop_is_writeable (const rtems_libio_t *iop) |
Returns true if this is a writeable iop, otherwise returns false. More... | |
static bool | rtems_libio_iop_is_append (const rtems_libio_t *iop) |
Returns true if this is an append iop, otherwise returns false. More... | |
static dev_t | rtems_filesystem_make_dev_t (rtems_device_major_number _major, rtems_device_minor_number _minor) |
static dev_t | rtems_filesystem_make_dev_t_from_pointer (const void *pointer) |
static rtems_device_major_number | rtems_filesystem_dev_major_t (dev_t device) |
static rtems_device_minor_number | rtems_filesystem_dev_minor_t (dev_t device) |
void | rtems_filesystem_initialize (void) |
Base File System Initialization. More... | |
void | rtems_libio_post_driver (void) |
void | rtems_libio_exit (void) |
int | rtems_mkdir (const char *path, mode_t mode) |
Creates a directory and all its parent directories according to path. More... | |
int | rtems_filesystem_register (const char *type, rtems_filesystem_fsmount_me_t mount_h) |
Registers a file system type. More... | |
int | rtems_filesystem_unregister (const char *type) |
Unregisters a file system type. More... | |
int | unmount (const char *mount_path) |
Unmounts the file system instance at the specified mount path. More... | |
int | mount (const char *source, const char *target, const char *filesystemtype, rtems_filesystem_options_t options, const void *data) |
Mounts a file system instance at the specified target path. More... | |
int | mount_and_make_target_path (const char *source, const char *target, const char *filesystemtype, rtems_filesystem_options_t options, const void *data) |
Mounts a file system and makes the target path. More... | |
bool | rtems_filesystem_iterate (rtems_per_filesystem_routine routine, void *routine_arg) |
Iterates over all file system types. More... | |
bool | rtems_filesystem_mount_iterate (rtems_filesystem_mt_entry_visitor visitor, void *visitor_arg) |
Iterates over all file system mount entries. More... | |
static __inline__ void | rtems_termios_initialize (void) |
rtems_status_code | rtems_termios_bufsize (size_t cbufsize, size_t raw_input, size_t raw_output) |
rtems_termios_iproc_status_code | rtems_termios_default_isig_handler (unsigned char c, struct rtems_termios_tty *tty) |
Default handler for ISIG (VINTR/VKILL) More... | |
rtems_termios_iproc_status_code | rtems_termios_posix_isig_handler (unsigned char c, struct rtems_termios_tty *tty) |
POSIX handler for ISIG (VINTR/VKILL) More... | |
rtems_status_code | rtems_termios_register_isig_handler (rtems_termios_isig_handler handler) |
Register handler for ISIG (VINTR/VKILL) More... | |
int | rtems_termios_enqueue_raw_characters (void *ttyp, const char *buf, int len) |
rtems_status_code | rtems_termios_open (rtems_device_major_number major, rtems_device_minor_number minor, void *arg, const rtems_termios_callbacks *callbacks) |
rtems_status_code | rtems_termios_close (void *arg) |
rtems_status_code | rtems_termios_read (void *arg) |
rtems_status_code | rtems_termios_write (void *arg) |
rtems_status_code | rtems_termios_ioctl (void *arg) |
int | rtems_termios_dequeue_characters (void *ttyp, int len) |
Variables | |
const rtems_filesystem_operations_table | rtems_filesystem_operations_default |
File system operations table with default operations. | |
const rtems_filesystem_file_handlers_r | rtems_filesystem_handlers_default |
File system node handler table with default node handlers. | |
const rtems_filesystem_limits_and_options_t | rtems_filesystem_default_pathconf |
Default pathconf settings. More... | |
const rtems_filesystem_table_t | rtems_filesystem_table [] |
Static table of file systems. More... | |
rtems_chain_control | rtems_filesystem_mount_table |
const rtems_filesystem_mount_configuration | rtems_filesystem_root_configuration |
Basic IO API.
This file contains the support infrastructure used to manage the table of integer style file descriptors used by the low level POSIX system calls like open(), read, fstat(), etc.
Definition in file libio.h.