25 #ifndef _RTEMS_RTEMS_LIBIO_H 26 #define _RTEMS_RTEMS_LIBIO_H 28 #include <sys/types.h> 783 const struct iovec *iov,
826 const struct iovec *iov,
845 ioctl_command_t request,
1045 const struct iovec *iov,
1068 const struct iovec *iov,
1080 ioctl_command_t request,
1233 typedef off_t rtems_off64_t __attribute__((deprecated));
1258 int posix_chown_restrictions;
1302 uint32_t bytes_moved;
1319 ioctl_command_t command;
1329 #define LIBIO_FLAGS_NO_DELAY 0x0001U 1330 #define LIBIO_FLAGS_READ 0x0002U 1331 #define LIBIO_FLAGS_WRITE 0x0004U 1332 #define LIBIO_FLAGS_OPEN 0x0100U 1333 #define LIBIO_FLAGS_APPEND 0x0200U 1334 #define LIBIO_FLAGS_CREATE 0x0400U 1335 #define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800U 1336 #define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE) 1352 typedef int (*rtems_libio_open_t)(
1353 const char *pathname,
1358 typedef int (*rtems_libio_close_t)(
1362 typedef ssize_t (*rtems_libio_read_t)(
1368 typedef ssize_t (*rtems_libio_write_t)(
1374 typedef int (*rtems_libio_ioctl_t)(
1380 typedef off_t (*rtems_libio_lseek_t)(
1398 #define RTEMS_FS_PERMS_READ 0x4 1399 #define RTEMS_FS_PERMS_WRITE 0x2 1400 #define RTEMS_FS_PERMS_EXEC 0x1 1401 #define RTEMS_FS_PERMS_RWX \ 1402 (RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE | RTEMS_FS_PERMS_EXEC) 1403 #define RTEMS_FS_FOLLOW_HARD_LINK 0x8 1404 #define RTEMS_FS_FOLLOW_SYM_LINK 0x10 1405 #define RTEMS_FS_FOLLOW_LINK \ 1406 (RTEMS_FS_FOLLOW_HARD_LINK | RTEMS_FS_FOLLOW_SYM_LINK) 1407 #define RTEMS_FS_MAKE 0x20 1408 #define RTEMS_FS_EXCLUSIVE 0x40 1409 #define RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS 0x80 1410 #define RTEMS_FS_REJECT_TERMINAL_DOT 0x100 1417 rtems_device_major_number major;
1418 rtems_device_minor_number minor;
1422 static inline dev_t rtems_filesystem_make_dev_t(
1423 rtems_device_major_number _major,
1424 rtems_device_minor_number _minor
1429 temp.__overlay.major = _major;
1430 temp.__overlay.minor = _minor;
1434 static inline dev_t rtems_filesystem_make_dev_t_from_pointer(
1438 uint64_t temp = (((uint64_t) 1) << 63) | (((uintptr_t) pointer) >> 1);
1440 return rtems_filesystem_make_dev_t((uint32_t) (temp >> 32), (uint32_t) temp);
1443 static inline rtems_device_major_number rtems_filesystem_dev_major_t(
1449 temp.device = device;
1450 return temp.__overlay.major;
1454 static inline rtems_device_minor_number rtems_filesystem_dev_minor_t(
1460 temp.device = device;
1461 return temp.__overlay.minor;
1464 #define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \ 1466 (_major) = rtems_filesystem_dev_major_t ( _dev ); \ 1467 (_minor) = rtems_filesystem_dev_minor_t( _dev ); \ 1484 typedef void (*rtems_libio_helper)(void);
1486 extern const rtems_libio_helper rtems_libio_init_helper;
1488 extern const rtems_libio_helper rtems_libio_post_driver_helper;
1490 extern const rtems_libio_helper rtems_libio_exit_helper;
1492 extern const rtems_libio_helper rtems_fs_init_helper;
1494 void rtems_libio_helper_null(
void);
1496 void rtems_libio_post_driver(
void);
1498 void rtems_libio_exit(
void);
1509 extern int rtems_mkdir(
const char *path, mode_t mode);
1527 #define RTEMS_FILESYSTEM_TYPE_IMFS "imfs" 1528 #define RTEMS_FILESYSTEM_TYPE_MINIIMFS "mimfs" 1529 #define RTEMS_FILESYSTEM_TYPE_DEVFS "devfs" 1530 #define RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs" 1531 #define RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs" 1532 #define RTEMS_FILESYSTEM_TYPE_NFS "nfs" 1533 #define RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs" 1534 #define RTEMS_FILESYSTEM_TYPE_RFS "rfs" 1535 #define RTEMS_FILESYSTEM_TYPE_JFFS2 "jffs2" 1546 const void *immutable_fs_info;
1586 RTEMS_FILESYSTEM_READ_ONLY,
1587 RTEMS_FILESYSTEM_READ_WRITE,
1588 RTEMS_FILESYSTEM_BAD_OPTIONS
1654 const char *mount_path
1711 const char *filesystemtype,
1712 rtems_filesystem_options_t options,
1730 const char *filesystemtype,
1731 rtems_filesystem_options_t options,
1800 const char *filesystemtype;
1801 rtems_filesystem_options_t options;
1806 rtems_filesystem_root_configuration;
1820 int (*firstOpen)(
int major,
int minor,
void *arg);
1821 int (*lastClose)(
int major,
int minor,
void *arg);
1822 int (*pollRead)(
int minor);
1823 ssize_t (*
write)(
int minor,
const char *buf,
size_t len);
1824 int (*setAttributes)(
int minor,
const struct termios *t);
1825 int (*stopRemoteTx)(
int minor);
1826 int (*startRemoteTx)(
int minor);
1827 int outputUsesInterrupts;
1830 void rtems_termios_initialize (
void);
1844 rtems_device_major_number major,
1845 rtems_device_minor_number minor,
1866 int rtems_termios_enqueue_raw_characters(
1872 int rtems_termios_dequeue_characters(
1882 #define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options) 1887 #define rtems_filesystem_type(_mte) ((_mte)->type) 1892 #define rtems_filesystem_mount_point(_mte) ((_mte)->target) 1897 #define rtems_filesystem_mount_device(_mte) ((_mte)->dev) Parameter block for open/close.
Definition: libio.h:1308
void rtems_filesystem_initialize(void)
Base File System Initialization.
Definition: base_fs.c:32
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.
Definition: default_fstat.c:23
int rtems_filesystem_default_utime(const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime)
Definition: default_utime.c:24
This is used to manage each element (node) which is placed on a chain.
Definition: chain.h:65
Contain file system specific information which is required to support fpathconf().
Definition: libio.h:1250
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.
Definition: libio.h:368
bool rtems_filesystem_iterate(rtems_per_filesystem_routine routine, void *routine_arg)
Iterates over all file system types.
Definition: mount-mgr.c:40
const char * token
The contents of the token to be evaluated with respect to the current location.
Definition: libio.h:98
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...
Definition: default_are_nodes_equal.c:28
const rtems_filesystem_operations_table rtems_filesystem_operations_default
File system operations table with default operations.
Definition: default_ops.c:24
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)
Definition: default_link.c:23
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.
Definition: libio.h:405
int(* rtems_filesystem_fstat_t)(const rtems_filesystem_location_info_t *loc, struct stat *buf)
Gets a node status.
Definition: libio.h:880
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:80
int(* rtems_filesystem_close_t)(rtems_libio_t *iop)
Closes a node.
Definition: libio.h:741
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.
Definition: mount.c:178
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)
Definition: default_unmount.c:21
int rtems_filesystem_default_open(rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
Definition: default_open.c:23
rtems_filesystem_global_location_t * rootloc
The location of the root directory of the user environment during the evaluation start.
Definition: libio.h:140
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.
Definition: libio.h:349
int flags
The path evaluation is controlled by the following flags.
Definition: libio.h:118
void(* rtems_filesystem_mt_entry_unlock_t)(const rtems_filesystem_mount_table_entry_t *mt_entry)
Unlocks a file system instance.
Definition: libio.h:76
void rtems_filesystem_default_unlock(const rtems_filesystem_mount_table_entry_t *mt_entry)
Releases the IO library mutex.
Definition: default_lock_and_unlock.c:35
rtems_filesystem_options_t
File system options.
Definition: libio.h:1585
void(* rtems_filesystem_eval_path_t)(rtems_filesystem_eval_path_context_t *ctx)
Path evaluation.
Definition: libio.h:156
int(* rtems_filesystem_utime_t)(const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime)
Set node access and modification times.
Definition: libio.h:385
This is used to manage a chain.
Definition: chain.h:83
File system table entry.
Definition: libio.h:1594
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.
Definition: mount-mktgt.c:30
ssize_t rtems_filesystem_default_readlink(const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize)
Definition: default_readlink.c:24
Parameter block for ioctl.
Definition: libio.h:1317
ssize_t write(int fd, const void *buffer, size_t count)
POSIX 1003.1b 6.4.2 - Write to a File.
Definition: write.c:30
int(* rtems_filesystem_fchmod_t)(const rtems_filesystem_location_info_t *loc, mode_t mode)
Changes the mode of a node.
Definition: libio.h:191
Paramameter block for read/write.
Definition: libio.h:1296
int rtems_filesystem_default_fchmod(const rtems_filesystem_location_info_t *loc, mode_t mode)
Definition: default_fchmod.c:23
int rtems_filesystem_default_fcntl(rtems_libio_t *iop, int cmd)
Definition: default_fcntl.c:21
int(* rtems_filesystem_fcntl_t)(rtems_libio_t *iop, int cmd)
File control.
Definition: libio.h:943
int(* rtems_filesystem_poll_t)(rtems_libio_t *iop, int events)
Poll and select support.
Definition: libio.h:958
int rtems_filesystem_register(const char *type, rtems_filesystem_fsmount_me_t mount_h)
Registers a file system type.
Definition: mount-mgr.c:108
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.
Definition: libio.h:824
struct rtems_filesystem_table_t rtems_filesystem_table_t
File system table entry.
size_t tokenlen
The length of the token to be evaluated with respect to the current location.
Definition: libio.h:104
int rtems_filesystem_default_kqfilter(rtems_libio_t *iop, struct knote *kn)
Default kernel event filter handler.
Definition: default_kqfilter.c:32
File system node operations table.
Definition: libio.h:982
void(* rtems_filesystem_fsunmount_me_t)(rtems_filesystem_mount_table_entry_t *mt_entry)
Destroys a file system instance.
Definition: libio.h:310
const rtems_filesystem_limits_and_options_t rtems_filesystem_default_pathconf
Default pathconf settings.
Definition: mount.c:30
int rtems_filesystem_default_poll(rtems_libio_t *iop, int events)
Default poll handler.
Definition: default_poll.c:31
int(* rtems_filesystem_fsmount_me_t)(rtems_filesystem_mount_table_entry_t *mt_entry, const void *data)
Initializes a file system instance.
Definition: libio.h:276
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.
Definition: default_readv.c:32
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.
Definition: libio.h:444
POSIX Termios Implementation for RTEMS Console Device Driver.
off_t(* rtems_filesystem_lseek_t)(rtems_libio_t *iop, off_t offset, int whence)
Moves the read/write file offset.
Definition: libio.h:863
ssize_t(* rtems_filesystem_write_t)(rtems_libio_t *iop, const void *buffer, size_t count)
Writes to a node.
Definition: libio.h:802
rtems_status_code
Classic API Status.
Definition: status.h:46
void(* rtems_filesystem_freenode_t)(const rtems_filesystem_location_info_t *loc)
Frees the location of a node.
Definition: libio.h:240
rtems_filesystem_location_info_t currentloc
This is the current file system location of the evaluation process.
Definition: libio.h:134
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.
Definition: libio.h:328
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.
Definition: default_lseek_directory.c:28
bool(* rtems_per_filesystem_routine)(const rtems_filesystem_table_t *fs_entry, void *arg)
Per file system type routine.
Definition: libio.h:1743
void rtems_filesystem_default_freenode(const rtems_filesystem_location_info_t *loc)
Definition: default_freenode.c:23
int rtems_filesystem_default_symlink(const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, const char *target)
Definition: default_symlink.c:24
int(* rtems_filesystem_mount_t)(rtems_filesystem_mount_table_entry_t *mt_entry)
Mounts a file system instance in a mount point (directory).
Definition: libio.h:260
int unmount(const char *mount_path)
Unmounts the file system instance at the specified mount path.
Definition: unmount.c:43
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.
Definition: libio.h:781
int rtems_filesystem_default_rmnod(const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc)
Definition: default_rmnod.c:24
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.
Definition: default_writev.c:32
int rtems_filesystem_default_ftruncate(rtems_libio_t *iop, off_t length)
Definition: default_ftruncate.c:24
rtems_filesystem_global_location_t * startloc
The start location of the evaluation process.
Definition: libio.h:146
int rtems_filesystem_default_close(rtems_libio_t *iop)
Definition: default_close.c:18
rtems_filesystem_fsmount_me_t rtems_filesystem_get_mount_handler(const char *type)
Gets the mount handler for the file system type.
Definition: mount-mgr.c:91
void rtems_libio_init(void)
RTEMS LibIO Initialization.
Definition: libio_init.c:43
int rtems_filesystem_default_fsync_or_fdatasync_success(rtems_libio_t *iop)
Definition: default_fsync_success.c:28
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.
Definition: default_eval_path.c:28
int(* rtems_filesystem_ioctl_t)(rtems_libio_t *iop, ioctl_command_t request, void *buffer)
IO control of a node.
Definition: libio.h:843
int(* rtems_filesystem_fsync_t)(rtems_libio_t *iop)
Synchronizes changes to a file.
Definition: libio.h:913
Mount table entry.
Definition: libio.h:1542
File system operations table.
Definition: libio.h:471
int rtems_filesystem_default_ftruncate_directory(rtems_libio_t *iop, off_t length)
Definition: default_ftruncate_directory.c:29
int rtems_filesystem_default_mount(rtems_filesystem_mount_table_entry_t *mt_entry)
Definition: default_mount.c:21
Path evaluation context.
Definition: libio.h:83
void(* rtems_filesystem_mt_entry_lock_t)(const rtems_filesystem_mount_table_entry_t *mt_entry)
Locks a file system instance.
Definition: libio.h:65
int(* rtems_filesystem_ftruncate_t)(rtems_libio_t *iop, off_t length)
Truncates a file to a specified length.
Definition: libio.h:897
const rtems_filesystem_file_handlers_r rtems_filesystem_handlers_default
File system node handler table with default node handlers.
Definition: default_handlers.c:24
off_t rtems_filesystem_default_lseek(rtems_libio_t *iop, off_t offset, int whence)
Definition: default_lseek.c:23
ssize_t rtems_filesystem_default_read(rtems_libio_t *iop, void *buffer, size_t count)
Definition: default_read.c:20
void rtems_filesystem_default_fsunmount(rtems_filesystem_mount_table_entry_t *mt_entry)
Definition: default_fsunmount.c:20
bool(* rtems_filesystem_mt_entry_visitor)(const rtems_filesystem_mount_table_entry_t *mt_entry, void *arg)
Mount table entry visitor.
Definition: libio.h:1774
int(* rtems_filesystem_clonenode_t)(rtems_filesystem_location_info_t *loc)
Clones a location.
Definition: libio.h:229
int rtems_mkdir(const char *path, mode_t mode)
Creates a directory and all its parent directories according to path.
Definition: rtems_mkdir.c:130
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.
Definition: libio.h:173
int rtems_filesystem_default_statvfs(const rtems_filesystem_location_info_t *loc, struct statvfs *buf)
Definition: default_statvfs.c:23
int(* rtems_filesystem_statvfs_t)(const rtems_filesystem_location_info_t *loc, struct statvfs *buf)
Gets file system information.
Definition: libio.h:463
int rtems_filesystem_default_clonenode(rtems_filesystem_location_info_t *loc)
Definition: default_clone.c:28
ssize_t rtems_filesystem_default_write(rtems_libio_t *iop, const void *buffer, size_t count)
Definition: default_write.c:21
An open file data structure.
Definition: libio.h:1281
bool rtems_filesystem_mount_iterate(rtems_filesystem_mt_entry_visitor visitor, void *visitor_arg)
Iterates over all file system mount entries.
Definition: sup_fs_mount_iterate.c:28
rtems_id unmount_task
The task that initiated the unmount process.
Definition: libio.h:1579
off_t rtems_filesystem_default_lseek_file(rtems_libio_t *iop, off_t offset, int whence)
Default lseek() handler for files.
Definition: default_lseek_file.c:28
const char * path
The contents of the remaining path to be evaluated.
Definition: libio.h:87
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)
Definition: default_rename.c:24
int rtems_filesystem_unregister(const char *type)
Unregisters a file system type.
Definition: mount-mgr.c:141
size_t pathlen
The length of the remaining path to be evaluated.
Definition: libio.h:92
int(* rtems_filesystem_kqfilter_t)(rtems_libio_t *iop, struct knote *kn)
Kernel event filter support.
Definition: libio.h:974
int(* rtems_filesystem_fdatasync_t)(rtems_libio_t *iop)
Synchronizes the data of a file.
Definition: libio.h:928
int(* rtems_filesystem_unmount_t)(rtems_filesystem_mount_table_entry_t *mt_entry)
Unmounts a file system instance in a mount point (directory).
Definition: libio.h:295
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.
Definition: libio.h:208
int rtems_filesystem_default_mknod(const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, mode_t mode, dev_t dev)
Definition: default_mknod.c:24
int rtems_filesystem_default_ioctl(rtems_libio_t *iop, ioctl_command_t request, void *buffer)
Definition: default_ioctl.c:23
int rtems_filesystem_default_chown(const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group)
Definition: default_chown.c:23
int recursionlevel
Symbolic link evaluation is a recursive operation.
Definition: libio.h:125
ssize_t(* rtems_filesystem_read_t)(rtems_libio_t *iop, void *buffer, size_t count)
Reads from a node.
Definition: libio.h:759
void rtems_filesystem_default_lock(const rtems_filesystem_mount_table_entry_t *mt_entry)
Obtains the IO library mutex.
Definition: default_lock_and_unlock.c:28
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.
Definition: libio.h:424
int rtems_filesystem_default_fsync_or_fdatasync(rtems_libio_t *iop)
Definition: default_fsync.c:23
Global file system location.
Definition: fs.h:81
File system location.
Definition: fs.h:53
int(* rtems_filesystem_open_t)(rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
Opens a node.
Definition: libio.h:724