RTEMS  5.0.0
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  off_t offset; /* current offset into file */
1322  Atomic_Uint flags;
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 {
1493  rtems_device_major_number major;
1494  rtems_device_minor_number minor;
1495  } __overlay;
1496 };
1497 
1498 static inline dev_t rtems_filesystem_make_dev_t(
1499  rtems_device_major_number _major,
1500  rtems_device_minor_number _minor
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_MINIIMFS "mimfs"
1593 #define RTEMS_FILESYSTEM_TYPE_DEVFS "devfs"
1594 #define RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs"
1595 #define RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs"
1596 #define RTEMS_FILESYSTEM_TYPE_NFS "nfs"
1597 #define RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs"
1598 #define RTEMS_FILESYSTEM_TYPE_RFS "rfs"
1599 #define RTEMS_FILESYSTEM_TYPE_JFFS2 "jffs2"
1600 
1607  rtems_chain_node mt_node;
1608  void *fs_info;
1610  const void *immutable_fs_info;
1611  rtems_chain_control location_chain;
1612  rtems_filesystem_global_location_t *mt_point_node;
1614  bool mounted;
1615  bool writeable;
1616  const rtems_filesystem_limits_and_options_t *pathconf_limits_and_options;
1617 
1618  /*
1619  * The target or mount point of the file system.
1620  */
1621  const char *target;
1622 
1623  /*
1624  * The type of filesystem or the name of the filesystem.
1625  */
1626  const char *type;
1627 
1628  /*
1629  * When someone adds a mounted filesystem on a real device,
1630  * this will need to be used.
1631  *
1632  * The lower layers can manage how this is managed. Leave as a
1633  * string.
1634  */
1635  char *dev;
1636 
1644 };
1645 
1649 typedef enum {
1650  RTEMS_FILESYSTEM_READ_ONLY,
1651  RTEMS_FILESYSTEM_READ_WRITE,
1652  RTEMS_FILESYSTEM_BAD_OPTIONS
1654 
1659  const char *type;
1662 
1669 
1670 extern rtems_chain_control rtems_filesystem_mount_table;
1671 
1681  const char *type,
1683 );
1684 
1692  const char *type
1693 );
1694 
1717 int unmount(
1718  const char *mount_path
1719 );
1720 
1772 int mount(
1773  const char *source,
1774  const char *target,
1775  const char *filesystemtype,
1776  rtems_filesystem_options_t options,
1777  const void *data
1778 );
1779 
1792  const char *source,
1793  const char *target,
1794  const char *filesystemtype,
1795  rtems_filesystem_options_t options,
1796  const void *data
1797 );
1798 
1808  const rtems_filesystem_table_t *fs_entry,
1809  void *arg
1810 );
1811 
1827  void *routine_arg
1828 );
1829 
1839  const rtems_filesystem_mount_table_entry_t *mt_entry,
1840  void *arg
1841 );
1842 
1858  void *visitor_arg
1859 );
1860 
1861 typedef struct {
1862  const char *source;
1863  const char *target;
1864  const char *filesystemtype;
1865  rtems_filesystem_options_t options;
1866  const void *data;
1868 
1870  rtems_filesystem_root_configuration;
1871 
1883 typedef struct rtems_termios_callbacks {
1884  int (*firstOpen)(int major, int minor, void *arg);
1885  int (*lastClose)(int major, int minor, void *arg);
1886  int (*pollRead)(int minor);
1887  ssize_t (*write)(int minor, const char *buf, size_t len);
1888  int (*setAttributes)(int minor, const struct termios *t);
1889  int (*stopRemoteTx)(int minor);
1890  int (*startRemoteTx)(int minor);
1891  int outputUsesInterrupts;
1893 
1894 RTEMS_INLINE_ROUTINE void rtems_termios_initialize( void )
1895 {
1896  /* Nothing to do, provided for backward compatibility */
1897 }
1898 
1899 /*
1900  * CCJ: Change before opening a tty. Newer code from Eric is coming
1901  * so extra work to handle an open tty is not worth it. If the tty
1902  * is open, close then open it again.
1903  */
1904 rtems_status_code rtems_termios_bufsize (
1905  size_t cbufsize, /* cooked buffer size */
1906  size_t raw_input, /* raw input buffer size */
1907  size_t raw_output /* raw output buffer size */
1908 );
1909 
1910 rtems_status_code rtems_termios_open (
1911  rtems_device_major_number major,
1912  rtems_device_minor_number minor,
1913  void *arg,
1914  const rtems_termios_callbacks *callbacks
1915 );
1916 
1917 rtems_status_code rtems_termios_close(
1918  void *arg
1919 );
1920 
1921 rtems_status_code rtems_termios_read(
1922  void *arg
1923 );
1924 
1925 rtems_status_code rtems_termios_write(
1926  void *arg
1927 );
1928 
1929 rtems_status_code rtems_termios_ioctl(
1930  void *arg
1931 );
1932 
1933 int rtems_termios_enqueue_raw_characters(
1934  void *ttyp,
1935  const char *buf,
1936  int len
1937 );
1938 
1939 int rtems_termios_dequeue_characters(
1940  void *ttyp,
1941  int len
1942 );
1943 
1949 #define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
1950 
1954 #define rtems_filesystem_type(_mte) ((_mte)->type)
1955 
1959 #define rtems_filesystem_mount_point(_mte) ((_mte)->target)
1960 
1964 #define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
1965 
1966 #ifdef __cplusplus
1967 }
1968 #endif
1969 
1970 #endif /* _RTEMS_LIBIO_H */
Parameter block for open/close.
Definition: libio.h:1346
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
Definition: chain.h:65
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.
Definition: mount-mgr.c:39
const char * token
Definition: libio.h:99
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: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.
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
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
int flags
Definition: libio.h:119
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
Definition: iterateoverthreads.c:23
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
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:1649
void(* rtems_filesystem_eval_path_t)(rtems_filesystem_eval_path_context_t *ctx)
Path evaluation.
Definition: libio.h:157
Definition: libio.h:1490
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
Definition: chain.h:83
File system table entry.
Definition: libio.h:1658
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
Atomic Operations API.
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:1355
ssize_t write(int fd, const void *buffer, size_t count)
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: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)
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: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.
Definition: mount-mgr.c:107
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:23
Definition: jffs2.h:95
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.
size_t tokenlen
Definition: libio.h:105
Definition: rtemscompat1.h:15
int rtems_filesystem_default_kqfilter(rtems_libio_t *iop, struct knote *kn)
Default kernel event filter handler.
Definition: default_kqfilter.c:29
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.
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: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.
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: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
Definition: libio.h:1883
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
Classic API Status.
Definition: status.h:43
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.
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:1807
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:261
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:782
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
Definition: libio.h:147
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:90
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
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:1606
File system operations table.
Definition: libio.h:472
int rtems_filesystem_default_ftruncate_directory(rtems_libio_t *iop, off_t length)
Definition: default_ftruncate_directory.c:29
Definition: libio.h:1861
int rtems_filesystem_default_mount(rtems_filesystem_mount_table_entry_t *mt_entry)
Definition: default_mount.c:21
Basic Filesystem Types.
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
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:1838
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.
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:174
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:464
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:1320
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
Definition: libio.h:1643
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
Definition: libio.h:88
Definition: statvfs.h:35
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
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
Definition: libio.h:93
int(* rtems_filesystem_kqfilter_t)(rtems_libio_t *iop, struct knote *kn)
Kernel event filter support.
Definition: libio.h:975
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
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)
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
Definition: libio.h:126
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.
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:425
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: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