source: rtems/cpukit/libcsupport/include/rtems/libio.h @ 18aa7150

4.115
Last change on this file since 18aa7150 was b799e4eb, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/06/11 at 11:50:21

2011-11-06 Ralf Corsépius <ralf.corsepius@…>

PR1945/cpukit

  • libcsupport/include/rtems/libio.h: Mark rtems_off64_t as deprecated. Replace rtems_off64_t with off_t.
  • Property mode set to 100644
File size: 46.2 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup LibIO
5 *
6 * @brief Basic IO API.
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2008.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 *
17 *  $Id$
18 */
19
20#ifndef _RTEMS_RTEMS_LIBIO_H
21#define _RTEMS_RTEMS_LIBIO_H
22
23#include <sys/types.h>
24#include <sys/stat.h>
25#include <sys/ioctl.h>
26#include <sys/statvfs.h>
27
28#include <unistd.h>
29#include <termios.h>
30
31#include <rtems.h>
32#include <rtems/fs.h>
33#include <rtems/chain.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/**
40 * @defgroup LibIO IO Library
41 *
42 * @brief Provides system call and file system interface definitions.
43 *
44 * General purpose communication channel for RTEMS to allow UNIX/POSIX
45 * system call behavior under RTEMS.  Initially this supported only
46 * IO to devices but has since been enhanced to support networking
47 * and support for mounted file systems.
48 *
49 * @{
50 */
51
52typedef off_t rtems_off64_t __attribute__((deprecated));
53
54/**
55 * @brief File system node types.
56 */
57typedef enum {
58  RTEMS_FILESYSTEM_INVALID_NODE_TYPE,
59  RTEMS_FILESYSTEM_DIRECTORY,
60  RTEMS_FILESYSTEM_DEVICE,
61  RTEMS_FILESYSTEM_HARD_LINK,
62  RTEMS_FILESYSTEM_SYM_LINK,
63  RTEMS_FILESYSTEM_MEMORY_FILE
64} rtems_filesystem_node_types_t;
65
66/**
67 * @name File System Node Operations
68 *
69 * @{
70 */
71
72/**
73 *  This type defines the interface to the open(2) system call
74 *  support which is provided by a file system implementation.
75 */
76typedef int (*rtems_filesystem_open_t)(
77  rtems_libio_t *iop,
78  const char    *pathname,
79  uint32_t       flag,
80  uint32_t       mode
81);
82
83/**
84 *  This type defines the interface to the close(2) system call
85 *  support which is provided by a file system implementation.
86 */
87typedef int (*rtems_filesystem_close_t)(
88  rtems_libio_t *iop
89);
90
91/**
92 *  This type defines the interface to the read(2) system call
93 *  support which is provided by a file system implementation.
94 */
95typedef ssize_t (*rtems_filesystem_read_t)(
96  rtems_libio_t *iop,
97  void          *buffer,
98  size_t         count
99);
100
101/**
102 *  This type defines the interface to the write(2) system call
103 *  support which is provided by a file system implementation.
104 */
105typedef ssize_t (*rtems_filesystem_write_t)(
106  rtems_libio_t *iop,
107  const void    *buffer,
108  size_t         count
109);
110
111/**
112 *  This type defines the interface to the ioctl(2) system call
113 *  support which is provided by a file system implementation.
114 */
115typedef int (*rtems_filesystem_ioctl_t)(
116  rtems_libio_t *iop,
117  uint32_t       command,
118  void          *buffer
119);
120
121/**
122 *  This type defines the interface to the lseek(2) system call
123 *  support which is provided by a file system implementation.
124 */
125typedef off_t (*rtems_filesystem_lseek_t)(
126  rtems_libio_t *iop,
127  off_t          length,
128  int            whence
129);
130
131/**
132 *  This type defines the interface to the fstat(2) system call
133 *  support which is provided by a file system implementation.
134 */
135typedef int (*rtems_filesystem_fstat_t)(
136  rtems_filesystem_location_info_t *loc,
137  struct stat                      *buf
138);
139
140/**
141 *  This type defines the interface to the fchmod(2) system call
142 *  support which is provided by a file system implementation.
143 */
144typedef int (*rtems_filesystem_fchmod_t)(
145  rtems_filesystem_location_info_t *loc,
146  mode_t                            mode
147);
148
149/**
150 *  This type defines the interface to the ftruncate(2) system call
151 *  support which is provided by a file system implementation.
152 */
153typedef int (*rtems_filesystem_ftruncate_t)(
154  rtems_libio_t *iop,
155  off_t          length
156);
157
158/**
159 *  This type defines the interface to the fpathconf(2) system call
160 *  support which is provided by a file system implementation.
161 */
162typedef int (*rtems_filesystem_fpathconf_t)(
163  rtems_libio_t *iop,
164  int name
165);
166
167/**
168 *  This type defines the interface to the fsync(2) system call
169 *  support which is provided by a file system implementation.
170 */
171typedef int (*rtems_filesystem_fsync_t)(
172  rtems_libio_t *iop
173);
174
175/**
176 *  This type defines the interface to the fdatasync(2) system call
177 *  support which is provided by a file system implementation.
178 */
179typedef int (*rtems_filesystem_fdatasync_t)(
180  rtems_libio_t *iop
181);
182
183/**
184 *  This type defines the interface to the fnctl(2) system call
185 *  support which is provided by a file system implementation.
186 */
187typedef int (*rtems_filesystem_fcntl_t)(
188  int            cmd,
189  rtems_libio_t *iop
190);
191
192typedef int (*rtems_filesystem_rmnod_t)(
193 rtems_filesystem_location_info_t      *parent_loc,   /* IN */
194 rtems_filesystem_location_info_t      *pathloc       /* IN */
195);
196
197/** @} */
198
199/**
200 * @brief File system node operations table.
201 */
202struct _rtems_filesystem_file_handlers_r {
203  /**
204   *  This field points to the file system specific implementation
205   *  of the support routine for the open(2) system call
206   *
207   *  @note This method must have a filesystem specific implementation.
208   *
209   *  @note There is no default implementation.
210   */
211  rtems_filesystem_open_t         open_h;
212
213  /**
214   *  This field points to the file system specific implementation
215   *  of the support routine for the close(2) system call
216   *
217   *  @note This method is REQUIRED by all file systems.
218   *
219   *  @note There is no default implementation.
220   */
221  rtems_filesystem_close_t        close_h;
222
223  /**
224   *  This field points to the file system specific implementation
225   *  of the support routine for the read(2) system call
226   *
227   *  @note This method must have a filesystem specific implementation.
228   *
229   *  @note The default implementation returns -1 and sets
230   *  errno to ENOTSUP.
231   */
232  rtems_filesystem_read_t         read_h;
233
234  /**
235   *  This field points to the file system specific implementation
236   *  of the support routine for the write(2) system call
237   *
238   *  @note This method may use a default implementation.
239   *
240   *  @note The default implementation returns -1 and sets
241   *  errno to ENOTSUP.
242   */
243  rtems_filesystem_write_t        write_h;
244
245  /**
246   *  This field points to the file system specific implementation
247   *  of the support routine for the ioctl(2) system call
248   *
249   *  @note This method may use a default implementation.
250   *
251   *  @note The default implementation returns -1 and sets
252   *  errno to ENOTSUP.
253   */
254  rtems_filesystem_ioctl_t        ioctl_h;
255
256  /**
257   *  This field points to the file system specific implementation
258   *  of the support routine for the lseek(2) system call
259   *
260   *  @note This method may use a default implementation.
261   *
262   *  @note The default implementation returns -1 and sets
263   *  errno to ENOTSUP.
264   */
265  rtems_filesystem_lseek_t        lseek_h;
266
267  /**
268   *  This field points to the file system specific implementation
269   *  of the support routine for the fstat(2) system call
270   *
271   *  @note This method may use a default implementation.
272   *
273   *  @note The default implementation returns -1 and sets
274   *  errno to ENOTSUP.
275   */
276  rtems_filesystem_fstat_t        fstat_h;
277
278  /**
279   *  This field points to the file system specific implementation
280   *  of the support routine for the fchmod(2) system call
281   *
282   *  @note This method may use a default implementation.
283   *
284   *  @note The default implementation returns -1 and sets
285   *  errno to ENOTSUP.
286   */
287  rtems_filesystem_fchmod_t       fchmod_h;
288
289  /**
290   *  This field points to the file system specific implementation
291   *  of the support routine for the ftruncate(2) system call
292   *
293   *  @note This method may use a default implementation.
294   *
295   *  @note The default implementation returns -1 and sets
296   *  errno to ENOTSUP.
297   */
298  rtems_filesystem_ftruncate_t    ftruncate_h;
299
300  /**
301   *  This field points to the file system specific implementation
302   *  of the support routine for the fpathconf(2) system call
303   *
304   *  @note This method may use a default implementation.
305   *
306   *  @note The default implementation returns -1 and sets
307   *  errno to ENOTSUP.
308   */
309  rtems_filesystem_fpathconf_t    fpathconf_h;
310
311  /**
312   *  This field points to the file system specific implementation
313   *  of the support routine for the fsync(2) system call
314   *
315   *  @note This method may use a default implementation.
316   *
317   *  @note The default implementation returns -1 and sets
318   *  errno to ENOTSUP.
319   */
320  rtems_filesystem_fsync_t        fsync_h;
321
322  /**
323   *  This field points to the file system specific implementation
324   *  of the support routine for the fdatasync(2) system call
325   *
326   *  @note This method may use a default implementation.
327   *
328   *  @note The default implementation returns -1 and sets
329   *  errno to ENOTSUP.
330   */
331  rtems_filesystem_fdatasync_t    fdatasync_h;
332
333  /**
334   *  This field points to the file system specific implementation
335   *  of the support routine for the fcntl(2) system call
336   *
337   *  @note This method may use a default implementation.
338   *
339   *  @note The default implementation returns -1 and sets
340   *  errno to ENOTSUP.
341   */
342  rtems_filesystem_fcntl_t        fcntl_h;
343
344  /**
345   *  This field points to the file system specific implementation
346   *  of the support routine for the rmnod(2) system call
347   *
348   *  @note This method may use a default implementation.
349   *
350   *  @note The default implementation returns -1 and sets
351   *  errno to ENOTSUP.
352   */
353  rtems_filesystem_rmnod_t        rmnod_h;
354};
355
356extern const rtems_filesystem_file_handlers_r
357rtems_filesystem_handlers_default;
358
359/**
360 *  This method defines the interface to the default open(2)
361 *  system call support which is provided by a file system
362 *  implementation.
363 */
364int rtems_filesystem_default_open(
365  rtems_libio_t *iop,
366  const char    *pathname,
367  uint32_t       flag,
368  uint32_t       mode
369);
370
371/**
372 *  This method defines the interface to the default close(2)
373 *  system call support which is provided by a file system
374 *  implementation.
375 */
376int rtems_filesystem_default_close(
377  rtems_libio_t *iop
378);
379
380
381/**
382 *  This method defines the interface to the default read(2)
383 *  system call support which is provided by a file system
384 *  implementation.
385 */
386ssize_t rtems_filesystem_default_read(
387  rtems_libio_t *iop,
388  void          *buffer,
389  size_t         count
390);
391
392/**
393 *  This method defines the interface to the default write(2) system call
394 *  support which is provided by a file system implementation.
395 */
396ssize_t rtems_filesystem_default_write(
397  rtems_libio_t *iop,
398  const void    *buffer,
399  size_t         count
400);
401
402/**
403 *  This method defines the interface to the default ioctl(2) system call
404 *  support which is provided by a file system implementation.
405 */
406int rtems_filesystem_default_ioctl(
407  rtems_libio_t *iop,
408  uint32_t       command,
409  void          *buffer
410);
411
412/**
413 *  This method defines the interface to the default lseek(2) system call
414 *  support which is provided by a file system implementation.
415 */
416off_t rtems_filesystem_default_lseek(
417  rtems_libio_t *iop,
418  off_t          length,
419  int            whence
420);
421
422/**
423 *  This method defines the interface to the default fstat(2) system call
424 *  support which is provided by a file system implementation.
425 */
426int rtems_filesystem_default_fstat(
427  rtems_filesystem_location_info_t *loc,
428  struct stat                      *buf
429);
430
431/**
432 *  This method defines the interface to the default fchmod(2) system call
433 *  support which is provided by a file system implementation.
434 */
435int rtems_filesystem_default_fchmod(
436  rtems_filesystem_location_info_t *loc,
437  mode_t                            mode
438);
439
440/**
441 *  This method defines the interface to the default ftruncate(2) system call
442 *  support which is provided by a file system implementation.
443 */
444int rtems_filesystem_default_ftruncate(
445  rtems_libio_t *iop,
446  off_t          length
447);
448
449/**
450 *  This method defines the interface to the default fpathconf(2) system call
451 *  support which is provided by a file system implementation.
452 */
453int rtems_filesystem_default_fpathconf(
454  rtems_libio_t *iop,
455  int name
456);
457
458/**
459 *  This method defines the interface to the default fsync(2) system call
460 *  support which is provided by a file system implementation.
461 */
462int rtems_filesystem_default_fsync(
463  rtems_libio_t *iop
464);
465
466/**
467 *  This method defines the interface to the default fdatasync(2) system call
468 *  support which is provided by a file system implementation.
469 */
470int rtems_filesystem_default_fdatasync(
471  rtems_libio_t *iop
472);
473
474/**
475 *  This method defines the interface to the default fnctl(2) system call
476 *  support which is provided by a file system implementation.
477 */
478int rtems_filesystem_default_fcntl(
479  int            cmd,
480  rtems_libio_t *iop
481);
482
483/**
484 *  This method defines the interface to the default rmnod(2) system call
485 *  support which is provided by a file system implementation.
486 */
487int rtems_filesystem_default_rmnod(
488 rtems_filesystem_location_info_t      *parent_loc,   /* IN */
489 rtems_filesystem_location_info_t      *pathloc       /* IN */
490);
491
492/**
493 * @name File System Operations
494 *
495 * @{
496 */
497
498/**
499 *  This type defines the interface to the mknod(2) system call
500 *  support which is provided by a file system implementation.
501 * 
502 *  @note This routine does not allocate any space and
503 *  rtems_filesystem_freenode_t is not called by the generic
504 *  after calling this routine. ie. node_access does not have
505 *  to contain valid data when the routine returns.
506 */
507typedef int (*rtems_filesystem_mknod_t)(
508   const char                        *path,       /* IN */
509   mode_t                             mode,       /* IN */
510   dev_t                              dev,        /* IN */
511   rtems_filesystem_location_info_t  *pathloc     /* IN/OUT */
512);
513
514/**
515 *  This type defines the interface that allows the 
516 *  file system implementation to parse a path and
517 *  allocate any memory necessary for tracking purposes.
518 *
519 *  @note rtems_filesystem_freenode_t must be called by
520 *  the generic after calling this routine
521 */
522typedef int (*rtems_filesystem_evalpath_t)(
523  const char                        *pathname,      /* IN     */
524  size_t                             pathnamelen,   /* IN     */
525  int                                flags,         /* IN     */
526  rtems_filesystem_location_info_t  *pathloc        /* IN/OUT */
527);
528
529/**
530 *  This type defines the interface that allows the 
531 *  file system implementation to parse a path with the
532 *  intent of creating a new node and to 
533 *  allocate any memory necessary for tracking purposes.
534 *
535 *  @note rtems_filesystem_freenode_t must be called by
536 *  the generic after calling this routine
537 */
538typedef int (*rtems_filesystem_evalmake_t)(
539   const char                       *path,       /* IN */
540   rtems_filesystem_location_info_t *pathloc,    /* IN/OUT */
541   const char                      **name        /* OUT    */
542);
543
544/**
545 *  This type defines the interface to the link(2) system call
546 *  support which is provided by a file system implementation.
547 */ 
548typedef int (*rtems_filesystem_link_t)(
549  rtems_filesystem_location_info_t  *to_loc,      /* IN */
550  rtems_filesystem_location_info_t  *parent_loc,  /* IN */
551  const char                        *name         /* IN */
552);
553
554/**
555 *  This type defines the interface to the unlink(2) system call
556 *  support which is provided by a file system implementation.
557 */
558typedef int (*rtems_filesystem_unlink_t)(
559  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
560  rtems_filesystem_location_info_t  *pathloc         /* IN */
561);
562
563/**
564 *  This type defines the interface to the chown(2) system call
565 *  support which is provided by a file system implementation.
566 */
567typedef int (*rtems_filesystem_chown_t)(
568  rtems_filesystem_location_info_t  *pathloc,       /* IN */
569  uid_t                              owner,         /* IN */
570  gid_t                              group          /* IN */
571);
572
573/**
574 *  This type defines the interface to the freenod(2) system call
575 *  support which is provided by a file system implementation.
576 */
577typedef int (*rtems_filesystem_freenode_t)(
578 rtems_filesystem_location_info_t      *pathloc       /* IN */
579);
580
581/**
582 *  This type defines the interface that allows the implemented
583 *  filesystem ot mount another filesystem at the given location.
584 */
585typedef int (* rtems_filesystem_mount_t ) (
586   rtems_filesystem_mount_table_entry_t *mt_entry     /* IN */
587);
588
589/**
590 *  This type defines the interface that allows a file system
591 *  implementation to do any necessary work that is needed when
592 *  it is being mounted.
593 */ 
594typedef int (* rtems_filesystem_fsmount_me_t )(
595  rtems_filesystem_mount_table_entry_t *mt_entry,     /* IN */
596  const void                           *data          /* IN */
597);
598
599/**
600 *  This type defines the interface allow the filesystem to
601 *  unmount a filesystem that was mounted at one of its node
602 *  locations.
603 */
604typedef int (* rtems_filesystem_unmount_t ) (
605  rtems_filesystem_mount_table_entry_t *mt_entry     /* IN */
606);
607
608/**
609 *  This type defines the interface that allows a file system
610 *  implementation to do any necessary work that is needed when
611 *  it is being unmounted.
612 */
613typedef int (* rtems_filesystem_fsunmount_me_t ) (
614   rtems_filesystem_mount_table_entry_t *mt_entry    /* IN */
615);
616
617/**
618 *  This type defines the interface that will return the
619 *  type of a filesystem implementations node.
620 */
621typedef rtems_filesystem_node_types_t (* rtems_filesystem_node_type_t) (
622  rtems_filesystem_location_info_t    *pathloc      /* IN */
623);
624
625/**
626 *  This type defines the interface to the time(2) system call
627 *  support which is provided by a file system implementation.
628 */
629typedef int (* rtems_filesystem_utime_t)(
630  rtems_filesystem_location_info_t  *pathloc,       /* IN */
631  time_t                             actime,        /* IN */
632  time_t                             modtime        /* IN */
633);
634
635/**
636 *  This type defines the interface to the link(2) system call
637 *  support which is provided by a file system implementation.
638 */
639typedef int (*rtems_filesystem_evaluate_link_t)(
640  rtems_filesystem_location_info_t *pathloc,     /* IN/OUT */
641  int                               flags        /* IN     */
642);
643
644/**
645 *  This type defines the interface to the symlink(2) system call
646 *  support which is provided by a file system implementation.
647 */
648typedef int (*rtems_filesystem_symlink_t)(
649 rtems_filesystem_location_info_t  *loc,         /* IN */
650 const char                        *link_name,   /* IN */
651 const char                        *node_name
652);
653
654/**
655 *  This type defines the interface to the readlink(2) system call
656 *  support which is provided by a file system implementation.
657 */
658typedef ssize_t (*rtems_filesystem_readlink_t)(
659 rtems_filesystem_location_info_t  *loc,     /* IN  */
660 char                              *buf,     /* OUT */
661 size_t                             bufsize
662);
663
664/**
665 *  This type defines the interface to the name(2) system call
666 *  support which is provided by a file system implementation.
667 */
668typedef int (*rtems_filesystem_rename_t)(
669 rtems_filesystem_location_info_t  *old_parent_loc,  /* IN */
670 rtems_filesystem_location_info_t  *old_loc,         /* IN */
671 rtems_filesystem_location_info_t  *new_parent_loc,  /* IN */
672 const char                        *name             /* IN */
673);
674
675/**
676 *  This type defines the interface to the statvfs(2) system call
677 *  support which is provided by a file system implementation.
678 */
679typedef int (*rtems_filesystem_statvfs_t)(
680 rtems_filesystem_location_info_t  *loc,     /* IN  */
681 struct statvfs                    *buf      /* OUT */
682);
683
684/** @} */
685
686/**
687 * @brief File system operations table.
688 */
689struct _rtems_filesystem_operations_table {
690
691    /**
692     *  This field points to the file system specific implementation
693     *  of the support routine that evaluates a character path and
694     *  returns the node assocated with the last node in the path.
695     *
696     *  @note This method must have a filesystem specific implementation.
697     *
698     *  @note There is no default implementation.
699     */
700    rtems_filesystem_evalpath_t      evalpath_h;
701
702    /**
703     *  This field points to the file system specific implementation
704     *  of the support routine that evaluates a character path and
705     *  returns the node assocated with next to the last node in
706     *  the path.  The last node will be the new node to be created.
707     *
708     *  @note This method must have a filesystem specific implementation.
709     *
710     *  @note There is no default implementation.
711     */
712    rtems_filesystem_evalmake_t      evalformake_h;
713
714    /**
715     *  This field points to the file system specific implementation
716     *  of the support routine for the link(2) system call
717     *
718     *  @note This method may use a default implementation.
719     *
720     *  @note The default implementation returns -1 and sets
721     *  errno to ENOTSUP.
722     */
723    rtems_filesystem_link_t          link_h;
724
725    /**
726     *  This field points to the file system specific implementation
727     *  of the support routine for the unlink(2) system call
728     *
729     *  @note This method may use a default implementation.
730     *
731     *  @note The default implementation returns -1 and sets
732     *  errno to ENOTSUP.
733     */
734    rtems_filesystem_unlink_t        unlink_h;
735
736    /**
737     *  This field points to the file system specific implementation
738     *  of a method that returns the node type of the given node.
739     *
740     *  @note This method may use a default implementation.
741     *
742     *  @note The default implementation returns -1 and sets
743     *  errno to ENOTSUP.
744     */
745    rtems_filesystem_node_type_t     node_type_h;
746
747    /**
748     *  This field points to the file system specific implementation
749     *  of the support routine for the link(2) system call
750     *
751     *  @note This method may use a mknod implementation.
752     *
753     *  @note The default implementation returns -1 and sets
754     *  errno to ENOTSUP.
755     */
756    rtems_filesystem_mknod_t         mknod_h;
757
758    /**
759     *  This field points to the file system specific implementation
760     *  of the support routine for the link(2) system call
761     *
762     *  @note This method may use a default implementation.
763     *
764     *  @note The default implementation returns -1 and sets
765     *  errno to ENOTSUP.
766     */
767    rtems_filesystem_chown_t         chown_h;
768
769    /**
770     *  This field points to the file system specific implementation
771     *  of the support routine for the freenod(2) system call
772     *
773     *  @note This method may use a default implementation.
774     *
775     *  @note The default implementation returns -1 and sets
776     *  errno to ENOTSUP.
777     */
778    rtems_filesystem_freenode_t      freenod_h;
779
780    /**
781     *  This field points to the file system specific implementation
782     *  of the support routine for the mount(2) system call
783     *
784     *  @note This method may use a default implementation.
785     *
786     *  @note The default implementation returns -1 and sets
787     *  errno to ENOTSUP.
788     */
789    rtems_filesystem_mount_t         mount_h;
790
791    /**
792     *  This field points to the file system specific implementation
793     *  of the support routine for the fsmount(2) system call
794     *
795     *  @note This method may use a default implementation.
796     *
797     *  @note The default implementation returns -1 and sets
798     *  errno to ENOTSUP.
799     */
800    rtems_filesystem_fsmount_me_t    fsmount_me_h;
801
802    /**
803     *  This field points to the file system specific implementation
804     *  of the support routine for the unmount(2) system call
805     *
806     *  @note This method may use a default implementation.
807     *
808     *  @note The default implementation returns -1 and sets
809     *  errno to ENOTSUP.
810     */
811    rtems_filesystem_unmount_t       unmount_h;
812
813    /**
814     *  This field points to the file system specific implementation
815     *  of the support routine for the fsunmount(2) system call
816     *
817     *  @note This method may use a default implementation.
818     *
819     *  @note The default implementation returns -1 and sets
820     *  errno to ENOTSUP.
821     */
822    rtems_filesystem_fsunmount_me_t  fsunmount_me_h;
823
824    /**
825     *  This field points to the file system specific implementation
826     *  of the support routine for the utime(2) system call
827     *
828     *  @note This method may use a default implementation.
829     *
830     *  @note The default implementation returns -1 and sets
831     *  errno to ENOTSUP.
832     */
833    rtems_filesystem_utime_t         utime_h;
834
835    /**
836     *  This field points to the file system specific implementation
837     *  of the support routine for the eval_link(2) system call
838     *
839     *  @note This method may use a default implementation.
840     *
841     *  @note The default implementation returns -1 and sets
842     *  errno to ENOTSUP.
843     */
844    rtems_filesystem_evaluate_link_t eval_link_h;
845
846    /**
847     *  This field points to the file system specific implementation
848     *  of the support routine for the sumlink(2) system call
849     *
850     *  @note This method may use a default implementation.
851     *
852     *  @note The default implementation returns -1 and sets
853     *  errno to ENOTSUP.
854     */
855    rtems_filesystem_symlink_t       symlink_h;
856
857    /**
858     *  This field points to the file system specific implementation
859     *  of the support routine for the readlink(2) system call
860     *
861     *  @note This method may use a default implementation.
862     *
863     *  @note The default implementation returns -1 and sets
864     *  errno to ENOTSUP.
865     */
866    rtems_filesystem_readlink_t      readlink_h;
867
868    /**
869     *  This field points to the file system specific implementation
870     *  of the support routine for the rename(2) system call
871     *
872     *  @note This method may use a default implementation.
873     *
874     *  @note The default implementation returns -1 and sets
875     *  errno to ENOTSUP.
876     */
877    rtems_filesystem_rename_t        rename_h;
878
879    /**
880     *  This field points to the file system specific implementation
881     *  of the support routine for the statvfs(2) system call
882     *
883     *  @note This method may use a default implementation.
884     *
885     *  @note The default implementation returns -1 and sets
886     *  errno to ENOTSUP.
887     */
888    rtems_filesystem_statvfs_t       statvfs_h;
889};
890
891extern const rtems_filesystem_operations_table
892rtems_filesystem_operations_default;
893
894/**
895 * @brief Provides a defualt routine for filesystem
896 * implementation of path evaluation.
897 */
898int rtems_filesystem_default_evalpath(
899  const char *pathname,
900  size_t pathnamelen,
901  int flags,
902  rtems_filesystem_location_info_t *pathloc
903);
904
905/**
906 * @brief Provides a defualt routine for filesystem
907 * implementation of path evaluation for make.
908 */
909int rtems_filesystem_default_evalformake(
910   const char *path,
911   rtems_filesystem_location_info_t *pathloc,
912   const char **name
913);
914
915/**
916 * @brief Provides a defualt routine for filesystem
917 * implementation of a link command.
918 */
919int rtems_filesystem_default_link(
920 rtems_filesystem_location_info_t  *to_loc,      /* IN */
921 rtems_filesystem_location_info_t  *parent_loc,  /* IN */
922 const char                        *name         /* IN */
923);
924
925/**
926 * @brief Provides a defualt routine for filesystem
927 * implementation of a unlink command.
928 */
929int rtems_filesystem_default_unlink(
930 rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
931 rtems_filesystem_location_info_t  *pathloc         /* IN */
932);
933
934/**
935 * @brief Provides a defualt routine for filesystem
936 * implementation to determine the node type.
937 */
938rtems_filesystem_node_types_t rtems_filesystem_default_node_type(
939  rtems_filesystem_location_info_t *pathloc
940);
941
942/**
943 * @brief Provides a defualt routine for filesystem
944 * implementation to create a new node.
945 */
946int rtems_filesystem_default_mknod(
947   const char                        *path,       /* IN */
948   mode_t                             mode,       /* IN */
949   dev_t                              dev,        /* IN */
950   rtems_filesystem_location_info_t  *pathloc     /* IN/OUT */
951);
952
953/**
954 * @brief Provides a defualt routine for filesystem
955 * implementation of a chown command.
956 */
957int rtems_filesystem_default_chown(
958 rtems_filesystem_location_info_t  *pathloc,       /* IN */
959 uid_t                              owner,         /* IN */
960 gid_t                              group          /* IN */
961);
962
963/**
964 * @brief Provides a defualt routine for filesystem
965 * implementation of a freenode command.
966 */
967int rtems_filesystem_default_freenode(
968 rtems_filesystem_location_info_t      *pathloc       /* IN */
969);
970
971/**
972 * @brief Provides a defualt routine for filesystem
973 * implementation of a mount command.
974 */
975int rtems_filesystem_default_mount (
976   rtems_filesystem_mount_table_entry_t *mt_entry     /* IN */
977);
978
979/**
980 * @brief Provides a defualt routine for filesystem
981 * implementation of a fsmount command.
982 */
983int rtems_filesystem_default_fsmount(
984  rtems_filesystem_mount_table_entry_t *mt_entry,     /* IN */
985  const void                           *data          /* IN */
986);
987
988/**
989 * @brief Provides a defualt routine for filesystem
990 * implementation of a unmount command.
991 */
992int rtems_filesystem_default_unmount(
993  rtems_filesystem_mount_table_entry_t *mt_entry     /* IN */
994);
995
996/**
997 * @brief Provides a defualt routine for filesystem
998 * implementation of a fsunmount command.
999 */
1000int rtems_filesystem_default_fsunmount(
1001   rtems_filesystem_mount_table_entry_t *mt_entry    /* IN */
1002);
1003
1004
1005/**
1006 * @brief Provides a defualt routine for filesystem
1007 * implementation of a utime command.
1008 */
1009int rtems_filesystem_default_utime(
1010  rtems_filesystem_location_info_t  *pathloc,       /* IN */
1011  time_t                             actime,        /* IN */
1012  time_t                             modtime        /* IN */
1013);
1014
1015/**
1016 * @brief Provides a defualt routine for filesystem
1017 * implementation of a link command.
1018 */
1019int rtems_filesystem_default_evaluate_link(
1020  rtems_filesystem_location_info_t *pathloc,     /* IN/OUT */
1021  int                               flags        /* IN     */
1022);
1023
1024/**
1025 * @brief Provides a defualt routine for filesystem
1026 * implementation of a symlink command.
1027 */
1028int rtems_filesystem_default_symlink(
1029 rtems_filesystem_location_info_t  *loc,         /* IN */
1030 const char                        *link_name,   /* IN */
1031 const char                        *node_name
1032);
1033
1034/**
1035 * @brief Provides a defualt routine for filesystem
1036 * implementation of a readlink command.
1037 */
1038ssize_t rtems_filesystem_default_readlink(
1039 rtems_filesystem_location_info_t  *loc,     /* IN  */
1040 char                              *buf,     /* OUT */
1041 size_t                             bufsize
1042);
1043
1044/**
1045 * @brief Provides a defualt routine for filesystem
1046 * implementation of a rename command.
1047 */
1048int rtems_filesystem_default_rename(
1049 rtems_filesystem_location_info_t  *old_parent_loc,  /* IN */
1050 rtems_filesystem_location_info_t  *old_loc,         /* IN */
1051 rtems_filesystem_location_info_t  *new_parent_loc,  /* IN */
1052 const char                        *name             /* IN */
1053);
1054
1055/**
1056 * @brief Provides a defualt routine for filesystem
1057 * implementation of a statvfs command.
1058 */
1059int rtems_filesystem_default_statvfs(
1060 rtems_filesystem_location_info_t  *loc,     /* IN  */
1061 struct statvfs                    *buf      /* OUT */
1062);
1063
1064/**
1065 * @brief Gets the mount handler for the file system @a type.
1066 *
1067 * @return The file system mount handler associated with the @a type, or
1068 * @c NULL if no such association exists.
1069 */
1070rtems_filesystem_fsmount_me_t
1071rtems_filesystem_get_mount_handler(
1072  const char *type
1073);
1074
1075/**
1076 * @brief Contain file system specific information which is required to support
1077 * fpathconf().
1078 */
1079typedef struct {
1080  int    link_max;                 /* count */
1081  int    max_canon;                /* max formatted input line size */
1082  int    max_input;                /* max input line size */
1083  int    name_max;                 /* max name length */
1084  int    path_max;                 /* max path */
1085  int    pipe_buf;                 /* pipe buffer size */
1086  int    posix_async_io;           /* async IO supported on fs, 0=no, 1=yes */
1087  int    posix_chown_restrictions; /* can chown: 0=no, 1=yes */
1088  int    posix_no_trunc;           /* error on names > max name, 0=no, 1=yes */
1089  int    posix_prio_io;            /* priority IO, 0=no, 1=yes */
1090  int    posix_sync_io;            /* file can be sync'ed, 0=no, 1=yes */
1091  int    posix_vdisable;           /* special char processing, 0=no, 1=yes */
1092} rtems_filesystem_limits_and_options_t;
1093
1094/**
1095 * @brief Default pathconf settings.
1096 *
1097 * Override in a filesystem.
1098 */
1099extern const rtems_filesystem_limits_and_options_t rtems_filesystem_default_pathconf;
1100
1101/**
1102 * @brief An open file data structure.
1103 *
1104 * It will be indexed by 'fd'.
1105 *
1106 * @todo Should really have a separate per/file data structure that this points
1107 * to (eg: size, offset, driver, pathname should be in that)
1108 */
1109struct rtems_libio_tt {
1110  rtems_driver_name_t                    *driver;
1111  off_t                                   size;      /* size of file */
1112  off_t                                   offset;    /* current offset into file */
1113  uint32_t                                flags;
1114  rtems_filesystem_location_info_t        pathinfo;
1115  rtems_id                                sem;
1116  uint32_t                                data0;     /* private to "driver" */
1117  void                                   *data1;     /* ... */
1118};
1119
1120/**
1121 * @brief Paramameter block for read/write.
1122 *
1123 * It must include 'offset' instead of using iop's offset since we can have
1124 * multiple outstanding i/o's on a device.
1125 */
1126typedef struct {
1127  rtems_libio_t          *iop;
1128  off_t                   offset;
1129  char                   *buffer;
1130  uint32_t                count;
1131  uint32_t                flags;
1132  uint32_t                bytes_moved;
1133} rtems_libio_rw_args_t;
1134
1135/**
1136 * @brief Parameter block for open/close.
1137 */
1138typedef struct {
1139  rtems_libio_t          *iop;
1140  uint32_t                flags;
1141  uint32_t                mode;
1142} rtems_libio_open_close_args_t;
1143
1144/**
1145 * @brief Parameter block for ioctl.
1146 */
1147typedef struct {
1148  rtems_libio_t          *iop;
1149  uint32_t                command;
1150  void                   *buffer;
1151  uint32_t                ioctl_return;
1152} rtems_libio_ioctl_args_t;
1153
1154/**
1155 * @name Flag Values
1156 *
1157 * @{
1158 */
1159
1160#define LIBIO_FLAGS_NO_DELAY      0x0001  /* return immediately if no data */
1161#define LIBIO_FLAGS_READ          0x0002  /* reading */
1162#define LIBIO_FLAGS_WRITE         0x0004  /* writing */
1163#define LIBIO_FLAGS_OPEN          0x0100  /* device is open */
1164#define LIBIO_FLAGS_APPEND        0x0200  /* all writes append */
1165#define LIBIO_FLAGS_CREATE        0x0400  /* create file */
1166#define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800  /* close on process exec() */
1167#define LIBIO_FLAGS_READ_WRITE    (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
1168
1169/** @} */
1170
1171void rtems_libio_init(void);
1172
1173/**
1174 * @name External I/O Handlers
1175 *
1176 * @{
1177 */
1178
1179typedef int (*rtems_libio_open_t)(
1180  const char  *pathname,
1181  uint32_t    flag,
1182  uint32_t    mode
1183);
1184
1185typedef int (*rtems_libio_close_t)(
1186  int  fd
1187);
1188
1189typedef ssize_t (*rtems_libio_read_t)(
1190  int         fd,
1191  void       *buffer,
1192  size_t    count
1193);
1194
1195typedef ssize_t (*rtems_libio_write_t)(
1196  int         fd,
1197  const void *buffer,
1198  size_t      count
1199);
1200
1201typedef int (*rtems_libio_ioctl_t)(
1202  int         fd,
1203  uint32_t    command,
1204  void       *buffer
1205);
1206
1207typedef off_t (*rtems_libio_lseek_t)(
1208  int           fd,
1209  off_t         offset,
1210  int           whence
1211);
1212
1213/** @} */
1214
1215/**
1216 * @name Permission Macros
1217 *
1218 * @{
1219 */
1220
1221/*
1222 *  The following macros are used to build up the permissions sets
1223 *  used to check permissions.  These are similar in style to the
1224 *  mode_t bits and should stay compatible with them.
1225 */
1226#define RTEMS_LIBIO_PERMS_READ   S_IROTH
1227#define RTEMS_LIBIO_PERMS_WRITE  S_IWOTH
1228#define RTEMS_LIBIO_PERMS_RDWR   (S_IROTH|S_IWOTH)
1229#define RTEMS_LIBIO_PERMS_EXEC   S_IXOTH
1230#define RTEMS_LIBIO_PERMS_SEARCH RTEMS_LIBIO_PERMS_EXEC
1231#define RTEMS_LIBIO_PERMS_RWX    S_IRWXO
1232
1233/** @} */
1234
1235union __rtems_dev_t {
1236  dev_t device;
1237  struct {
1238     rtems_device_major_number major;
1239     rtems_device_minor_number minor;
1240  } __overlay;
1241};
1242
1243static inline dev_t rtems_filesystem_make_dev_t(
1244  rtems_device_major_number _major,
1245  rtems_device_minor_number _minor
1246)
1247{
1248  union __rtems_dev_t temp;
1249
1250  temp.__overlay.major = _major;
1251  temp.__overlay.minor = _minor;
1252  return temp.device;
1253}
1254
1255static inline rtems_device_major_number rtems_filesystem_dev_major_t(
1256  dev_t device
1257)
1258{
1259  union __rtems_dev_t temp;
1260
1261  temp.device = device;
1262  return temp.__overlay.major;
1263}
1264
1265
1266static inline rtems_device_minor_number rtems_filesystem_dev_minor_t(
1267  dev_t device
1268)
1269{
1270  union __rtems_dev_t temp;
1271
1272  temp.device = device;
1273  return temp.__overlay.minor;
1274}
1275
1276#define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \
1277  do { \
1278    (_major) = rtems_filesystem_dev_major_t ( _dev ); \
1279    (_minor) = rtems_filesystem_dev_minor_t( _dev ); \
1280  } while(0)
1281
1282/*
1283 * Verifies that the permission flag is valid.
1284 */
1285#define rtems_libio_is_valid_perms( _perm )     \
1286 (((~RTEMS_LIBIO_PERMS_RWX) & _perm ) == 0)
1287
1288/*
1289 *  Prototypes for filesystem
1290 */
1291
1292void rtems_filesystem_initialize( void );
1293
1294typedef void (*rtems_libio_init_functions_t)(void);
1295extern  rtems_libio_init_functions_t rtems_libio_init_helper;
1296
1297void    open_dev_console(void);
1298
1299typedef void (*rtems_libio_supp_functions_t)(void);
1300extern  rtems_libio_supp_functions_t rtems_libio_supp_helper;
1301
1302typedef void (*rtems_fs_init_functions_t)(void);
1303extern  rtems_fs_init_functions_t    rtems_fs_init_helper;
1304
1305/**
1306 * @brief Creates a directory and all its parent directories according to
1307 * @a path.
1308 *
1309 * The @a mode value selects the access permissions of the directory.
1310 *
1311 * @retval 0 Successful operation.
1312 * @retval -1 An error occured.  The @c errno indicates the error.
1313 */
1314extern int rtems_mkdir(const char *path, mode_t mode);
1315
1316/** @} */
1317
1318/**
1319 * @defgroup FileSystemTypesAndMount File System Types and Mount
1320 *
1321 * @ingroup LibIO
1322 *
1323 * @brief File system types and mount.
1324 *
1325 * @{
1326 */
1327
1328/**
1329 * @name File System Types
1330 *
1331 * @{
1332 */
1333
1334#define RTEMS_FILESYSTEM_TYPE_IMFS "imfs"
1335#define RTEMS_FILESYSTEM_TYPE_MINIIMFS "mimfs"
1336#define RTEMS_FILESYSTEM_TYPE_DEVFS "devfs"
1337#define RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs"
1338#define RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs"
1339#define RTEMS_FILESYSTEM_TYPE_NFS "nfs"
1340#define RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs"
1341#define RTEMS_FILESYSTEM_TYPE_RFS "rfs"
1342
1343/** @} */
1344
1345/**
1346 * @brief Mount table entry.
1347 */
1348struct rtems_filesystem_mount_table_entry_tt {
1349  rtems_chain_node                       Node;
1350  rtems_filesystem_location_info_t       mt_point_node;
1351  rtems_filesystem_location_info_t       mt_fs_root;
1352  int                                    options;
1353  void                                  *fs_info;
1354
1355  rtems_filesystem_limits_and_options_t  pathconf_limits_and_options;
1356
1357  /*
1358   * The target or mount point of the file system.
1359   */
1360  const char                            *target;
1361
1362  /*
1363   * The type of filesystem or the name of the filesystem.
1364   */
1365  const char                            *type;
1366
1367  /*
1368   *  When someone adds a mounted filesystem on a real device,
1369   *  this will need to be used.
1370   *
1371   *  The lower layers can manage how this is managed. Leave as a
1372   *  string.
1373   */
1374  char                                  *dev;
1375};
1376
1377/**
1378 * @brief File system options.
1379 */
1380typedef enum {
1381  RTEMS_FILESYSTEM_READ_ONLY,
1382  RTEMS_FILESYSTEM_READ_WRITE,
1383  RTEMS_FILESYSTEM_BAD_OPTIONS
1384} rtems_filesystem_options_t;
1385
1386/**
1387 * @brief File system table entry.
1388 */
1389typedef struct rtems_filesystem_table_t {
1390  const char                    *type;
1391  rtems_filesystem_fsmount_me_t  mount_h;
1392} rtems_filesystem_table_t;
1393
1394/**
1395 * @brief Static table of file systems.
1396 *
1397 * Externally defined by confdefs.h or the user.
1398 */
1399extern const rtems_filesystem_table_t rtems_filesystem_table [];
1400
1401/**
1402 * @brief Registers a file system @a type.
1403 *
1404 * The @a mount_h handler will be used to mount a file system of this @a type.
1405 *
1406 * @retval 0 Successful operation.
1407 * @retval -1 An error occured.  The @c errno indicates the error.
1408 */
1409int rtems_filesystem_register(
1410  const char                    *type,
1411  rtems_filesystem_fsmount_me_t  mount_h
1412);
1413
1414/**
1415 * @brief Unregisters a file system @a type.
1416 *
1417 * @retval 0 Successful operation.
1418 * @retval -1 An error occured.  The @c errno indicates the error.
1419 */
1420int rtems_filesystem_unregister(
1421  const char *type
1422);
1423
1424/**
1425 * @brief Unmounts the file system at @a mount_path.
1426 *
1427 * @todo Due to file system implementation shortcomings it is possible to
1428 * unmount file systems in use.  This likely leads to heap corruption.  Unmount
1429 * only file systems which are not in use by the application.
1430 *
1431 * @retval 0 Successful operation.
1432 * @retval -1 An error occured.  The @c errno indicates the error.
1433 */
1434int unmount(
1435  const char *mount_path
1436);
1437
1438/**
1439 * @brief Mounts a file system at @a target.
1440 *
1441 * The @a source may be a path to the corresponding device file, or @c NULL.
1442 * The @a target path must lead to an existing directory, or @c NULL.  In case
1443 * @a target is @c NULL, the root file system will be mounted.  The @a data
1444 * parameter will be forwarded to the file system initialization handler.  The
1445 * file system type is selected by @a filesystemtype and may be one of
1446 * - RTEMS_FILESYSTEM_TYPE_DEVFS,
1447 * - RTEMS_FILESYSTEM_TYPE_DOSFS,
1448 * - RTEMS_FILESYSTEM_TYPE_FTPFS,
1449 * - RTEMS_FILESYSTEM_TYPE_IMFS,
1450 * - RTEMS_FILESYSTEM_TYPE_MINIIMFS,
1451 * - RTEMS_FILESYSTEM_TYPE_NFS,
1452 * - RTEMS_FILESYSTEM_TYPE_RFS, or
1453 * - RTEMS_FILESYSTEM_TYPE_TFTPFS.
1454 *
1455 * Only configured or registered file system types are available.  You can add
1456 * file system types to your application configuration with
1457 * - CONFIGURE_FILESYSTEM_DEVFS,
1458 * - CONFIGURE_FILESYSTEM_DOSFS,
1459 * - CONFIGURE_FILESYSTEM_FTPFS,
1460 * - CONFIGURE_FILESYSTEM_IMFS,
1461 * - CONFIGURE_FILESYSTEM_MINIIMFS,
1462 * - CONFIGURE_FILESYSTEM_NFS,
1463 * - CONFIGURE_FILESYSTEM_RFS, and
1464 * - CONFIGURE_FILESYSTEM_TFTPFS.
1465 *
1466 * @see rtems_filesystem_register() and mount_and_make_target_path().
1467 *
1468 * @retval 0 Successful operation.
1469 * @retval -1 An error occured.  The @c errno indicates the error.
1470 */
1471int mount(
1472  const char                 *source,
1473  const char                 *target,
1474  const char                 *filesystemtype,
1475  rtems_filesystem_options_t options,
1476  const void                 *data
1477);
1478
1479/**
1480 * @brief Mounts a file system and makes the @a target path.
1481 *
1482 * The @a target path will be created with rtems_mkdir() and must not be
1483 * @c NULL.
1484 *
1485 * @see mount().
1486 *
1487 * @retval 0 Successful operation.
1488 * @retval -1 An error occured.  The @c errno indicates the error.
1489 */
1490int mount_and_make_target_path(
1491  const char                 *source,
1492  const char                 *target,
1493  const char                 *filesystemtype,
1494  rtems_filesystem_options_t options,
1495  const void                 *data
1496);
1497
1498/**
1499 * @brief Per file system type routine.
1500 *
1501 * @see rtems_filesystem_iterate().
1502 *
1503 * @retval true Stop the iteration.
1504 * @retval false Continue the iteration.
1505 */
1506typedef bool (*rtems_per_filesystem_routine)(
1507  const rtems_filesystem_table_t *fs_entry,
1508  void *arg
1509);
1510
1511/**
1512 * @brief Iterates over all file system types.
1513 *
1514 * For each file system type the @a routine will be called with the entry and
1515 * the @a routine_arg parameter.
1516 *
1517 * Do not register or unregister file system types in @a routine.
1518 *
1519 * The iteration is protected by the IO library mutex.
1520 *
1521 * @retval true Iteration stopped due to @a routine return status.
1522 * @retval false Iteration through all entries.
1523 */
1524bool rtems_filesystem_iterate(
1525  rtems_per_filesystem_routine routine,
1526  void *routine_arg
1527);
1528
1529/**
1530 * @brief Per file system mount routine.
1531 *
1532 * @see rtems_filesystem_mount_iterate().
1533 *
1534 * @retval true Stop the iteration.
1535 * @retval false Continue the iteration.
1536 */
1537typedef bool (*rtems_per_filesystem_mount_routine)(
1538  const rtems_filesystem_mount_table_entry_t *mt_entry,
1539  void *arg
1540);
1541
1542/**
1543 * @brief Iterates over all file system mounts.
1544 *
1545 * For each file system mount the @a routine will be called with the entry and
1546 * the @a routine_arg parameter.
1547 *
1548 * Do not mount or unmount file systems in @a routine.
1549 *
1550 * The iteration is protected by the IO library mutex.
1551 *
1552 * @retval true Iteration stopped due to @a routine return status.
1553 * @retval false Iteration through all entries.
1554 */
1555bool
1556rtems_filesystem_mount_iterate(
1557  rtems_per_filesystem_mount_routine routine,
1558  void *routine_arg
1559);
1560
1561/**
1562 * @brief Boot time mount table entry.
1563 */
1564typedef struct {
1565  const char                              *type;
1566  rtems_filesystem_options_t               fsoptions;
1567  const char                              *device;
1568  const char                              *mount_point;
1569} rtems_filesystem_mount_table_t;
1570
1571/**
1572 * @brief Boot time mount table.
1573 *
1574 * @todo Only the first entry will be evaluated.  Why do we need a table?
1575 */
1576extern const rtems_filesystem_mount_table_t *rtems_filesystem_mount_table;
1577
1578/**
1579 * @brief Boot time mount table entry count.
1580 *
1581 * @todo Only the first entry will be evaluated.  Why do we need a table?
1582 */
1583extern const int rtems_filesystem_mount_table_size;
1584
1585/** @} */
1586
1587/**
1588 * @defgroup Termios Termios
1589 *
1590 * @ingroup LibIO
1591 *
1592 * @brief Termios
1593 *
1594 * @{
1595 */
1596
1597typedef struct rtems_termios_callbacks {
1598  int    (*firstOpen)(int major, int minor, void *arg);
1599  int    (*lastClose)(int major, int minor, void *arg);
1600  int    (*pollRead)(int minor);
1601  ssize_t (*write)(int minor, const char *buf, size_t len);
1602  int    (*setAttributes)(int minor, const struct termios *t);
1603  int    (*stopRemoteTx)(int minor);
1604  int    (*startRemoteTx)(int minor);
1605  int    outputUsesInterrupts;
1606} rtems_termios_callbacks;
1607
1608void rtems_termios_initialize (void);
1609
1610/*
1611 * CCJ: Change before opening a tty. Newer code from Eric is coming
1612 * so extra work to handle an open tty is not worth it. If the tty
1613 * is open, close then open it again.
1614 */
1615rtems_status_code rtems_termios_bufsize (
1616  size_t cbufsize,     /* cooked buffer size */
1617  size_t raw_input,    /* raw input buffer size */
1618  size_t raw_output    /* raw output buffer size */
1619);
1620
1621rtems_status_code rtems_termios_open (
1622  rtems_device_major_number      major,
1623  rtems_device_minor_number      minor,
1624  void                          *arg,
1625  const rtems_termios_callbacks *callbacks
1626);
1627
1628rtems_status_code rtems_termios_close(
1629  void *arg
1630);
1631
1632rtems_status_code rtems_termios_read(
1633  void *arg
1634);
1635
1636rtems_status_code rtems_termios_write(
1637  void *arg
1638);
1639
1640rtems_status_code rtems_termios_ioctl(
1641  void *arg
1642);
1643
1644int rtems_termios_enqueue_raw_characters(
1645  void *ttyp,
1646  const char *buf,
1647  int   len
1648);
1649
1650int rtems_termios_dequeue_characters(
1651  void *ttyp,
1652  int   len
1653);
1654
1655/** @} */
1656
1657/**
1658 * @brief The pathconf setting for a file system.
1659 */
1660#define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
1661
1662/**
1663 * @brief The type of file system. Its name.
1664 */
1665#define rtems_filesystem_type(_mte) ((_mte)->type)
1666
1667/**
1668 * @brief The mount point of a file system.
1669 */
1670#define rtems_filesystem_mount_point(_mte) ((_mte)->target)
1671
1672/**
1673 * @brief The device entry of a file system.
1674 */
1675#define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
1676
1677#ifdef __cplusplus
1678}
1679#endif
1680
1681#endif /* _RTEMS_LIBIO_H */
Note: See TracBrowser for help on using the repository browser.