25 #ifndef _RTEMS_RTEMS_LIBIO_H 26 #define _RTEMS_RTEMS_LIBIO_H 28 #include <sys/types.h> 30 #include <sys/ioccom.h> 784 const struct iovec *iov,
827 const struct iovec *iov,
846 ioctl_command_t request,
1069 const struct iovec *iov,
1092 const struct iovec *iov,
1104 ioctl_command_t request,
1272 typedef off_t rtems_off64_t __attribute__((deprecated));
1297 int posix_chown_restrictions;
1340 uint32_t bytes_moved;
1357 ioctl_command_t command;
1367 #define LIBIO_FLAGS_NO_DELAY 0x0001U 1368 #define LIBIO_FLAGS_READ 0x0002U 1369 #define LIBIO_FLAGS_WRITE 0x0004U 1370 #define LIBIO_FLAGS_OPEN 0x0100U 1371 #define LIBIO_FLAGS_APPEND 0x0200U 1372 #define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800U 1373 #define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE) 1374 #define LIBIO_FLAGS_REFERENCE_INC 0x1000U 1378 static inline unsigned int rtems_libio_iop_flags(
const rtems_libio_t *iop )
1380 return _Atomic_Load_uint( &iop->flags, ATOMIC_ORDER_RELAXED );
1390 return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_NO_DELAY ) != 0;
1400 return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_READ ) != 0;
1410 return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_WRITE ) != 0;
1420 return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_APPEND ) != 0;
1428 typedef int (*rtems_libio_open_t)(
1429 const char *pathname,
1434 typedef int (*rtems_libio_close_t)(
1438 typedef ssize_t (*rtems_libio_read_t)(
1444 typedef ssize_t (*rtems_libio_write_t)(
1450 typedef int (*rtems_libio_ioctl_t)(
1456 typedef off_t (*rtems_libio_lseek_t)(
1474 #define RTEMS_FS_PERMS_READ 0x4 1475 #define RTEMS_FS_PERMS_WRITE 0x2 1476 #define RTEMS_FS_PERMS_EXEC 0x1 1477 #define RTEMS_FS_PERMS_RWX \ 1478 (RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE | RTEMS_FS_PERMS_EXEC) 1479 #define RTEMS_FS_FOLLOW_HARD_LINK 0x8 1480 #define RTEMS_FS_FOLLOW_SYM_LINK 0x10 1481 #define RTEMS_FS_FOLLOW_LINK \ 1482 (RTEMS_FS_FOLLOW_HARD_LINK | RTEMS_FS_FOLLOW_SYM_LINK) 1483 #define RTEMS_FS_MAKE 0x20 1484 #define RTEMS_FS_EXCLUSIVE 0x40 1485 #define RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS 0x80 1486 #define RTEMS_FS_REJECT_TERMINAL_DOT 0x100 1498 static inline dev_t rtems_filesystem_make_dev_t(
1505 temp.__overlay.major = _major;
1506 temp.__overlay.minor = _minor;
1510 static inline dev_t rtems_filesystem_make_dev_t_from_pointer(
1514 uint64_t temp = (((uint64_t) 1) << 63) | (((uintptr_t) pointer) >> 1);
1516 return rtems_filesystem_make_dev_t((uint32_t) (temp >> 32), (uint32_t) temp);
1525 temp.device = device;
1526 return temp.__overlay.major;
1536 temp.device = device;
1537 return temp.__overlay.minor;
1540 #define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \ 1542 (_major) = rtems_filesystem_dev_major_t ( _dev ); \ 1543 (_minor) = rtems_filesystem_dev_minor_t( _dev ); \ 1560 void rtems_libio_post_driver(
void);
1562 void rtems_libio_exit(
void);
1573 extern int rtems_mkdir(
const char *path, mode_t mode);
1591 #define RTEMS_FILESYSTEM_TYPE_IMFS "imfs" 1592 #define RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs" 1593 #define RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs" 1594 #define RTEMS_FILESYSTEM_TYPE_NFS "nfs" 1595 #define RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs" 1596 #define RTEMS_FILESYSTEM_TYPE_RFS "rfs" 1597 #define RTEMS_FILESYSTEM_TYPE_JFFS2 "jffs2" 1608 const void *immutable_fs_info;
1648 RTEMS_FILESYSTEM_READ_ONLY,
1649 RTEMS_FILESYSTEM_READ_WRITE,
1650 RTEMS_FILESYSTEM_BAD_OPTIONS
1716 const char *mount_path
1769 const char *filesystemtype,
1788 const char *filesystemtype,
1858 const char *filesystemtype;
1864 rtems_filesystem_root_configuration;
1880 int (*firstOpen)(
int major,
int minor,
void *arg);
1881 int (*lastClose)(
int major,
int minor,
void *arg);
1882 int (*pollRead)(
int minor);
1883 ssize_t (*write)(
int minor,
const char *buf,
size_t len);
1884 int (*setAttributes)(
int minor,
const struct termios *t);
1885 int (*stopRemoteTx)(
int minor);
1886 int (*startRemoteTx)(
int minor);
1887 int outputUsesInterrupts;
2017 int rtems_termios_enqueue_raw_characters(
2046 int rtems_termios_dequeue_characters(
2056 #define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options) 2061 #define rtems_filesystem_type(_mte) ((_mte)->type) 2066 #define rtems_filesystem_mount_point(_mte) ((_mte)->target) 2071 #define rtems_filesystem_mount_device(_mte) ((_mte)->dev) Parameter block for open/close.
rtems_termios_iproc_status_code
The status code returned by all Termios input processing (iproc) functions and input signal (isig) ha...
void rtems_filesystem_initialize(void)
Base File System Initialization.
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_utime(const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime)
Contain file system specific information which is required to support fpathconf().
Interface to the statvfs() Set of API Methods.
int(* rtems_filesystem_rmnod_t)(const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc)
Removes a node.
bool rtems_filesystem_iterate(rtems_per_filesystem_routine routine, void *routine_arg)
Iterates over all file system types.
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 loc...
const rtems_filesystem_operations_table rtems_filesystem_operations_default
File system operations table with default operations.
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)
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.
int(* rtems_filesystem_fstat_t)(const rtems_filesystem_location_info_t *loc, struct stat *buf)
Gets a node status.
int(* rtems_filesystem_close_t)(rtems_libio_t *iop)
Closes a node.
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.
const rtems_filesystem_table_t rtems_filesystem_table[]
Static table of file systems.
int rtems_filesystem_default_unmount(rtems_filesystem_mount_table_entry_t *mt_entry)
int rtems_filesystem_default_open(rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
rtems_filesystem_global_location_t * rootloc
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.
void(* rtems_filesystem_mt_entry_unlock_t)(const rtems_filesystem_mount_table_entry_t *mt_entry)
Unlocks a file system instance.
void rtems_filesystem_default_unlock(const rtems_filesystem_mount_table_entry_t *mt_entry)
Releases the IO library mutex.
rtems_filesystem_options_t
File system options.
uint32_t rtems_device_major_number
This integer type represents the major number of devices.
rtems_termios_iproc_status_code rtems_termios_posix_isig_handler(unsigned char c, struct rtems_termios_tty *tty)
POSIX handler for ISIG (VINTR/VKILL)
void(* rtems_filesystem_eval_path_t)(rtems_filesystem_eval_path_context_t *ctx)
Path evaluation.
int(* rtems_filesystem_utime_t)(const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime)
Set node access and modification times.
This status indicates that the input processing is done.
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.
ssize_t rtems_filesystem_default_readlink(const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize)
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.
rtems_termios_iproc_status_code rtems_termios_default_isig_handler(unsigned char c, struct rtems_termios_tty *tty)
Default handler for ISIG (VINTR/VKILL)
Parameter block for ioctl.
int(* rtems_filesystem_fchmod_t)(const rtems_filesystem_location_info_t *loc, mode_t mode)
Changes the mode of a node.
Paramameter block for read/write.
int rtems_filesystem_default_fchmod(const rtems_filesystem_location_info_t *loc, mode_t mode)
int rtems_filesystem_default_fcntl(rtems_libio_t *iop, int cmd)
int(* rtems_filesystem_fcntl_t)(rtems_libio_t *iop, int cmd)
File control.
int(* rtems_filesystem_poll_t)(rtems_libio_t *iop, int events)
Poll and select support.
int rtems_filesystem_register(const char *type, rtems_filesystem_fsmount_me_t mount_h)
Registers a file system type.
int rtems_filesystem_default_mmap(rtems_libio_t *iop, void **addr, size_t len, int prot, off_t off)
Default MMAP handler.
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.
struct rtems_filesystem_table_t rtems_filesystem_table_t
File system table entry.
int rtems_filesystem_default_kqfilter(rtems_libio_t *iop, struct knote *kn)
Default kernel event filter handler.
File system node operations table.
void(* rtems_filesystem_fsunmount_me_t)(rtems_filesystem_mount_table_entry_t *mt_entry)
Destroys a file system instance.
const rtems_filesystem_limits_and_options_t rtems_filesystem_default_pathconf
Default pathconf settings.
static bool rtems_libio_iop_is_readable(const rtems_libio_t *iop)
Returns true if this is a readable iop, otherwise returns false.
int rtems_filesystem_default_poll(rtems_libio_t *iop, int events)
Default poll handler.
int(* rtems_filesystem_fsmount_me_t)(rtems_filesystem_mount_table_entry_t *mt_entry, const void *data)
Initializes a file system instance.
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.
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.
off_t(* rtems_filesystem_lseek_t)(rtems_libio_t *iop, off_t offset, int whence)
Moves the read/write file offset.
ssize_t(* rtems_filesystem_write_t)(rtems_libio_t *iop, const void *buffer, size_t count)
Writes to a node.
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
static bool rtems_libio_iop_is_append(const rtems_libio_t *iop)
Returns true if this is an append iop, otherwise returns false.
void(* rtems_filesystem_freenode_t)(const rtems_filesystem_location_info_t *loc)
Frees the location of a node.
rtems_filesystem_location_info_t currentloc
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.
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.
bool(* rtems_per_filesystem_routine)(const rtems_filesystem_table_t *fs_entry, void *arg)
Per file system type routine.
void rtems_filesystem_default_freenode(const rtems_filesystem_location_info_t *loc)
int rtems_filesystem_default_symlink(const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, const char *target)
int(* rtems_filesystem_mount_t)(rtems_filesystem_mount_table_entry_t *mt_entry)
Mounts a file system instance in a mount point (directory).
int unmount(const char *mount_path)
Unmounts the file system instance at the specified mount path.
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.
int rtems_filesystem_default_rmnod(const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc)
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_ftruncate(rtems_libio_t *iop, off_t length)
This status indicates that the input processing should stop due to a signal.
rtems_filesystem_global_location_t * startloc
int rtems_filesystem_default_close(rtems_libio_t *iop)
rtems_filesystem_fsmount_me_t rtems_filesystem_get_mount_handler(const char *type)
Gets the mount handler for the file system type.
int rtems_filesystem_default_fsync_or_fdatasync_success(rtems_libio_t *iop)
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.
int(* rtems_filesystem_ioctl_t)(rtems_libio_t *iop, ioctl_command_t request, void *buffer)
IO control of a node.
int(* rtems_filesystem_fsync_t)(rtems_libio_t *iop)
Synchronizes changes to a file.
This header file defines the RTEMS Classic API.
File system operations table.
int rtems_filesystem_default_ftruncate_directory(rtems_libio_t *iop, off_t length)
int rtems_filesystem_default_mount(rtems_filesystem_mount_table_entry_t *mt_entry)
rtems_termios_iproc_status_code(* rtems_termios_isig_handler)(unsigned char c, struct rtems_termios_tty *tty)
Type for ISIG (VINTR/VKILL) handler.
void(* rtems_filesystem_mt_entry_lock_t)(const rtems_filesystem_mount_table_entry_t *mt_entry)
Locks a file system instance.
int(* rtems_filesystem_ftruncate_t)(rtems_libio_t *iop, off_t length)
Truncates a file to a specified length.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
const rtems_filesystem_file_handlers_r rtems_filesystem_handlers_default
File system node handler table with default node handlers.
off_t rtems_filesystem_default_lseek(rtems_libio_t *iop, off_t offset, int whence)
ssize_t rtems_filesystem_default_read(rtems_libio_t *iop, void *buffer, size_t count)
void rtems_filesystem_default_fsunmount(rtems_filesystem_mount_table_entry_t *mt_entry)
bool(* rtems_filesystem_mt_entry_visitor)(const rtems_filesystem_mount_table_entry_t *mt_entry, void *arg)
Mount table entry visitor.
int(* rtems_filesystem_clonenode_t)(rtems_filesystem_location_info_t *loc)
Clones a location.
int rtems_mkdir(const char *path, mode_t mode)
Creates a directory and all its parent directories according to path.
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.
int rtems_filesystem_default_statvfs(const rtems_filesystem_location_info_t *loc, struct statvfs *buf)
int(* rtems_filesystem_statvfs_t)(const rtems_filesystem_location_info_t *loc, struct statvfs *buf)
Gets file system information.
int rtems_filesystem_default_clonenode(rtems_filesystem_location_info_t *loc)
ssize_t rtems_filesystem_default_write(rtems_libio_t *iop, const void *buffer, size_t count)
An open file data structure.
bool rtems_filesystem_mount_iterate(rtems_filesystem_mt_entry_visitor visitor, void *visitor_arg)
Iterates over all file system mount entries.
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_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_unregister(const char *type)
Unregisters a file system type.
rtems_status_code rtems_termios_register_isig_handler(rtems_termios_isig_handler handler)
Register handler for ISIG (VINTR/VKILL)
int(* rtems_filesystem_kqfilter_t)(rtems_libio_t *iop, struct knote *kn)
Kernel event filter support.
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
int(* rtems_filesystem_fdatasync_t)(rtems_libio_t *iop)
Synchronizes the data of a file.
int(* rtems_filesystem_unmount_t)(rtems_filesystem_mount_table_entry_t *mt_entry)
Unmounts a file system instance in a mount point (directory).
static bool rtems_libio_iop_is_writeable(const rtems_libio_t *iop)
Returns true if this is a writeable iop, otherwise returns false.
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.
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_ioctl(rtems_libio_t *iop, ioctl_command_t request, void *buffer)
rtems_termios_device_handler handler
The device handler.
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
int rtems_filesystem_default_chown(const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group)
ssize_t(* rtems_filesystem_read_t)(rtems_libio_t *iop, void *buffer, size_t count)
Reads from a node.
void rtems_filesystem_default_lock(const rtems_filesystem_mount_table_entry_t *mt_entry)
Obtains the IO library mutex.
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.
int rtems_filesystem_default_fsync_or_fdatasync(rtems_libio_t *iop)
Global file system location.
This status indicates that the input processing can continue.
int(* rtems_filesystem_open_t)(rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
Opens a node.
int(* rtems_filesystem_mmap_t)(rtems_libio_t *iop, void **addr, size_t len, int prot, off_t off)
MMAP support.