RTEMS
libio.h
Go to the documentation of this file.
1 
13 /*
14  * COPYRIGHT (c) 1989-2008.
15  * On-Line Applications Research Corporation (OAR).
16  *
17  * Modifications to support reference counting in the file system are
18  * Copyright (c) 2012 embedded brains GmbH.
19  *
20  * The license and distribution terms for this file may be
21  * found in the file LICENSE in this distribution or at
22  * http://www.rtems.org/license/LICENSE.
23  */
24 
25 #ifndef _RTEMS_RTEMS_LIBIO_H
26 #define _RTEMS_RTEMS_LIBIO_H
27 
28 #include <sys/types.h>
29 #include <sys/stat.h>
30 #include <sys/ioccom.h>
31 #include <sys/statvfs.h>
32 #include <sys/uio.h>
33 
34 #include <unistd.h>
35 #include <termios.h>
36 
37 #include <rtems.h>
38 #include <rtems/fs.h>
39 #include <rtems/chain.h>
40 #include <rtems/score/atomic.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 struct knote;
47 
68 );
69 
79 );
80 
84 typedef struct {
88  const char *path;
89 
93  size_t pathlen;
94 
99  const char *token;
100 
105  size_t tokenlen;
106 
119  int flags;
120 
127 
136 
142 
149 
159 );
160 
174 typedef int (*rtems_filesystem_link_t)(
175  const rtems_filesystem_location_info_t *parentloc,
176  const rtems_filesystem_location_info_t *targetloc,
177  const char *name,
178  size_t namelen
179 );
180 
194  mode_t mode
195 );
196 
211  uid_t owner,
212  gid_t group
213 );
214 
232 );
233 
243 );
244 
261 typedef int (*rtems_filesystem_mount_t) (
263 );
264 
279  const void *data
280 );
281 
298 );
299 
313 );
314 
332 );
333 
351  const rtems_filesystem_location_info_t *parentloc,
352  const char *name,
353  size_t namelen,
354  mode_t mode,
355  dev_t dev
356 );
357 
370  const rtems_filesystem_location_info_t *parentloc,
372 );
373 
388  time_t actime,
389  time_t modtime
390 );
391 
407  const rtems_filesystem_location_info_t *parentloc,
408  const char *name,
409  size_t namelen,
410  const char *target
411 );
412 
425 typedef ssize_t (*rtems_filesystem_readlink_t)(
427  char *buf,
428  size_t bufsize
429 );
430 
446  const rtems_filesystem_location_info_t *oldparentloc,
447  const rtems_filesystem_location_info_t *oldloc,
448  const rtems_filesystem_location_info_t *newparentloc,
449  const char *name,
450  size_t namelen
451 );
452 
466  struct statvfs *buf
467 );
468 
475  rtems_filesystem_eval_path_t eval_path_h;
477  rtems_filesystem_are_nodes_equal_t are_nodes_equal_h;
478  rtems_filesystem_mknod_t mknod_h;
479  rtems_filesystem_rmnod_t rmnod_h;
480  rtems_filesystem_fchmod_t fchmod_h;
481  rtems_filesystem_chown_t chown_h;
482  rtems_filesystem_clonenode_t clonenod_h;
483  rtems_filesystem_freenode_t freenod_h;
484  rtems_filesystem_mount_t mount_h;
485  rtems_filesystem_unmount_t unmount_h;
486  rtems_filesystem_fsunmount_me_t fsunmount_me_h;
487  rtems_filesystem_utime_t utime_h;
488  rtems_filesystem_symlink_t symlink_h;
489  rtems_filesystem_readlink_t readlink_h;
490  rtems_filesystem_rename_t rename_h;
491  rtems_filesystem_statvfs_t statvfs_h;
492 };
493 
499 
507 );
508 
516 );
517 
526 );
527 
534  const rtems_filesystem_location_info_t *parentloc,
535  const rtems_filesystem_location_info_t *targetloc,
536  const char *name,
537  size_t namelen
538 );
539 
555 );
556 
563  const rtems_filesystem_location_info_t *parentloc,
564  const char *name,
565  size_t namelen,
566  mode_t mode,
567  dev_t dev
568 );
569 
576  const rtems_filesystem_location_info_t *parentloc,
578 );
579 
587  mode_t mode
588 );
589 
597  uid_t owner,
598  gid_t group
599 );
600 
608 );
609 
615 );
616 
623  rtems_filesystem_mount_table_entry_t *mt_entry /* IN */
624 );
625 
632  rtems_filesystem_mount_table_entry_t *mt_entry /* IN */
633 );
634 
641  rtems_filesystem_mount_table_entry_t *mt_entry /* IN */
642 );
643 
651  time_t actime,
652  time_t modtime
653 );
654 
661  const rtems_filesystem_location_info_t *parentloc,
662  const char *name,
663  size_t namelen,
664  const char *target
665 );
666 
674  char *buf,
675  size_t bufsize
676 );
677 
684  const rtems_filesystem_location_info_t *oldparentloc,
685  const rtems_filesystem_location_info_t *oldloc,
686  const rtems_filesystem_location_info_t *newparentloc,
687  const char *name,
688  size_t namelen
689 );
690 
698  struct statvfs *buf
699 );
700 
725 typedef int (*rtems_filesystem_open_t)(
726  rtems_libio_t *iop,
727  const char *path,
728  int oflag,
729  mode_t mode
730 );
731 
743  rtems_libio_t *iop
744 );
745 
760 typedef ssize_t (*rtems_filesystem_read_t)(
761  rtems_libio_t *iop,
762  void *buffer,
763  size_t count
764 );
765 
782 typedef ssize_t (*rtems_filesystem_readv_t)(
783  rtems_libio_t *iop,
784  const struct iovec *iov,
785  int iovcnt,
786  ssize_t total
787 );
788 
803 typedef ssize_t (*rtems_filesystem_write_t)(
804  rtems_libio_t *iop,
805  const void *buffer,
806  size_t count
807 );
808 
825 typedef ssize_t (*rtems_filesystem_writev_t)(
826  rtems_libio_t *iop,
827  const struct iovec *iov,
828  int iovcnt,
829  ssize_t total
830 );
831 
845  rtems_libio_t *iop,
846  ioctl_command_t request,
847  void *buffer
848 );
849 
864 typedef off_t (*rtems_filesystem_lseek_t)(
865  rtems_libio_t *iop,
866  off_t offset,
867  int whence
868 );
869 
883  struct stat *buf
884 );
885 
899  rtems_libio_t *iop,
900  off_t length
901 );
902 
915  rtems_libio_t *iop
916 );
917 
930  rtems_libio_t *iop
931 );
932 
945  rtems_libio_t *iop,
946  int cmd
947 );
948 
959 typedef int (*rtems_filesystem_poll_t)(
960  rtems_libio_t *iop,
961  int events
962 );
963 
976  rtems_libio_t *iop,
977  struct knote *kn
978 );
979 
994 typedef int (*rtems_filesystem_mmap_t)(
995  rtems_libio_t *iop,
996  void **addr,
997  size_t len,
998  int prot,
999  off_t off
1000 );
1001 
1006  rtems_filesystem_open_t open_h;
1007  rtems_filesystem_close_t close_h;
1008  rtems_filesystem_read_t read_h;
1009  rtems_filesystem_write_t write_h;
1010  rtems_filesystem_ioctl_t ioctl_h;
1011  rtems_filesystem_lseek_t lseek_h;
1012  rtems_filesystem_fstat_t fstat_h;
1013  rtems_filesystem_ftruncate_t ftruncate_h;
1014  rtems_filesystem_fsync_t fsync_h;
1015  rtems_filesystem_fdatasync_t fdatasync_h;
1016  rtems_filesystem_fcntl_t fcntl_h;
1017  rtems_filesystem_poll_t poll_h;
1018  rtems_filesystem_kqfilter_t kqfilter_h;
1019  rtems_filesystem_readv_t readv_h;
1020  rtems_filesystem_writev_t writev_h;
1021  rtems_filesystem_mmap_t mmap_h;
1022 };
1023 
1029 
1036  rtems_libio_t *iop,
1037  const char *path,
1038  int oflag,
1039  mode_t mode
1040 );
1041 
1048  rtems_libio_t *iop
1049 );
1050 
1057  rtems_libio_t *iop,
1058  void *buffer,
1059  size_t count
1060 );
1061 
1068  rtems_libio_t *iop,
1069  const struct iovec *iov,
1070  int iovcnt,
1071  ssize_t total
1072 );
1073 
1080  rtems_libio_t *iop,
1081  const void *buffer,
1082  size_t count
1083 );
1084 
1091  rtems_libio_t *iop,
1092  const struct iovec *iov,
1093  int iovcnt,
1094  ssize_t total
1095 );
1096 
1103  rtems_libio_t *iop,
1104  ioctl_command_t request,
1105  void *buffer
1106 );
1107 
1114  rtems_libio_t *iop,
1115  off_t offset,
1116  int whence
1117 );
1118 
1131  rtems_libio_t *iop,
1132  off_t offset,
1133  int whence
1134 );
1135 
1154  rtems_libio_t *iop,
1155  off_t offset,
1156  int whence
1157 );
1158 
1168  struct stat *buf
1169 );
1170 
1177  rtems_libio_t *iop,
1178  off_t length
1179 );
1180 
1187  rtems_libio_t *iop,
1188  off_t length
1189 );
1190 
1197  rtems_libio_t *iop
1198 );
1199 
1206  rtems_libio_t *iop
1207 );
1208 
1215  rtems_libio_t *iop,
1216  int cmd
1217 );
1218 
1227  rtems_libio_t *iop,
1228  int events
1229 );
1230 
1239  rtems_libio_t *iop,
1240  struct knote *kn
1241 );
1242 
1251  rtems_libio_t *iop,
1252  void **addr,
1253  size_t len,
1254  int prot,
1255  off_t off
1256 );
1257 
1272 typedef off_t rtems_off64_t __attribute__((deprecated));
1273 
1282  const char *type
1283 );
1284 
1289 typedef struct {
1290  int link_max; /* count */
1291  int max_canon; /* max formatted input line size */
1292  int max_input; /* max input line size */
1293  int name_max; /* max name length */
1294  int path_max; /* max path */
1295  int pipe_buf; /* pipe buffer size */
1296  int posix_async_io; /* async IO supported on fs, 0=no, 1=yes */
1297  int posix_chown_restrictions; /* can chown: 0=no, 1=yes */
1298  int posix_no_trunc; /* error on names > max name, 0=no, 1=yes */
1299  int posix_prio_io; /* priority IO, 0=no, 1=yes */
1300  int posix_sync_io; /* file can be sync'ed, 0=no, 1=yes */
1301  int posix_vdisable; /* special char processing, 0=no, 1=yes */
1303 
1311 
1321  Atomic_Uint flags;
1322  off_t offset; /* current offset into file */
1324  uint32_t data0; /* private to "driver" */
1325  void *data1; /* ... */
1326 };
1327 
1334 typedef struct {
1335  rtems_libio_t *iop;
1336  off_t offset;
1337  char *buffer;
1338  uint32_t count;
1339  uint32_t flags;
1340  uint32_t bytes_moved;
1342 
1346 typedef struct {
1347  rtems_libio_t *iop;
1348  uint32_t flags;
1349  uint32_t mode;
1351 
1355 typedef struct {
1356  rtems_libio_t *iop;
1357  ioctl_command_t command;
1358  void *buffer;
1359  int ioctl_return;
1361 
1367 #define LIBIO_FLAGS_NO_DELAY 0x0001U /* return immediately if no data */
1368 #define LIBIO_FLAGS_READ 0x0002U /* reading */
1369 #define LIBIO_FLAGS_WRITE 0x0004U /* writing */
1370 #define LIBIO_FLAGS_OPEN 0x0100U /* device is open */
1371 #define LIBIO_FLAGS_APPEND 0x0200U /* all writes append */
1372 #define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800U /* close on process exec() */
1373 #define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
1374 #define LIBIO_FLAGS_REFERENCE_INC 0x1000U
1375 
1378 static inline unsigned int rtems_libio_iop_flags( const rtems_libio_t *iop )
1379 {
1380  return _Atomic_Load_uint( &iop->flags, ATOMIC_ORDER_RELAXED );
1381 }
1382 
1388 static inline bool rtems_libio_iop_is_no_delay( const rtems_libio_t *iop )
1389 {
1390  return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_NO_DELAY ) != 0;
1391 }
1392 
1398 static inline bool rtems_libio_iop_is_readable( const rtems_libio_t *iop )
1399 {
1400  return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_READ ) != 0;
1401 }
1402 
1408 static inline bool rtems_libio_iop_is_writeable( const rtems_libio_t *iop )
1409 {
1410  return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_WRITE ) != 0;
1411 }
1412 
1418 static inline bool rtems_libio_iop_is_append( const rtems_libio_t *iop )
1419 {
1420  return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_APPEND ) != 0;
1421 }
1422 
1428 typedef int (*rtems_libio_open_t)(
1429  const char *pathname,
1430  uint32_t flag,
1431  uint32_t mode
1432 );
1433 
1434 typedef int (*rtems_libio_close_t)(
1435  int fd
1436 );
1437 
1438 typedef ssize_t (*rtems_libio_read_t)(
1439  int fd,
1440  void *buffer,
1441  size_t count
1442 );
1443 
1444 typedef ssize_t (*rtems_libio_write_t)(
1445  int fd,
1446  const void *buffer,
1447  size_t count
1448 );
1449 
1450 typedef int (*rtems_libio_ioctl_t)(
1451  int fd,
1452  uint32_t command,
1453  void *buffer
1454 );
1455 
1456 typedef off_t (*rtems_libio_lseek_t)(
1457  int fd,
1458  off_t offset,
1459  int whence
1460 );
1461 
1469 /*
1470  * The following macros are used to build up the permissions sets
1471  * used to check permissions. These are similar in style to the
1472  * mode_t bits and should stay compatible with them.
1473  */
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
1487 
1491  dev_t device;
1492  struct {
1495  } __overlay;
1496 };
1497 
1498 static inline dev_t rtems_filesystem_make_dev_t(
1501 )
1502 {
1503  union __rtems_dev_t temp;
1504 
1505  temp.__overlay.major = _major;
1506  temp.__overlay.minor = _minor;
1507  return temp.device;
1508 }
1509 
1510 static inline dev_t rtems_filesystem_make_dev_t_from_pointer(
1511  const void *pointer
1512 )
1513 {
1514  uint64_t temp = (((uint64_t) 1) << 63) | (((uintptr_t) pointer) >> 1);
1515 
1516  return rtems_filesystem_make_dev_t((uint32_t) (temp >> 32), (uint32_t) temp);
1517 }
1518 
1519 static inline rtems_device_major_number rtems_filesystem_dev_major_t(
1520  dev_t device
1521 )
1522 {
1523  union __rtems_dev_t temp;
1524 
1525  temp.device = device;
1526  return temp.__overlay.major;
1527 }
1528 
1529 
1530 static inline rtems_device_minor_number rtems_filesystem_dev_minor_t(
1531  dev_t device
1532 )
1533 {
1534  union __rtems_dev_t temp;
1535 
1536  temp.device = device;
1537  return temp.__overlay.minor;
1538 }
1539 
1540 #define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \
1541  do { \
1542  (_major) = rtems_filesystem_dev_major_t ( _dev ); \
1543  (_minor) = rtems_filesystem_dev_minor_t( _dev ); \
1544  } while(0)
1545 
1546 /*
1547  * Prototypes for filesystem
1548  */
1549 
1558 void rtems_filesystem_initialize( void );
1559 
1560 void rtems_libio_post_driver(void);
1561 
1562 void rtems_libio_exit(void);
1563 
1573 extern int rtems_mkdir(const char *path, mode_t mode);
1574 
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"
1598 
1605  rtems_chain_node mt_node;
1606  void *fs_info;
1608  const void *immutable_fs_info;
1609  rtems_chain_control location_chain;
1610  rtems_filesystem_global_location_t *mt_point_node;
1612  bool mounted;
1613  bool writeable;
1614  const rtems_filesystem_limits_and_options_t *pathconf_limits_and_options;
1615 
1616  /*
1617  * The target or mount point of the file system.
1618  */
1619  const char *target;
1620 
1621  /*
1622  * The type of filesystem or the name of the filesystem.
1623  */
1624  const char *type;
1625 
1626  /*
1627  * When someone adds a mounted filesystem on a real device,
1628  * this will need to be used.
1629  *
1630  * The lower layers can manage how this is managed. Leave as a
1631  * string.
1632  */
1633  char *dev;
1634 
1642 };
1643 
1647 typedef enum {
1648  RTEMS_FILESYSTEM_READ_ONLY,
1649  RTEMS_FILESYSTEM_READ_WRITE,
1650  RTEMS_FILESYSTEM_BAD_OPTIONS
1652 
1657  const char *type;
1660 
1667 
1668 extern rtems_chain_control rtems_filesystem_mount_table;
1669 
1679  const char *type,
1681 );
1682 
1690  const char *type
1691 );
1692 
1715 int unmount(
1716  const char *mount_path
1717 );
1718 
1766 int mount(
1767  const char *source,
1768  const char *target,
1769  const char *filesystemtype,
1771  const void *data
1772 );
1773 
1786  const char *source,
1787  const char *target,
1788  const char *filesystemtype,
1790  const void *data
1791 );
1792 
1802  const rtems_filesystem_table_t *fs_entry,
1803  void *arg
1804 );
1805 
1821  void *routine_arg
1822 );
1823 
1833  const rtems_filesystem_mount_table_entry_t *mt_entry,
1834  void *arg
1835 );
1836 
1852  void *visitor_arg
1853 );
1854 
1855 typedef struct {
1856  const char *source;
1857  const char *target;
1858  const char *filesystemtype;
1860  const void *data;
1862 
1864  rtems_filesystem_root_configuration;
1865 
1877 struct rtems_termios_tty;
1878 
1879 typedef struct rtems_termios_callbacks {
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;
1889 
1890 RTEMS_INLINE_ROUTINE void rtems_termios_initialize( void )
1891 {
1892  /* Nothing to do, provided for backward compatibility */
1893 }
1894 
1895 /*
1896  * CCJ: Change before opening a tty. Newer code from Eric is coming
1897  * so extra work to handle an open tty is not worth it. If the tty
1898  * is open, close then open it again.
1899  */
1900 rtems_status_code rtems_termios_bufsize (
1901  size_t cbufsize, /* cooked buffer size */
1902  size_t raw_input, /* raw input buffer size */
1903  size_t raw_output /* raw output buffer size */
1904 );
1905 
1910 typedef enum {
1918 
1930 
1938 
1956  unsigned char c,
1957  struct rtems_termios_tty *tty
1958 );
1959 
1979  unsigned char c,
1980  struct rtems_termios_tty *tty
1981 );
1982 
1997  unsigned char c,
1998  struct rtems_termios_tty *tty
1999 );
2000 
2015 );
2016 
2017 int rtems_termios_enqueue_raw_characters(
2018  void *ttyp,
2019  const char *buf,
2020  int len
2021 );
2022 
2023 rtems_status_code rtems_termios_open (
2026  void *arg,
2027  const rtems_termios_callbacks *callbacks
2028 );
2029 
2030 rtems_status_code rtems_termios_close(
2031  void *arg
2032 );
2033 
2034 rtems_status_code rtems_termios_read(
2035  void *arg
2036 );
2037 
2038 rtems_status_code rtems_termios_write(
2039  void *arg
2040 );
2041 
2042 rtems_status_code rtems_termios_ioctl(
2043  void *arg
2044 );
2045 
2046 int rtems_termios_dequeue_characters(
2047  void *ttyp,
2048  int len
2049 );
2050 
2056 #define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
2057 
2061 #define rtems_filesystem_type(_mte) ((_mte)->type)
2062 
2066 #define rtems_filesystem_mount_point(_mte) ((_mte)->target)
2067 
2071 #define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
2072 
2073 #ifdef __cplusplus
2074 }
2075 #endif
2076 
2077 #endif /* _RTEMS_LIBIO_H */
Parameter block for open/close.
Definition: libio.h:1346
rtems_termios_iproc_status_code
The status code returned by all Termios input processing (iproc) functions and input signal (isig) ha...
Definition: libio.h:1910
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().
Definition: libio.h:1289
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:369
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.
Definition: libio.h:406
int(* rtems_filesystem_fstat_t)(const rtems_filesystem_location_info_t *loc, struct stat *buf)
Gets a node status.
Definition: libio.h:881
int(* rtems_filesystem_close_t)(rtems_libio_t *iop)
Closes a node.
Definition: libio.h:742
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
Definition: libio.h:141
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: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:77
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.
Definition: libio.h:1647
uint32_t rtems_device_major_number
This integer type represents the major number of devices.
Definition: io.h:96
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.
Definition: libio.h:157
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:386
Basic Filesystem Types.
File system table entry.
Definition: libio.h:1656
This status indicates that the input processing is done.
Definition: libio.h:1936
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.
Definition: libio.h:1388
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.
Definition: libio.h:1355
int(* rtems_filesystem_fchmod_t)(const rtems_filesystem_location_info_t *loc, mode_t mode)
Changes the mode of a node.
Definition: libio.h:192
Paramameter block for read/write.
Definition: libio.h:1334
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.
Definition: libio.h:944
int(* rtems_filesystem_poll_t)(rtems_libio_t *iop, int events)
Poll and select support.
Definition: libio.h:959
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.
Definition: libio.h:825
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.
Definition: libio.h:1005
void(* rtems_filesystem_fsunmount_me_t)(rtems_filesystem_mount_table_entry_t *mt_entry)
Destroys a file system instance.
Definition: libio.h:311
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.
Definition: libio.h:1398
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.
Definition: libio.h:277
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.
Definition: libio.h:445
off_t(* rtems_filesystem_lseek_t)(rtems_libio_t *iop, off_t offset, int whence)
Moves the read/write file offset.
Definition: libio.h:864
ssize_t(* rtems_filesystem_write_t)(rtems_libio_t *iop, const void *buffer, size_t count)
Writes to a node.
Definition: libio.h:803
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
static bool rtems_libio_iop_is_append(const rtems_libio_t *iop)
Returns true if this is an append iop, otherwise returns false.
Definition: libio.h:1418
void(* rtems_filesystem_freenode_t)(const rtems_filesystem_location_info_t *loc)
Frees the location of a node.
Definition: libio.h:241
rtems_filesystem_location_info_t currentloc
Definition: libio.h:135
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:329
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.
Definition: libio.h:1801
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).
Definition: libio.h:261
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.
Definition: libio.h:782
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.
Definition: libio.h:1929
Atomic Operations API.
rtems_filesystem_global_location_t * startloc
Definition: libio.h:147
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.
Chain API.
int(* rtems_filesystem_ioctl_t)(rtems_libio_t *iop, ioctl_command_t request, void *buffer)
IO control of a node.
Definition: libio.h:844
int(* rtems_filesystem_fsync_t)(rtems_libio_t *iop)
Synchronizes changes to a file.
Definition: libio.h:914
Mount table entry.
Definition: libio.h:1604
This header file defines the RTEMS Classic API.
File system operations table.
Definition: libio.h:472
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.
Definition: libio.h:1955
Path evaluation context.
Definition: libio.h:84
void(* rtems_filesystem_mt_entry_lock_t)(const rtems_filesystem_mount_table_entry_t *mt_entry)
Locks a file system instance.
Definition: libio.h:66
int(* rtems_filesystem_ftruncate_t)(rtems_libio_t *iop, off_t length)
Truncates a file to a specified length.
Definition: libio.h:898
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
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.
Definition: libio.h:1832
int(* rtems_filesystem_clonenode_t)(rtems_filesystem_location_info_t *loc)
Clones a location.
Definition: libio.h:230
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.
Definition: libio.h:174
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.
Definition: libio.h:464
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.
Definition: libio.h:1320
bool rtems_filesystem_mount_iterate(rtems_filesystem_mt_entry_visitor visitor, void *visitor_arg)
Iterates over all file system mount entries.
rtems_id unmount_task
Definition: libio.h:1641
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.
Definition: libio.h:975
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
Definition: basedefs.h:683
int(* rtems_filesystem_fdatasync_t)(rtems_libio_t *iop)
Synchronizes the data of a file.
Definition: libio.h:929
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:296
static bool rtems_libio_iop_is_writeable(const rtems_libio_t *iop)
Returns true if this is a writeable iop, otherwise returns false.
Definition: libio.h:1408
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:209
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.
Definition: termiostypes.h:355
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
Definition: io.h:84
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.
Definition: libio.h:760
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.
Definition: libio.h:425
int rtems_filesystem_default_fsync_or_fdatasync(rtems_libio_t *iop)
Global file system location.
Definition: fs.h:81
This status indicates that the input processing can continue.
Definition: libio.h:1917
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:725
int(* rtems_filesystem_mmap_t)(rtems_libio_t *iop, void **addr, size_t len, int prot, off_t off)
MMAP support.
Definition: libio.h:994