RTEMS 6.2-rc3
Loading...
Searching...
No Matches
libio.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
15/*
16 * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
17 *
18 * Modifications to support reference counting in the file system are
19 * Copyright (C) 2012 embedded brains GmbH & Co. KG
20 *
21 * Copyright (C) 2025 Contemporary Software
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the above copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 *
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
36 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGE.
43 */
44
45#ifndef _RTEMS_RTEMS_LIBIO_H
46#define _RTEMS_RTEMS_LIBIO_H
47
48#include <sys/types.h>
49#include <sys/stat.h>
50#include <sys/ioccom.h>
51#include <sys/statvfs.h>
52#include <sys/uio.h>
53
54#include <unistd.h>
55#include <termios.h>
56
57#include <rtems.h>
58#include <rtems/fs.h>
59#include <rtems/chain.h>
60#include <rtems/score/atomic.h>
61#include <rtems/termiosdevice.h>
62
63#ifdef __cplusplus
64extern "C" {
65#endif
66
67struct knote;
68
89);
90
100);
101
105typedef struct {
109 const char *path;
110
114 size_t pathlen;
115
120 const char *token;
121
126 size_t tokenlen;
127
140 int flags;
141
148
157
163
170
180);
181
196 const rtems_filesystem_location_info_t *parentloc,
197 const rtems_filesystem_location_info_t *targetloc,
198 const char *name,
199 size_t namelen
200);
201
215 mode_t mode
216);
217
232 uid_t owner,
233 gid_t group
234);
235
253);
254
264);
265
284);
285
300 const void *data
301);
302
319);
320
334);
335
353);
354
372 const rtems_filesystem_location_info_t *parentloc,
373 const char *name,
374 size_t namelen,
375 mode_t mode,
376 dev_t dev
377);
378
391 const rtems_filesystem_location_info_t *parentloc,
393);
394
408 struct timespec times[2]
409);
410
426 const rtems_filesystem_location_info_t *parentloc,
427 const char *name,
428 size_t namelen,
429 const char *target
430);
431
446 char *buf,
447 size_t bufsize
448);
449
465 const rtems_filesystem_location_info_t *oldparentloc,
467 const rtems_filesystem_location_info_t *newparentloc,
468 const char *name,
469 size_t namelen
470);
471
485 struct statvfs *buf
486);
487
496 rtems_filesystem_are_nodes_equal_t are_nodes_equal_h;
505 rtems_filesystem_fsunmount_me_t fsunmount_me_h;
511};
512
518
526);
527
535);
536
545);
546
553 const rtems_filesystem_location_info_t *parentloc,
554 const rtems_filesystem_location_info_t *targetloc,
555 const char *name,
556 size_t namelen
557);
558
574);
575
582 const rtems_filesystem_location_info_t *parentloc,
583 const char *name,
584 size_t namelen,
585 mode_t mode,
586 dev_t dev
587);
588
595 const rtems_filesystem_location_info_t *parentloc,
597);
598
606 mode_t mode
607);
608
616 uid_t owner,
617 gid_t group
618);
619
627);
628
634);
635
642 rtems_filesystem_mount_table_entry_t *mt_entry /* IN */
643);
644
651 rtems_filesystem_mount_table_entry_t *mt_entry /* IN */
652);
653
660 rtems_filesystem_mount_table_entry_t *mt_entry /* IN */
661);
662
670 struct timespec times[2]
671);
672
679 const rtems_filesystem_location_info_t *parentloc,
680 const char *name,
681 size_t namelen,
682 const char *target
683);
684
692 char *buf,
693 size_t bufsize
694);
695
702 const rtems_filesystem_location_info_t *oldparentloc,
704 const rtems_filesystem_location_info_t *newparentloc,
705 const char *name,
706 size_t namelen
707);
708
716 struct statvfs *buf
717);
718
744 rtems_libio_t *iop,
745 const char *path,
746 int oflag,
747 mode_t mode
748);
749
761 rtems_libio_t *iop
762);
763
778typedef ssize_t (*rtems_filesystem_read_t)(
779 rtems_libio_t *iop,
780 void *buffer,
781 size_t count
782);
783
800typedef ssize_t (*rtems_filesystem_readv_t)(
801 rtems_libio_t *iop,
802 const struct iovec *iov,
803 int iovcnt,
804 ssize_t total
805);
806
821typedef ssize_t (*rtems_filesystem_write_t)(
822 rtems_libio_t *iop,
823 const void *buffer,
824 size_t count
825);
826
843typedef ssize_t (*rtems_filesystem_writev_t)(
844 rtems_libio_t *iop,
845 const struct iovec *iov,
846 int iovcnt,
847 ssize_t total
848);
849
863 rtems_libio_t *iop,
864 ioctl_command_t request,
865 void *buffer
866);
867
883 rtems_libio_t *iop,
884 off_t offset,
885 int whence
886);
887
901 struct stat *buf
902);
903
917 rtems_libio_t *iop,
918 off_t length
919);
920
933 rtems_libio_t *iop
934);
935
948 rtems_libio_t *iop
949);
950
963 rtems_libio_t *iop,
964 int cmd
965);
966
978 rtems_libio_t *iop,
979 int events
980);
981
994 rtems_libio_t *iop,
995 struct knote *kn
996);
997
1013 rtems_libio_t *iop,
1014 void **addr,
1015 size_t len,
1016 int prot,
1017 off_t off
1018);
1019
1031 rtems_filesystem_ftruncate_t ftruncate_h;
1033 rtems_filesystem_fdatasync_t fdatasync_h;
1036 rtems_filesystem_kqfilter_t kqfilter_h;
1040};
1041
1047
1054 rtems_libio_t *iop,
1055 const char *path,
1056 int oflag,
1057 mode_t mode
1058);
1059
1066 rtems_libio_t *iop
1067);
1068
1075 rtems_libio_t *iop,
1076 void *buffer,
1077 size_t count
1078);
1079
1086 rtems_libio_t *iop,
1087 const struct iovec *iov,
1088 int iovcnt,
1089 ssize_t total
1090);
1091
1098 rtems_libio_t *iop,
1099 const void *buffer,
1100 size_t count
1101);
1102
1109 rtems_libio_t *iop,
1110 const struct iovec *iov,
1111 int iovcnt,
1112 ssize_t total
1113);
1114
1121 rtems_libio_t *iop,
1122 ioctl_command_t request,
1123 void *buffer
1124);
1125
1132 rtems_libio_t *iop,
1133 off_t offset,
1134 int whence
1135);
1136
1149 rtems_libio_t *iop,
1150 off_t offset,
1151 int whence
1152);
1153
1172 rtems_libio_t *iop,
1173 off_t offset,
1174 int whence
1175);
1176
1186 struct stat *buf
1187);
1188
1195 rtems_libio_t *iop,
1196 off_t length
1197);
1198
1205 rtems_libio_t *iop,
1206 off_t length
1207);
1208
1215 rtems_libio_t *iop
1216);
1217
1224 rtems_libio_t *iop
1225);
1226
1233 rtems_libio_t *iop,
1234 int cmd
1235);
1236
1245 rtems_libio_t *iop,
1246 int events
1247);
1248
1257 rtems_libio_t *iop,
1258 struct knote *kn
1259);
1260
1269 rtems_libio_t *iop,
1270 void **addr,
1271 size_t len,
1272 int prot,
1273 off_t off
1274);
1275
1292typedef off_t rtems_off64_t __attribute__((deprecated));
1293
1302 const char *type
1303);
1304
1309typedef struct {
1310 int link_max; /* count */
1311 int max_canon; /* max formatted input line size */
1312 int max_input; /* max input line size */
1313 int name_max; /* max name length */
1314 int path_max; /* max path */
1315 int pipe_buf; /* pipe buffer size */
1316 int posix_async_io; /* async IO supported on fs, 0=no, 1=yes */
1317 int posix_chown_restrictions; /* can chown: 0=no, 1=yes */
1318 int posix_no_trunc; /* error on names > max name, 0=no, 1=yes */
1319 int posix_prio_io; /* priority IO, 0=no, 1=yes */
1320 int posix_sync_io; /* file can be sync'ed, 0=no, 1=yes */
1321 int posix_vdisable; /* special char processing, 0=no, 1=yes */
1323
1331
1341 Atomic_Uint flags;
1342 off_t offset; /* current offset into file */
1344 uint32_t data0; /* private to "driver" */
1345 void *data1; /* ... */
1346};
1347
1354typedef struct {
1355 rtems_libio_t *iop;
1356 off_t offset;
1357 char *buffer;
1358 uint32_t count;
1359 uint32_t flags;
1360 uint32_t bytes_moved;
1362
1367 rtems_libio_t *iop;
1368 uint32_t flags;
1369 uint32_t mode;
1371
1375typedef struct {
1376 rtems_libio_t *iop;
1377 ioctl_command_t command;
1378 void *buffer;
1379 int ioctl_return;
1381
1387#define LIBIO_FLAGS_FREE 0x0001U /* on the free list */
1388#define LIBIO_FLAGS_NO_DELAY 0x0002U /* return immediately if no data */
1389#define LIBIO_FLAGS_READ 0x0004U /* reading */
1390#define LIBIO_FLAGS_WRITE 0x0008U /* writing */
1391#define LIBIO_FLAGS_OPEN 0x0100U /* device is open */
1392#define LIBIO_FLAGS_APPEND 0x0200U /* all writes append */
1393#define LIBIO_FLAGS_CLOSE_BUSY 0x0400U /* close with refs held */
1394#define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800U /* close on process exec() */
1395#define LIBIO_FLAGS_REFERENCE_INC 0x1000U
1396/* masks */
1397#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
1398#define LIBIO_FLAGS_FLAGS_MASK (LIBIO_FLAGS_REFERENCE_INC - 1U)
1399#define LIBIO_FLAGS_REFERENCE_MASK (~LIBIO_FLAGS_FLAGS_MASK)
1400
1403static inline unsigned int rtems_libio_iop_flags( const rtems_libio_t *iop )
1404{
1405 return _Atomic_Load_uint( &iop->flags, ATOMIC_ORDER_RELAXED );
1406}
1407
1414static inline unsigned int rtems_libio_iop_flags_bad_fd(
1415 const unsigned int flags
1416)
1417{
1418 return ( ( flags & LIBIO_FLAGS_FREE ) != 0 )
1419 || ( ( flags & LIBIO_FLAGS_OPEN ) == 0 );
1420}
1421
1427static inline bool rtems_libio_iop_is_no_delay( const rtems_libio_t *iop )
1428{
1429 return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_NO_DELAY ) != 0;
1430}
1431
1437static inline bool rtems_libio_iop_is_readable( const rtems_libio_t *iop )
1438{
1439 return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_READ ) != 0;
1440}
1441
1447static inline bool rtems_libio_iop_is_writeable( const rtems_libio_t *iop )
1448{
1449 return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_WRITE ) != 0;
1450}
1451
1457static inline bool rtems_libio_iop_is_open( const rtems_libio_t *iop )
1458{
1459 return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_OPEN ) != 0;
1460}
1461
1467static inline bool rtems_libio_iop_is_append( const rtems_libio_t *iop )
1468{
1469 return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_APPEND ) != 0;
1470}
1471
1477static inline bool rtems_libio_iop_is_held( const rtems_libio_t *iop )
1478{
1479 const unsigned int ref_count =
1480 rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_REFERENCE_MASK;
1481 return ref_count != 0;
1482}
1483
1489static inline bool rtems_libio_iop_is_free( const rtems_libio_t *iop )
1490{
1491 return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_FREE ) != 0;
1492}
1493
1499typedef int (*rtems_libio_open_t)(
1500 const char *pathname,
1501 uint32_t flag,
1502 uint32_t mode
1503);
1504
1505typedef int (*rtems_libio_close_t)(
1506 int fd
1507);
1508
1509typedef ssize_t (*rtems_libio_read_t)(
1510 int fd,
1511 void *buffer,
1512 size_t count
1513);
1514
1515typedef ssize_t (*rtems_libio_write_t)(
1516 int fd,
1517 const void *buffer,
1518 size_t count
1519);
1520
1521typedef int (*rtems_libio_ioctl_t)(
1522 int fd,
1523 uint32_t command,
1524 void *buffer
1525);
1526
1527typedef off_t (*rtems_libio_lseek_t)(
1528 int fd,
1529 off_t offset,
1530 int whence
1531);
1532
1540/*
1541 * The following macros are used to build up the permissions sets
1542 * used to check permissions. These are similar in style to the
1543 * mode_t bits and should stay compatible with them.
1544 */
1545#define RTEMS_FS_PERMS_READ 0x4
1546#define RTEMS_FS_PERMS_WRITE 0x2
1547#define RTEMS_FS_PERMS_EXEC 0x1
1548#define RTEMS_FS_PERMS_RWX \
1549 (RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE | RTEMS_FS_PERMS_EXEC)
1550#define RTEMS_FS_FOLLOW_HARD_LINK 0x8
1551#define RTEMS_FS_FOLLOW_SYM_LINK 0x10
1552#define RTEMS_FS_FOLLOW_LINK \
1553 (RTEMS_FS_FOLLOW_HARD_LINK | RTEMS_FS_FOLLOW_SYM_LINK)
1554#define RTEMS_FS_MAKE 0x20
1555#define RTEMS_FS_EXCLUSIVE 0x40
1556#define RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS 0x80
1557#define RTEMS_FS_REJECT_TERMINAL_DOT 0x100
1558
1562 dev_t device;
1563 struct {
1566 } __overlay;
1567};
1568
1569static inline dev_t rtems_filesystem_make_dev_t(
1572)
1573{
1574 union __rtems_dev_t temp;
1575
1576 temp.__overlay.major = _major;
1577 temp.__overlay.minor = _minor;
1578 return temp.device;
1579}
1580
1581static inline dev_t rtems_filesystem_make_dev_t_from_pointer(
1582 const void *pointer
1583)
1584{
1585 uint64_t temp = (((uint64_t) 1) << 63) | (((uintptr_t) pointer) >> 1);
1586
1587 return rtems_filesystem_make_dev_t((uint32_t) (temp >> 32), (uint32_t) temp);
1588}
1589
1590static inline rtems_device_major_number rtems_filesystem_dev_major_t(
1591 dev_t device
1592)
1593{
1594 union __rtems_dev_t temp;
1595
1596 temp.device = device;
1597 return temp.__overlay.major;
1598}
1599
1600
1601static inline rtems_device_minor_number rtems_filesystem_dev_minor_t(
1602 dev_t device
1603)
1604{
1605 union __rtems_dev_t temp;
1606
1607 temp.device = device;
1608 return temp.__overlay.minor;
1609}
1610
1611#define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \
1612 do { \
1613 (_major) = rtems_filesystem_dev_major_t ( _dev ); \
1614 (_minor) = rtems_filesystem_dev_minor_t( _dev ); \
1615 } while(0)
1616
1617/*
1618 * Prototypes for filesystem
1619 */
1620
1629void rtems_filesystem_initialize( void );
1630
1631void rtems_libio_post_driver(void);
1632
1633void rtems_libio_exit(void);
1634
1644extern int rtems_mkdir(const char *path, mode_t mode);
1645
1662#define RTEMS_FILESYSTEM_TYPE_IMFS "imfs"
1663#define RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs"
1664#define RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs"
1665#define RTEMS_FILESYSTEM_TYPE_NFS "nfs"
1666#define RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs"
1667#define RTEMS_FILESYSTEM_TYPE_RFS "rfs"
1668#define RTEMS_FILESYSTEM_TYPE_JFFS2 "jffs2"
1669
1676 rtems_chain_node mt_node;
1677 void *fs_info;
1679 const void *immutable_fs_info;
1680 rtems_chain_control location_chain;
1683 bool mounted;
1684 bool writeable;
1685 bool no_regular_file_mknod;
1686 const rtems_filesystem_limits_and_options_t *pathconf_limits_and_options;
1687
1688 /*
1689 * The target or mount point of the file system.
1690 */
1691 const char *target;
1692
1693 /*
1694 * The type of filesystem or the name of the filesystem.
1695 */
1696 const char *type;
1697
1698 /*
1699 * When someone adds a mounted filesystem on a real device,
1700 * this will need to be used.
1701 *
1702 * The lower layers can manage how this is managed. Leave as a
1703 * string.
1704 */
1705 char *dev;
1706
1714};
1715
1719typedef enum {
1720 RTEMS_FILESYSTEM_READ_ONLY,
1721 RTEMS_FILESYSTEM_READ_WRITE,
1722 RTEMS_FILESYSTEM_BAD_OPTIONS
1724
1729 const char *type;
1732
1739
1740extern rtems_chain_control rtems_filesystem_mount_table;
1741
1751 const char *type,
1753);
1754
1762 const char *type
1763);
1764
1787int unmount(
1788 const char *mount_path
1789);
1790
1838int mount(
1839 const char *source,
1840 const char *target,
1841 const char *filesystemtype,
1843 const void *data
1844);
1845
1858 const char *source,
1859 const char *target,
1860 const char *filesystemtype,
1862 const void *data
1863);
1864
1874 const rtems_filesystem_table_t *fs_entry,
1875 void *arg
1876);
1877
1893 void *routine_arg
1894);
1895
1906 void *arg
1907);
1908
1924 void *visitor_arg
1925);
1926
1927typedef struct {
1928 const char *source;
1929 const char *target;
1930 const char *filesystemtype;
1932 const void *data;
1934
1936 rtems_filesystem_root_configuration;
1937
1949struct rtems_termios_tty;
1950
1952 int (*firstOpen)(int major, int minor, void *arg);
1953 int (*lastClose)(int major, int minor, void *arg);
1954 int (*pollRead)(int minor);
1955 ssize_t (*write)(int minor, const char *buf, size_t len);
1956 int (*setAttributes)(int minor, const struct termios *t);
1957 int (*stopRemoteTx)(int minor);
1958 int (*startRemoteTx)(int minor);
1959 rtems_termios_device_mode outputUsesInterrupts;
1961
1962static inline void rtems_termios_initialize( void )
1963{
1964 /* Nothing to do, provided for backward compatibility */
1965}
1966
1967/*
1968 * CCJ: Change before opening a tty. Newer code from Eric is coming
1969 * so extra work to handle an open tty is not worth it. If the tty
1970 * is open, close then open it again.
1971 */
1972rtems_status_code rtems_termios_bufsize (
1973 size_t cbufsize, /* cooked buffer size */
1974 size_t raw_input, /* raw input buffer size */
1975 size_t raw_output /* raw output buffer size */
1976);
1977
1982typedef enum {
1990
2002
2010
2028 unsigned char c,
2029 struct rtems_termios_tty *tty
2030);
2031
2051 unsigned char c,
2052 struct rtems_termios_tty *tty
2053);
2054
2069 unsigned char c,
2070 struct rtems_termios_tty *tty
2071);
2072
2087);
2088
2089int rtems_termios_enqueue_raw_characters(
2090 void *ttyp,
2091 const char *buf,
2092 int len
2093);
2094
2095rtems_status_code rtems_termios_open (
2098 void *arg,
2099 const rtems_termios_callbacks *callbacks
2100);
2101
2102rtems_status_code rtems_termios_close(
2103 void *arg
2104);
2105
2106rtems_status_code rtems_termios_read(
2107 void *arg
2108);
2109
2110rtems_status_code rtems_termios_write(
2111 void *arg
2112);
2113
2114rtems_status_code rtems_termios_ioctl(
2115 void *arg
2116);
2117
2118int rtems_termios_dequeue_characters(
2119 void *ttyp,
2120 int len
2121);
2122
2128#define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
2129
2133#define rtems_filesystem_type(_mte) ((_mte)->type)
2134
2138#define rtems_filesystem_mount_point(_mte) ((_mte)->target)
2139
2143#define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
2144
2145#ifdef __cplusplus
2146}
2147#endif
2148
2149#endif /* _RTEMS_LIBIO_H */
clock_t times(struct tms *ptms)
Definition: __times.c:97
This header file provides the Chains API.
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:42
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:44
bool rtems_filesystem_iterate(rtems_per_filesystem_routine routine, void *routine_arg)
Iterates over all file system types.
Definition: mount-mgr.c:58
int unmount(const char *mount_path)
Unmounts the file system instance at the specified mount path.
Definition: unmount.c:62
int rtems_filesystem_unregister(const char *type)
Unregisters a file system type.
Definition: mount-mgr.c:160
const rtems_filesystem_table_t rtems_filesystem_table[]
Static table of file systems.
bool(* rtems_filesystem_mt_entry_visitor)(const rtems_filesystem_mount_table_entry_t *mt_entry, void *arg)
Mount table entry visitor.
Definition: libio.h:1904
bool(* rtems_per_filesystem_routine)(const rtems_filesystem_table_t *fs_entry, void *arg)
Per file system type routine.
Definition: libio.h:1873
int rtems_filesystem_register(const char *type, rtems_filesystem_fsmount_me_t mount_h)
Registers a file system type.
Definition: mount-mgr.c:126
rtems_filesystem_options_t
File system options.
Definition: libio.h:1719
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:197
int(* rtems_filesystem_ioctl_t)(rtems_libio_t *iop, ioctl_command_t request, void *buffer)
IO control of a node.
Definition: libio.h:862
int rtems_filesystem_default_fcntl(rtems_libio_t *iop, int cmd)
Definition: default_fcntl.c:41
int(* rtems_filesystem_poll_t)(rtems_libio_t *iop, int events)
Poll and select support.
Definition: libio.h:977
int rtems_filesystem_default_ftruncate(rtems_libio_t *iop, off_t length)
Definition: default_ftruncate.c:44
int rtems_filesystem_default_ftruncate_directory(rtems_libio_t *iop, off_t length)
Definition: default_ftruncate_directory.c:43
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:42
ssize_t(* rtems_filesystem_read_t)(rtems_libio_t *iop, void *buffer, size_t count)
Reads from a node.
Definition: libio.h:778
int(* rtems_filesystem_fcntl_t)(rtems_libio_t *iop, int cmd)
File control.
Definition: libio.h:962
int rtems_filesystem_default_ioctl(rtems_libio_t *iop, ioctl_command_t request, void *buffer)
Definition: default_ioctl.c:43
int rtems_filesystem_default_poll(rtems_libio_t *iop, int events)
Default poll handler.
Definition: default_poll.c:44
int rtems_filesystem_default_fsync_or_fdatasync(rtems_libio_t *iop)
Definition: default_fsync.c:43
const rtems_filesystem_file_handlers_r rtems_filesystem_handlers_default
File system node handler table with default node handlers.
Definition: default_handlers.c:38
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:42
int(* rtems_filesystem_kqfilter_t)(rtems_libio_t *iop, struct knote *kn)
Kernel event filter support.
Definition: libio.h:993
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:43
int rtems_filesystem_default_fsync_or_fdatasync_success(rtems_libio_t *iop)
Definition: default_fsync_success.c:42
int rtems_filesystem_default_kqfilter(rtems_libio_t *iop, struct knote *kn)
Default kernel event filter handler.
Definition: default_kqfilter.c:42
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:45
int(* rtems_filesystem_close_t)(rtems_libio_t *iop)
Closes a node.
Definition: libio.h:760
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:45
off_t(* rtems_filesystem_lseek_t)(rtems_libio_t *iop, off_t offset, int whence)
Moves the read/write file offset.
Definition: libio.h:882
off_t rtems_filesystem_default_lseek(rtems_libio_t *iop, off_t offset, int whence)
Definition: default_lseek.c:43
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:843
int(* rtems_filesystem_fstat_t)(const rtems_filesystem_location_info_t *loc, struct stat *buf)
Gets a node status.
Definition: libio.h:899
int rtems_filesystem_default_mmap(rtems_libio_t *iop, void **addr, size_t len, int prot, off_t off)
Default MMAP handler.
Definition: default_mmap.c:42
ssize_t(* rtems_filesystem_write_t)(rtems_libio_t *iop, const void *buffer, size_t count)
Writes to a node.
Definition: libio.h:821
int rtems_filesystem_default_close(rtems_libio_t *iop)
Definition: default_close.c:37
int(* rtems_filesystem_fsync_t)(rtems_libio_t *iop)
Synchronizes changes to a file.
Definition: libio.h:932
ssize_t rtems_filesystem_default_read(rtems_libio_t *iop, void *buffer, size_t count)
Definition: default_read.c:39
int(* rtems_filesystem_fdatasync_t)(rtems_libio_t *iop)
Synchronizes the data of a file.
Definition: libio.h:947
int rtems_filesystem_default_open(rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
Definition: default_open.c:43
int(* rtems_filesystem_mmap_t)(rtems_libio_t *iop, void **addr, size_t len, int prot, off_t off)
MMAP support.
Definition: libio.h:1012
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:800
ssize_t rtems_filesystem_default_write(rtems_libio_t *iop, const void *buffer, size_t count)
Definition: default_write.c:41
int(* rtems_filesystem_ftruncate_t)(rtems_libio_t *iop, off_t length)
Truncates a file to a specified length.
Definition: libio.h:916
int(* rtems_filesystem_open_t)(rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
Opens a node.
Definition: libio.h:743
int(* rtems_filesystem_statvfs_t)(const rtems_filesystem_location_info_t *loc, struct statvfs *buf)
Gets file system information.
Definition: libio.h:483
int rtems_filesystem_default_unmount(rtems_filesystem_mount_table_entry_t *mt_entry)
Definition: default_unmount.c:41
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:195
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:282
int(* rtems_filesystem_fchmod_t)(const rtems_filesystem_location_info_t *loc, mode_t mode)
Changes the mode of a node.
Definition: libio.h:213
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:42
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:44
void(* rtems_filesystem_fsunmount_me_t)(rtems_filesystem_mount_table_entry_t *mt_entry)
Destroys a file system instance.
Definition: libio.h:332
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:44
int rtems_filesystem_default_fchmod(const rtems_filesystem_location_info_t *loc, mode_t mode)
Definition: default_fchmod.c:42
void(* rtems_filesystem_eval_path_t)(rtems_filesystem_eval_path_context_t *ctx)
Path evaluation.
Definition: libio.h:178
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:317
int rtems_filesystem_default_clonenode(rtems_filesystem_location_info_t *loc)
Definition: default_clone.c:42
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:49
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:42
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:390
int rtems_filesystem_default_rmnod(const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc)
Definition: default_rmnod.c:44
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:464
int rtems_filesystem_default_mount(rtems_filesystem_mount_table_entry_t *mt_entry)
Definition: default_mount.c:41
int(* rtems_filesystem_clonenode_t)(rtems_filesystem_location_info_t *loc)
Clones a location.
Definition: libio.h:251
void rtems_filesystem_default_freenode(const rtems_filesystem_location_info_t *loc)
Definition: default_freenode.c:43
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:444
void rtems_filesystem_default_fsunmount(rtems_filesystem_mount_table_entry_t *mt_entry)
Definition: default_fsunmount.c:39
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:371
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:350
void(* rtems_filesystem_mt_entry_unlock_t)(const rtems_filesystem_mount_table_entry_t *mt_entry)
Unlocks a file system instance.
Definition: libio.h:98
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:42
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:44
int rtems_filesystem_default_statvfs(const rtems_filesystem_location_info_t *loc, struct statvfs *buf)
Definition: default_statvfs.c:42
int(* rtems_filesystem_utimens_t)(const rtems_filesystem_location_info_t *loc, struct timespec times[2])
Set node access and modification times.
Definition: libio.h:406
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:298
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:230
const rtems_filesystem_operations_table rtems_filesystem_operations_default
File system operations table with default operations.
Definition: default_ops.c:38
void(* rtems_filesystem_freenode_t)(const rtems_filesystem_location_info_t *loc)
Frees the location of a node.
Definition: libio.h:262
void(* rtems_filesystem_mt_entry_lock_t)(const rtems_filesystem_mount_table_entry_t *mt_entry)
Locks a file system instance.
Definition: libio.h:87
int rtems_filesystem_default_chown(const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group)
Definition: default_chown.c:42
ssize_t rtems_filesystem_default_readlink(const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize)
Definition: default_readlink.c:44
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:425
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:42
int rtems_filesystem_default_utimens(const rtems_filesystem_location_info_t *loc, struct timespec times[2])
Definition: default_utimens.c:43
struct rtems_libio_open_close_args rtems_libio_open_close_args_t
Parameter block for open/close.
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:109
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
void rtems_filesystem_initialize(void)
Base File System Initialization.
Definition: base_fs.c:51
const rtems_filesystem_limits_and_options_t rtems_filesystem_default_pathconf
Default pathconf settings.
Definition: mount.c:49
uint32_t rtems_device_major_number
This integer type represents the major number of devices.
Definition: io.h:103
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
Definition: io.h:115
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
Objects_Id rtems_id
This type represents RTEMS object identifiers.
Definition: types.h:94
rtems_termios_iproc_status_code rtems_termios_default_isig_handler(unsigned char c, struct rtems_termios_tty *tty)
Default handler for ISIG (VINTR/VKILL)
Definition: termios.c:1312
rtems_termios_iproc_status_code(* rtems_termios_isig_handler)(unsigned char c, struct rtems_termios_tty *tty)
Type for ISIG (VINTR/VKILL) handler.
Definition: libio.h:2027
rtems_termios_iproc_status_code
The status code returned by all Termios input processing (iproc) functions and input signal (isig) ha...
Definition: libio.h:1982
rtems_status_code rtems_termios_register_isig_handler(rtems_termios_isig_handler handler)
Register handler for ISIG (VINTR/VKILL)
Definition: termios.c:1324
rtems_termios_iproc_status_code rtems_termios_posix_isig_handler(unsigned char c, struct rtems_termios_tty *tty)
POSIX handler for ISIG (VINTR/VKILL)
Definition: termios_posix_isig_handler.c:23
@ RTEMS_TERMIOS_IPROC_DONE
This status indicates that the input processing is done.
Definition: libio.h:2008
@ RTEMS_TERMIOS_IPROC_CONTINUE
This status indicates that the input processing can continue.
Definition: libio.h:1989
@ RTEMS_TERMIOS_IPROC_INTERRUPT
This status indicates that the input processing should stop due to a signal.
Definition: libio.h:2001
rtems_termios_device_handler handler
The device handler.
Definition: termiostypes.h:166
Basic Filesystem Types.
This header file provides the interfaces of the Atomic Operations.
This header file defines the RTEMS Classic API.
This header file provides the statvfs() and fstatvfs() interfaces.
This structure represents a chain node.
Definition: chain.h:78
Definition: xnandpsu_onfi.h:185
File system node operations table.
Definition: libio.h:1023
File system operations table.
Definition: libio.h:491
Definition: iterateoverthreads.c:44
Path evaluation context.
Definition: libio.h:105
int recursionlevel
Definition: libio.h:147
rtems_filesystem_location_info_t currentloc
Definition: libio.h:156
const char * path
Definition: libio.h:109
size_t pathlen
Definition: libio.h:114
rtems_filesystem_global_location_t * rootloc
Definition: libio.h:162
size_t tokenlen
Definition: libio.h:126
const char * token
Definition: libio.h:120
int flags
Definition: libio.h:140
rtems_filesystem_global_location_t * startloc
Definition: libio.h:168
Global file system location.
Definition: fs.h:100
Contain file system specific information which is required to support fpathconf().
Definition: libio.h:1309
File system location.
Definition: fs.h:72
Definition: libio.h:1927
Mount table entry.
Definition: libio.h:1675
rtems_id unmount_task
Definition: libio.h:1713
File system table entry.
Definition: libio.h:1728
Parameter block for ioctl.
Definition: libio.h:1375
Parameter block for open/close.
Definition: libio.h:1366
Paramameter block for read/write.
Definition: libio.h:1354
An open file data structure.
Definition: libio.h:1340
Definition: libio.h:1951
Definition: termiostypes.h:94
Definition: statvfs.h:56
This header file provides the interfaces of the RTEMS Termios Device Support.
This union represents a chain control block.
Definition: chain.h:96
Definition: libio.h:1561