RTEMS CPU Kit with SuperCore  4.10.99.0
rtems/libio.h
Go to the documentation of this file.
00001 
00013 /*
00014  *  COPYRIGHT (c) 1989-2008.
00015  *  On-Line Applications Research Corporation (OAR).
00016  *
00017  *  Modifications to support reference counting in the file system are
00018  *  Copyright (c) 2012 embedded brains GmbH.
00019  *
00020  *  The license and distribution terms for this file may be
00021  *  found in the file LICENSE in this distribution or at
00022  *  http://www.rtems.com/license/LICENSE.
00023  */
00024 
00025 #ifndef _RTEMS_RTEMS_LIBIO_H
00026 #define _RTEMS_RTEMS_LIBIO_H
00027 
00028 #include <sys/types.h>
00029 #include <sys/stat.h>
00030 #include <sys/ioctl.h>
00031 #include <sys/statvfs.h>
00032 
00033 #include <unistd.h>
00034 #include <termios.h>
00035 
00036 #include <rtems.h>
00037 #include <rtems/fs.h>
00038 #include <rtems/chain.h>
00039 
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043 
00056 typedef enum {
00057   RTEMS_FILESYSTEM_DIRECTORY,
00058   RTEMS_FILESYSTEM_DEVICE,
00059   RTEMS_FILESYSTEM_HARD_LINK,
00060   RTEMS_FILESYSTEM_SYM_LINK,
00061   RTEMS_FILESYSTEM_MEMORY_FILE,
00062   RTEMS_FILESYSTEM_INVALID_NODE_TYPE
00063 } rtems_filesystem_node_types_t;
00064 
00074 typedef void (*rtems_filesystem_mt_entry_lock_t)(
00075   const rtems_filesystem_mount_table_entry_t *mt_entry
00076 );
00077 
00085 typedef void (*rtems_filesystem_mt_entry_unlock_t)(
00086   const rtems_filesystem_mount_table_entry_t *mt_entry
00087 );
00088 
00092 typedef struct {
00096   const char *path;
00097 
00101   size_t pathlen;
00102 
00107   const char *token;
00108 
00113   size_t tokenlen;
00114 
00127   int flags;
00128 
00134   int recursionlevel;
00135 
00143   rtems_filesystem_location_info_t currentloc;
00144 
00149   rtems_filesystem_global_location_t *rootloc;
00150 
00155   rtems_filesystem_global_location_t *startloc;
00156 } rtems_filesystem_eval_path_context_t;
00157 
00165 typedef void (*rtems_filesystem_eval_path_t)(
00166   rtems_filesystem_eval_path_context_t *ctx
00167 );
00168 
00182 typedef int (*rtems_filesystem_link_t)(
00183   const rtems_filesystem_location_info_t *parentloc,
00184   const rtems_filesystem_location_info_t *targetloc,
00185   const char *name,
00186   size_t namelen
00187 );
00188 
00200 typedef int (*rtems_filesystem_fchmod_t)(
00201   const rtems_filesystem_location_info_t *loc,
00202   mode_t mode
00203 );
00204 
00217 typedef int (*rtems_filesystem_chown_t)(
00218   const rtems_filesystem_location_info_t *loc,
00219   uid_t owner,
00220   gid_t group
00221 );
00222 
00238 typedef int (*rtems_filesystem_clonenode_t)(
00239   rtems_filesystem_location_info_t *loc
00240 );
00241 
00249 typedef void (*rtems_filesystem_freenode_t)(
00250   const rtems_filesystem_location_info_t *loc
00251 );
00252 
00269 typedef int (*rtems_filesystem_mount_t) (
00270   rtems_filesystem_mount_table_entry_t *mt_entry
00271 );
00272 
00285 typedef int (*rtems_filesystem_fsmount_me_t)(
00286   rtems_filesystem_mount_table_entry_t *mt_entry,
00287   const void *data
00288 );
00289 
00304 typedef int (*rtems_filesystem_unmount_t) (
00305   rtems_filesystem_mount_table_entry_t *mt_entry
00306 );
00307 
00319 typedef void (*rtems_filesystem_fsunmount_me_t)(
00320   rtems_filesystem_mount_table_entry_t *mt_entry
00321 );
00322 
00337 typedef bool (*rtems_filesystem_are_nodes_equal_t)(
00338   const rtems_filesystem_location_info_t *a,
00339   const rtems_filesystem_location_info_t *b
00340 );
00341 
00351 typedef rtems_filesystem_node_types_t (*rtems_filesystem_node_type_t)(
00352   const rtems_filesystem_location_info_t *loc
00353 );
00354 
00371 typedef int (*rtems_filesystem_mknod_t)(
00372   const rtems_filesystem_location_info_t *parentloc,
00373   const char *name,
00374   size_t namelen,
00375   mode_t mode,
00376   dev_t dev
00377 );
00378 
00390 typedef int (*rtems_filesystem_rmnod_t)(
00391   const rtems_filesystem_location_info_t *parentloc,
00392   const rtems_filesystem_location_info_t *loc
00393 );
00394 
00407 typedef int (*rtems_filesystem_utime_t)(
00408   const rtems_filesystem_location_info_t *loc,
00409   time_t actime,
00410   time_t modtime
00411 );
00412 
00427 typedef int (*rtems_filesystem_symlink_t)(
00428   const rtems_filesystem_location_info_t *parentloc,
00429   const char *name,
00430   size_t namelen,
00431   const char *target
00432 );
00433 
00446 typedef ssize_t (*rtems_filesystem_readlink_t)(
00447   const rtems_filesystem_location_info_t *loc,
00448   char *buf,
00449   size_t bufsize
00450 );
00451 
00466 typedef int (*rtems_filesystem_rename_t)(
00467   const rtems_filesystem_location_info_t *oldparentloc,
00468   const rtems_filesystem_location_info_t *oldloc,
00469   const rtems_filesystem_location_info_t *newparentloc,
00470   const char *name,
00471   size_t namelen
00472 );
00473 
00485 typedef int (*rtems_filesystem_statvfs_t)(
00486   const rtems_filesystem_location_info_t *loc,
00487   struct statvfs *buf
00488 );
00489 
00493 struct _rtems_filesystem_operations_table {
00494   rtems_filesystem_mt_entry_lock_t lock_h;
00495   rtems_filesystem_mt_entry_unlock_t unlock_h;
00496   rtems_filesystem_eval_path_t eval_path_h;
00497   rtems_filesystem_link_t link_h;
00498   rtems_filesystem_are_nodes_equal_t are_nodes_equal_h;
00499   rtems_filesystem_node_type_t node_type_h;
00500   rtems_filesystem_mknod_t mknod_h;
00501   rtems_filesystem_rmnod_t rmnod_h;
00502   rtems_filesystem_fchmod_t fchmod_h;
00503   rtems_filesystem_chown_t chown_h;
00504   rtems_filesystem_clonenode_t clonenod_h;
00505   rtems_filesystem_freenode_t freenod_h;
00506   rtems_filesystem_mount_t mount_h;
00507   rtems_filesystem_fsmount_me_t fsmount_me_h;
00508   rtems_filesystem_unmount_t unmount_h;
00509   rtems_filesystem_fsunmount_me_t fsunmount_me_h;
00510   rtems_filesystem_utime_t utime_h;
00511   rtems_filesystem_symlink_t symlink_h;
00512   rtems_filesystem_readlink_t readlink_h;
00513   rtems_filesystem_rename_t rename_h;
00514   rtems_filesystem_statvfs_t statvfs_h;
00515 };
00516 
00520 extern const rtems_filesystem_operations_table
00521   rtems_filesystem_operations_default;
00522 
00528 void rtems_filesystem_default_lock(
00529   const rtems_filesystem_mount_table_entry_t *mt_entry
00530 );
00531 
00537 void rtems_filesystem_default_unlock(
00538   const rtems_filesystem_mount_table_entry_t *mt_entry
00539 );
00540 
00547 void rtems_filesystem_default_eval_path(
00548   rtems_filesystem_eval_path_context_t *ctx
00549 );
00550 
00556 int rtems_filesystem_default_link(
00557   const rtems_filesystem_location_info_t *parentloc,
00558   const rtems_filesystem_location_info_t *targetloc,
00559   const char *name,
00560   size_t namelen
00561 );
00562 
00575 bool rtems_filesystem_default_are_nodes_equal(
00576   const rtems_filesystem_location_info_t *a,
00577   const rtems_filesystem_location_info_t *b
00578 );
00579 
00585 rtems_filesystem_node_types_t rtems_filesystem_default_node_type(
00586   const rtems_filesystem_location_info_t *pathloc
00587 );
00588 
00594 int rtems_filesystem_default_mknod(
00595   const rtems_filesystem_location_info_t *parentloc,
00596   const char *name,
00597   size_t namelen,
00598   mode_t mode,
00599   dev_t dev
00600 );
00601 
00607 int rtems_filesystem_default_rmnod(
00608   const rtems_filesystem_location_info_t *parentloc,
00609   const rtems_filesystem_location_info_t *loc
00610 );
00611 
00617 int rtems_filesystem_default_fchmod(
00618   const rtems_filesystem_location_info_t *loc,
00619   mode_t mode
00620 );
00621 
00627 int rtems_filesystem_default_chown(
00628   const rtems_filesystem_location_info_t *loc,
00629   uid_t owner,
00630   gid_t group
00631 );
00632 
00638 int rtems_filesystem_default_clonenode(
00639   rtems_filesystem_location_info_t *loc
00640 );
00641 
00645 void rtems_filesystem_default_freenode(
00646   const rtems_filesystem_location_info_t *loc
00647 );
00648 
00654 int rtems_filesystem_default_mount (
00655    rtems_filesystem_mount_table_entry_t *mt_entry     /* IN */
00656 );
00657 
00663 int rtems_filesystem_default_fsmount(
00664   rtems_filesystem_mount_table_entry_t *mt_entry,     /* IN */
00665   const void                           *data          /* IN */
00666 );
00667 
00673 int rtems_filesystem_default_unmount(
00674   rtems_filesystem_mount_table_entry_t *mt_entry     /* IN */
00675 );
00676 
00682 void rtems_filesystem_default_fsunmount(
00683    rtems_filesystem_mount_table_entry_t *mt_entry    /* IN */
00684 );
00685 
00691 int rtems_filesystem_default_utime(
00692   const rtems_filesystem_location_info_t *loc,
00693   time_t actime,
00694   time_t modtime
00695 );
00696 
00702 int rtems_filesystem_default_symlink(
00703   const rtems_filesystem_location_info_t *parentloc,
00704   const char *name,
00705   size_t namelen,
00706   const char *target
00707 );
00708 
00714 ssize_t rtems_filesystem_default_readlink(
00715   const rtems_filesystem_location_info_t *loc,
00716   char *buf,
00717   size_t bufsize
00718 );
00719 
00725 int rtems_filesystem_default_rename(
00726   const rtems_filesystem_location_info_t *oldparentloc,
00727   const rtems_filesystem_location_info_t *oldloc,
00728   const rtems_filesystem_location_info_t *newparentloc,
00729   const char *name,
00730   size_t namelen
00731 );
00732 
00738 int rtems_filesystem_default_statvfs(
00739   const rtems_filesystem_location_info_t *loc,
00740   struct statvfs *buf
00741 );
00742 
00767 typedef int (*rtems_filesystem_open_t)(
00768   rtems_libio_t *iop,
00769   const char    *path,
00770   int            oflag,
00771   mode_t         mode
00772 );
00773 
00784 typedef int (*rtems_filesystem_close_t)(
00785   rtems_libio_t *iop
00786 );
00787 
00802 typedef ssize_t (*rtems_filesystem_read_t)(
00803   rtems_libio_t *iop,
00804   void          *buffer,
00805   size_t         count
00806 );
00807 
00822 typedef ssize_t (*rtems_filesystem_write_t)(
00823   rtems_libio_t *iop,
00824   const void    *buffer,
00825   size_t         count
00826 );
00827 
00840 typedef int (*rtems_filesystem_ioctl_t)(
00841   rtems_libio_t   *iop,
00842   ioctl_command_t  request,
00843   void            *buffer
00844 );
00845 
00860 typedef off_t (*rtems_filesystem_lseek_t)(
00861   rtems_libio_t *iop,
00862   off_t          offset,
00863   int            whence
00864 );
00865 
00877 typedef int (*rtems_filesystem_fstat_t)(
00878   const rtems_filesystem_location_info_t *loc,
00879   struct stat *buf
00880 );
00881 
00894 typedef int (*rtems_filesystem_ftruncate_t)(
00895   rtems_libio_t *iop,
00896   off_t length
00897 );
00898 
00910 typedef int (*rtems_filesystem_fsync_t)(
00911   rtems_libio_t *iop
00912 );
00913 
00925 typedef int (*rtems_filesystem_fdatasync_t)(
00926   rtems_libio_t *iop
00927 );
00928 
00940 typedef int (*rtems_filesystem_fcntl_t)(
00941   rtems_libio_t *iop,
00942   int cmd
00943 );
00944 
00948 struct _rtems_filesystem_file_handlers_r {
00949   rtems_filesystem_open_t open_h;
00950   rtems_filesystem_close_t close_h;
00951   rtems_filesystem_read_t read_h;
00952   rtems_filesystem_write_t write_h;
00953   rtems_filesystem_ioctl_t ioctl_h;
00954   rtems_filesystem_lseek_t lseek_h;
00955   rtems_filesystem_fstat_t fstat_h;
00956   rtems_filesystem_ftruncate_t ftruncate_h;
00957   rtems_filesystem_fsync_t fsync_h;
00958   rtems_filesystem_fdatasync_t fdatasync_h;
00959   rtems_filesystem_fcntl_t fcntl_h;
00960 };
00961 
00965 extern const rtems_filesystem_file_handlers_r
00966   rtems_filesystem_handlers_default;
00967 
00973 int rtems_filesystem_default_open(
00974   rtems_libio_t *iop,
00975   const char    *path,
00976   int            oflag,
00977   mode_t         mode
00978 );
00979 
00985 int rtems_filesystem_default_close(
00986   rtems_libio_t *iop
00987 );
00988 
00994 ssize_t rtems_filesystem_default_read(
00995   rtems_libio_t *iop,
00996   void          *buffer,
00997   size_t         count
00998 );
00999 
01005 ssize_t rtems_filesystem_default_write(
01006   rtems_libio_t *iop,
01007   const void    *buffer,
01008   size_t         count
01009 );
01010 
01016 int rtems_filesystem_default_ioctl(
01017   rtems_libio_t   *iop,
01018   ioctl_command_t  request,
01019   void            *buffer
01020 );
01021 
01027 off_t rtems_filesystem_default_lseek(
01028   rtems_libio_t *iop,
01029   off_t          offset,
01030   int            whence
01031 );
01032 
01044 off_t rtems_filesystem_default_lseek_directory(
01045   rtems_libio_t *iop,
01046   off_t offset,
01047   int whence
01048 );
01049 
01067 off_t rtems_filesystem_default_lseek_file(
01068   rtems_libio_t *iop,
01069   off_t offset,
01070   int whence
01071 );
01072 
01080 int rtems_filesystem_default_fstat(
01081   const rtems_filesystem_location_info_t *loc,
01082   struct stat *buf
01083 );
01084 
01090 int rtems_filesystem_default_ftruncate(
01091   rtems_libio_t *iop,
01092   off_t length
01093 );
01094 
01100 int rtems_filesystem_default_ftruncate_directory(
01101   rtems_libio_t *iop,
01102   off_t length
01103 );
01104 
01110 int rtems_filesystem_default_fsync_or_fdatasync(
01111   rtems_libio_t *iop
01112 );
01113 
01119 int rtems_filesystem_default_fsync_or_fdatasync_success(
01120   rtems_libio_t *iop
01121 );
01122 
01128 int rtems_filesystem_default_fcntl(
01129   rtems_libio_t *iop,
01130   int cmd
01131 );
01132 
01147 typedef off_t rtems_off64_t __attribute__((deprecated));
01148 
01155 rtems_filesystem_fsmount_me_t
01156 rtems_filesystem_get_mount_handler(
01157   const char *type
01158 );
01159 
01164 typedef struct {
01165   int    link_max;                 /* count */
01166   int    max_canon;                /* max formatted input line size */
01167   int    max_input;                /* max input line size */
01168   int    name_max;                 /* max name length */
01169   int    path_max;                 /* max path */
01170   int    pipe_buf;                 /* pipe buffer size */
01171   int    posix_async_io;           /* async IO supported on fs, 0=no, 1=yes */
01172   int    posix_chown_restrictions; /* can chown: 0=no, 1=yes */
01173   int    posix_no_trunc;           /* error on names > max name, 0=no, 1=yes */
01174   int    posix_prio_io;            /* priority IO, 0=no, 1=yes */
01175   int    posix_sync_io;            /* file can be sync'ed, 0=no, 1=yes */
01176   int    posix_vdisable;           /* special char processing, 0=no, 1=yes */
01177 } rtems_filesystem_limits_and_options_t;
01178 
01184 extern const rtems_filesystem_limits_and_options_t
01185   rtems_filesystem_default_pathconf;
01186 
01195 struct rtems_libio_tt {
01196   rtems_driver_name_t                    *driver;
01197   off_t                                   offset;    /* current offset into file */
01198   uint32_t                                flags;
01199   rtems_filesystem_location_info_t        pathinfo;
01200   uint32_t                                data0;     /* private to "driver" */
01201   void                                   *data1;     /* ... */
01202 };
01203 
01210 typedef struct {
01211   rtems_libio_t          *iop;
01212   off_t                   offset;
01213   char                   *buffer;
01214   uint32_t                count;
01215   uint32_t                flags;
01216   uint32_t                bytes_moved;
01217 } rtems_libio_rw_args_t;
01218 
01222 typedef struct {
01223   rtems_libio_t          *iop;
01224   uint32_t                flags;
01225   uint32_t                mode;
01226 } rtems_libio_open_close_args_t;
01227 
01231 typedef struct {
01232   rtems_libio_t          *iop;
01233   ioctl_command_t         command;
01234   void                   *buffer;
01235   int                     ioctl_return;
01236 } rtems_libio_ioctl_args_t;
01237 
01243 #define LIBIO_FLAGS_NO_DELAY      0x0001U  /* return immediately if no data */
01244 #define LIBIO_FLAGS_READ          0x0002U  /* reading */
01245 #define LIBIO_FLAGS_WRITE         0x0004U  /* writing */
01246 #define LIBIO_FLAGS_OPEN          0x0100U  /* device is open */
01247 #define LIBIO_FLAGS_APPEND        0x0200U  /* all writes append */
01248 #define LIBIO_FLAGS_CREATE        0x0400U  /* create file */
01249 #define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800U  /* close on process exec() */
01250 #define LIBIO_FLAGS_READ_WRITE    (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
01251 
01259 void rtems_libio_init(void);
01260 
01266 typedef int (*rtems_libio_open_t)(
01267   const char  *pathname,
01268   uint32_t    flag,
01269   uint32_t    mode
01270 );
01271 
01272 typedef int (*rtems_libio_close_t)(
01273   int  fd
01274 );
01275 
01276 typedef ssize_t (*rtems_libio_read_t)(
01277   int         fd,
01278   void       *buffer,
01279   size_t    count
01280 );
01281 
01282 typedef ssize_t (*rtems_libio_write_t)(
01283   int         fd,
01284   const void *buffer,
01285   size_t      count
01286 );
01287 
01288 typedef int (*rtems_libio_ioctl_t)(
01289   int         fd,
01290   uint32_t    command,
01291   void       *buffer
01292 );
01293 
01294 typedef off_t (*rtems_libio_lseek_t)(
01295   int           fd,
01296   off_t         offset,
01297   int           whence
01298 );
01299 
01307 /*
01308  *  The following macros are used to build up the permissions sets
01309  *  used to check permissions.  These are similar in style to the
01310  *  mode_t bits and should stay compatible with them.
01311  */
01312 #define RTEMS_FS_PERMS_READ 0x4
01313 #define RTEMS_FS_PERMS_WRITE 0x2
01314 #define RTEMS_FS_PERMS_EXEC 0x1
01315 #define RTEMS_FS_PERMS_RWX \
01316   (RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE | RTEMS_FS_PERMS_EXEC)
01317 #define RTEMS_FS_FOLLOW_HARD_LINK 0x8
01318 #define RTEMS_FS_FOLLOW_SYM_LINK 0x10
01319 #define RTEMS_FS_FOLLOW_LINK \
01320   (RTEMS_FS_FOLLOW_HARD_LINK | RTEMS_FS_FOLLOW_SYM_LINK)
01321 #define RTEMS_FS_MAKE 0x20
01322 #define RTEMS_FS_EXCLUSIVE 0x40
01323 #define RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS 0x80
01324 #define RTEMS_FS_REJECT_TERMINAL_DOT 0x100
01325 
01328 union __rtems_dev_t {
01329   dev_t device;
01330   struct {
01331      rtems_device_major_number major;
01332      rtems_device_minor_number minor;
01333   } __overlay;
01334 };
01335 
01336 static inline dev_t rtems_filesystem_make_dev_t(
01337   rtems_device_major_number _major,
01338   rtems_device_minor_number _minor
01339 )
01340 {
01341   union __rtems_dev_t temp;
01342 
01343   temp.__overlay.major = _major;
01344   temp.__overlay.minor = _minor;
01345   return temp.device;
01346 }
01347 
01348 static inline rtems_device_major_number rtems_filesystem_dev_major_t(
01349   dev_t device
01350 )
01351 {
01352   union __rtems_dev_t temp;
01353 
01354   temp.device = device;
01355   return temp.__overlay.major;
01356 }
01357 
01358 
01359 static inline rtems_device_minor_number rtems_filesystem_dev_minor_t(
01360   dev_t device
01361 )
01362 {
01363   union __rtems_dev_t temp;
01364 
01365   temp.device = device;
01366   return temp.__overlay.minor;
01367 }
01368 
01369 #define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \
01370   do { \
01371     (_major) = rtems_filesystem_dev_major_t ( _dev ); \
01372     (_minor) = rtems_filesystem_dev_minor_t( _dev ); \
01373   } while(0)
01374 
01375 /*
01376  *  Prototypes for filesystem
01377  */
01378 
01387 void rtems_filesystem_initialize( void );
01388 
01389 typedef void (*rtems_libio_helper)(void);
01390 
01391 extern const rtems_libio_helper rtems_libio_init_helper;
01392 
01393 extern const rtems_libio_helper rtems_libio_post_driver_helper;
01394 
01395 extern const rtems_libio_helper rtems_libio_exit_helper;
01396 
01397 extern const rtems_libio_helper rtems_fs_init_helper;
01398 
01399 void rtems_libio_helper_null(void);
01400 
01401 void rtems_libio_post_driver(void);
01402 
01403 void rtems_libio_exit(void);
01404 
01414 extern int rtems_mkdir(const char *path, mode_t mode);
01415 
01432 #define RTEMS_FILESYSTEM_TYPE_IMFS "imfs"
01433 #define RTEMS_FILESYSTEM_TYPE_MINIIMFS "mimfs"
01434 #define RTEMS_FILESYSTEM_TYPE_DEVFS "devfs"
01435 #define RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs"
01436 #define RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs"
01437 #define RTEMS_FILESYSTEM_TYPE_NFS "nfs"
01438 #define RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs"
01439 #define RTEMS_FILESYSTEM_TYPE_RFS "rfs"
01440 
01446 struct rtems_filesystem_mount_table_entry_tt {
01447   rtems_chain_node                       mt_node;
01448   void                                  *fs_info;
01449   const rtems_filesystem_operations_table *ops;
01450   const void                            *immutable_fs_info;
01451   rtems_chain_control                    location_chain;
01452   rtems_filesystem_global_location_t    *mt_point_node;
01453   rtems_filesystem_global_location_t    *mt_fs_root;
01454   bool                                   mounted;
01455   bool                                   writeable;
01456   const rtems_filesystem_limits_and_options_t *pathconf_limits_and_options;
01457 
01458   /*
01459    * The target or mount point of the file system.
01460    */
01461   const char                            *target;
01462 
01463   /*
01464    * The type of filesystem or the name of the filesystem.
01465    */
01466   const char                            *type;
01467 
01468   /*
01469    *  When someone adds a mounted filesystem on a real device,
01470    *  this will need to be used.
01471    *
01472    *  The lower layers can manage how this is managed. Leave as a
01473    *  string.
01474    */
01475   char                                  *dev;
01476 
01483   rtems_id                               unmount_task;
01484 };
01485 
01489 typedef enum {
01490   RTEMS_FILESYSTEM_READ_ONLY,
01491   RTEMS_FILESYSTEM_READ_WRITE,
01492   RTEMS_FILESYSTEM_BAD_OPTIONS
01493 } rtems_filesystem_options_t;
01494 
01498 typedef struct rtems_filesystem_table_t {
01499   const char                    *type;
01500   rtems_filesystem_fsmount_me_t  mount_h;
01501 } rtems_filesystem_table_t;
01502 
01508 extern const rtems_filesystem_table_t rtems_filesystem_table [];
01509 
01510 extern rtems_chain_control rtems_filesystem_mount_table;
01511 
01520 int rtems_filesystem_register(
01521   const char                    *type,
01522   rtems_filesystem_fsmount_me_t  mount_h
01523 );
01524 
01531 int rtems_filesystem_unregister(
01532   const char *type
01533 );
01534 
01555 int unmount(
01556   const char *mount_path
01557 );
01558 
01593 int mount(
01594   const char                 *source,
01595   const char                 *target,
01596   const char                 *filesystemtype,
01597   rtems_filesystem_options_t options,
01598   const void                 *data
01599 );
01600 
01612 int mount_and_make_target_path(
01613   const char                 *source,
01614   const char                 *target,
01615   const char                 *filesystemtype,
01616   rtems_filesystem_options_t options,
01617   const void                 *data
01618 );
01619 
01628 typedef bool (*rtems_per_filesystem_routine)(
01629   const rtems_filesystem_table_t *fs_entry,
01630   void *arg
01631 );
01632 
01646 bool rtems_filesystem_iterate(
01647   rtems_per_filesystem_routine routine,
01648   void *routine_arg
01649 );
01650 
01659 typedef bool (*rtems_filesystem_mt_entry_visitor)(
01660   const rtems_filesystem_mount_table_entry_t *mt_entry,
01661   void *arg
01662 );
01663 
01677 bool rtems_filesystem_mount_iterate(
01678   rtems_filesystem_mt_entry_visitor visitor,
01679   void *visitor_arg
01680 );
01681 
01682 typedef struct {
01683   const char *source;
01684   const char *target;
01685   const char *filesystemtype;
01686   rtems_filesystem_options_t options;
01687   const void *data;
01688 } rtems_filesystem_mount_configuration;
01689 
01690 extern const rtems_filesystem_mount_configuration
01691   rtems_filesystem_root_configuration;
01692 
01704 typedef struct rtems_termios_callbacks {
01705   int    (*firstOpen)(int major, int minor, void *arg);
01706   int    (*lastClose)(int major, int minor, void *arg);
01707   int    (*pollRead)(int minor);
01708   ssize_t (*write)(int minor, const char *buf, size_t len);
01709   int    (*setAttributes)(int minor, const struct termios *t);
01710   int    (*stopRemoteTx)(int minor);
01711   int    (*startRemoteTx)(int minor);
01712   int    outputUsesInterrupts;
01713 } rtems_termios_callbacks;
01714 
01715 void rtems_termios_initialize (void);
01716 
01717 /*
01718  * CCJ: Change before opening a tty. Newer code from Eric is coming
01719  * so extra work to handle an open tty is not worth it. If the tty
01720  * is open, close then open it again.
01721  */
01722 rtems_status_code rtems_termios_bufsize (
01723   size_t cbufsize,     /* cooked buffer size */
01724   size_t raw_input,    /* raw input buffer size */
01725   size_t raw_output    /* raw output buffer size */
01726 );
01727 
01728 rtems_status_code rtems_termios_open (
01729   rtems_device_major_number      major,
01730   rtems_device_minor_number      minor,
01731   void                          *arg,
01732   const rtems_termios_callbacks *callbacks
01733 );
01734 
01735 rtems_status_code rtems_termios_close(
01736   void *arg
01737 );
01738 
01739 rtems_status_code rtems_termios_read(
01740   void *arg
01741 );
01742 
01743 rtems_status_code rtems_termios_write(
01744   void *arg
01745 );
01746 
01747 rtems_status_code rtems_termios_ioctl(
01748   void *arg
01749 );
01750 
01751 int rtems_termios_enqueue_raw_characters(
01752   void *ttyp,
01753   const char *buf,
01754   int   len
01755 );
01756 
01757 int rtems_termios_dequeue_characters(
01758   void *ttyp,
01759   int   len
01760 );
01761 
01767 #define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
01768 
01772 #define rtems_filesystem_type(_mte) ((_mte)->type)
01773 
01777 #define rtems_filesystem_mount_point(_mte) ((_mte)->target)
01778 
01782 #define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
01783 
01784 #ifdef __cplusplus
01785 }
01786 #endif
01787 
01788 #endif /* _RTEMS_LIBIO_H */