source: rtems/doc/filesystem/syscalls.t @ e88f92b2

4.104.114.84.95
Last change on this file since e88f92b2 was 6449498, checked in by Joel Sherrill <joel.sherrill@…>, on 01/17/02 at 21:47:47

2001-01-17 Joel Sherrill <joel@…>

  • SUPPORT, LICENSE: New files.
  • Numerous files touched as part of merging the 4.5 branch onto the mainline development trunk and ensuring that the script that cuts snapshots and releases works on the documentation.
  • Property mode set to 100644
File size: 31.3 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-2002.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter System Call Development Notes
10
11This set of routines represents the application's interface to files and directories
12under the RTEMS filesystem. All routines are compliant with POSIX standards if a
13specific interface has been established. The list below represents the routines that have
14been included as part of the application's interface.
15
16@enumerate
17@item access()
18@item chdir()
19@item chmod()
20@item chown()
21@item close()
22@item closedir()
23@item dup()
24@item dup2()
25@item fchmod()
26@item fcntl()
27@item fdatasync()
28@item fpathconf()
29@item fstat()
30@item ioctl()
31@item link()
32@item lseek()
33@item mkdir()
34@item mkfifo()
35@item mknod()
36@item mount()
37@item open()
38@item opendir()
39@item pathconf()
40@item read()
41@item readdir()
42@item unmount()
43@end enumerate
44
45The sections that follow provide developmental information concerning each
46of these functions.
47
48 
49@c @page
50@section access
51
52@subheading File:
53
54access.c
55
56@subheading Processing:
57
58This routine is layered on the stat() function. It acquires the current
59status information for the specified file and then determines if the
60caller has the ability to access the file for read, write or execute
61according to the mode argument to this function.
62
63@subheading Development Comments:
64
65This routine is layered on top of the stat() function. As long as the
66st_mode element in the returned structure follow the standard UNIX
67conventions, this function should support other filesystems without
68alteration.
69
70@c @page
71@section chdir
72
73@subheading File:
74
75chdir.c
76
77
78@subheading Processing:
79
80This routine will determine if the pathname that we are attempting to make
81that current directory exists and is in fact a directory. If these
82conditions are met the global indication of the current directory
83(rtems_filesystem_current) is set to the rtems_filesystem_location_info_t
84structure that is returned by the rtems_filesystem_evaluate_path()
85routine.
86
87@subheading Development Comments:
88
89This routine is layered on the rtems_filesystem_evaluate_path() routine
90and the filesystem specific OP table function node_type().
91
92The routine node_type() must be a routine provided for each filesystem
93since it must access the filesystems node information to determine which
94of the following types the node is:
95
96@itemize @bullet
97@item RTEMS_FILESYSTEM_DIRECTORY
98@item RTEMS_FILESYSTEM_DEVICE
99@item RTEMS_FILESYSTEM_HARD_LINK
100@item RTEMS_FILESYSTEM_MEMORY_FILE
101@end itemize
102
103This acknowledges that the form of the node management information can
104vary from one filesystem implementation to another.
105
106RTEMS has a special global structure that maintains the current directory
107location. This global variable is of type rtems_filesystem_location_info_t
108and is called rtems_filesystem_current. This structure is not always
109valid. In order to determine if the structure is valid, you must first
110test the node_access element of this structure. If the pointer is NULL,
111then the structure does not contain a valid indication of what the current
112directory is.
113
114@c @page
115@section chmod
116
117@subheading File:
118
119chmod.c
120
121@subheading Processing:
122
123This routine is layered on the open(), fchmod() and close() functions. As
124long as the standard interpretation of the mode_t value is maintained,
125this routine should not need modification to support other filesystems.
126
127@subheading Development Comments:
128
129The routine first determines if the selected file can be open with
130read/write access.  This is required to allow modification of the mode
131associated with the selected path.
132
133The fchmod() function is used to actually change the mode of the path
134using the integer file descriptor returned by the open() function.
135
136After mode modification, the open file descriptor is closed.
137
138@c @page
139@section chown
140
141@subheading File:
142
143chown.c
144
145@subheading Processing:
146
147This routine is layered on the rtems_filesystem_evaluate_path() and the
148file system specific chown() routine that is specified in the OPS table
149for the file system.
150
151@subheading Development Comments:
152
153rtems_filesystem_evaluate_path() is used to determine if the path
154specified actually exists. If it does a rtems_filesystem_location_info_t
155structure will be obtained that allows the shell function to locate the
156OPS table that is to be used for this filesystem.
157
158It is possible that the chown() function that should be in the OPS table
159is not defined. A test for a non-NULL OPS table chown() entry is performed
160before the function is called.
161
162If the chown() function is defined in the indicated OPS table, the
163function is called with the rtems_filesystem_location_info_t structure
164returned from the path evaluation routine, the desired owner, and group
165information.
166
167@c @page
168@section close
169
170@subheading File:
171
172close.c
173
174@subheading Processing:
175
176This routine will allow for the closing of both network connections and
177file system devices. If the file descriptor is associated with a network
178device, the appropriate network function handler will be selected from a
179table of previously registered network functions (rtems_libio_handlers)
180and that function will be invoked.
181
182If the file descriptor refers to an entry in the filesystem, the
183appropriate handler will be selected using information that has been
184placed in the file control block for the device (rtems_libio_t structure).
185
186@subheading Development Comments:
187
188rtems_file_descriptor_type examines some of the upper bits of the file
189descriptor index. If it finds that the upper bits are set in the file
190descriptor index, the device referenced is a network device.
191
192Network device handlers are obtained from a special registration table
193(rtems_libio_handlers) that is set up during network initialization. The
194network handler invoked and the status of the network handler will be
195returned to the calling process.
196
197If none of the upper bits are set in the file descriptor index, the file
198descriptor refers to an element of the RTEMS filesystem.
199
200The following sequence will be performed for any filesystem file
201descriptor:
202
203@enumerate
204
205@item Use the rtems_libio_iop() function to obtain the rtems_libio_t
206structure for the file descriptor
207
208@item Range check the file descriptor using rtems_libio_check_fd()
209
210@item Determine if there is actually a function in the selected handler
211table that processes the close() operation for the filesystem and node
212type selected.  This is generally done to avoid execution attempts on
213functions that have not been implemented.
214
215@item If the function has been defined it is invoked with the file control
216block pointer as its argument.
217
218@item The file control block that was associated with the open file
219descriptor is marked as free using rtems_libio_free().
220
221@item The return code from the close handler is then passed back to the
222calling program.
223
224@end enumerate
225
226@c @page
227@section closedir
228
229@subheading File:
230
231closedir.c
232
233@subheading Processing:
234
235The code was obtained from the BSD group. This routine must clean up the
236memory resources that are required to track an open directory. The code is
237layered on the close() function and standard memory free() functions. It
238should not require alterations to support other filesystems.
239
240@subheading Development Comments:
241
242The routine alters the file descriptor and the index into the DIR
243structure to make it an invalid file descriptor. Apparently the memory
244that is about to be freed may still be referenced before it is
245reallocated.
246
247The dd_buf structure's memory is reallocated before the control structure
248that contains the pointer to the dd_buf region.
249
250DIR control memory is reallocated.
251
252The close() function is used to free the file descriptor index.
253
254
255@c @page
256@section dup()      Unimplemented
257
258@subheading File:
259
260dup.c
261
262@subheading Processing:
263
264
265@subheading Development Comments:
266
267
268
269
270
271@c @page
272@section dup2()      Unimplemented
273
274@subheading File:
275
276dup2.c
277
278@subheading Processing:
279
280
281@subheading Development Comments:
282
283
284
285
286
287
288@c @page
289@section fchmod
290
291@subheading File:
292
293fchmod.c
294
295@subheading Processing:
296
297This routine will alter the permissions of a node in a filesystem. It is
298layered on the following functions and macros:
299
300@itemize @bullet
301@item rtems_file_descriptor_type()
302
303@item rtems_libio_iop()
304
305@item rtems_libio_check_fd()
306
307@item rtems_libio_check_permissions()
308
309@item fchmod() function that is referenced by the handler table in the
310file control block associated with this file descriptor
311
312@end itemize
313
314@subheading Development Comments:
315
316The routine will test to see if the file descriptor index is associated
317with a network connection. If it is, an error is returned from this
318routine.
319
320The file descriptor index is used to obtain the associated file control
321block.
322
323The file descriptor value is range checked.
324
325The file control block is examined to determine if it has write
326permissions to allow us to alter the mode of the file.
327
328A test is made to determine if the handler table that is referenced in the
329file control block contains an entry for the fchmod() handler function. If
330it does not, an error is returned to the calling routine.
331
332If the fchmod() handler function exists, it is called with the file
333control block and the desired mode as parameters.
334
335@c @page
336@section fcntl()
337
338@subheading File:
339
340fcntl.c
341
342@subheading Processing:
343
344This routine currently only interacts with the file control block. If the
345structure of the file control block and the associated meanings do not
346change, the partial implementation of fcntl() should remain unaltered for
347other filesystem implementations.
348
349@subheading Development Comments:
350
351The only commands that have been implemented are the F_GETFD and F_SETFD.
352The commands manipulate the LIBIO_FLAGS_CLOSE_ON_EXEC bit in the
353@code{flags} element of the file control block associated with the file
354descriptor index.
355
356The current implementation of the function performs the sequence of
357operations below:
358
359@enumerate
360
361@item Test to see if we are trying to operate on a file descriptor
362associated with a network connection
363
364@item Obtain the file control block that is associated with the file
365descriptor index
366
367@item Perform a range check on the file descriptor index.
368
369@end enumerate
370
371
372
373@c @page
374@section fdatasync
375
376@subheading File:
377
378fdatasync.c
379
380@subheading Processing:
381
382This routine is a template in the in memory filesystem that will route us to the
383appropriate handler function to carry out the fdatasync() processing. In the in
384memory filesystem this function is not necessary. Its function in a disk based file
385system that employs a memory cache is to flush all memory based data buffers to
386disk. It is layered on the following functions and macros:
387
388@itemize @bullet
389
390@item rtems_file_descriptor_type()
391
392@item rtems_libio_iop()
393
394@item rtems_libio_check_fd()
395
396@item rtems_libio_check_permissions()
397
398@item fdatasync() function that is referenced by the handler table in the
399file control block associated with this file descriptor
400
401@end itemize
402
403@subheading Development Comments:
404
405The routine will test to see if the file descriptor index is associated
406with a network connection. If it is, an error is returned from this
407routine.
408
409The file descriptor index is used to obtain the associated file control
410block.
411
412The file descriptor value is range checked.
413
414The file control block is examined to determine if it has write
415permissions to the file.
416
417A test is made to determine if the handler table that is referenced in the
418file control block contains an entry for the fdatasync() handler function.
419If it does not an error is returned to the calling routine.
420
421If the fdatasync() handler function exists, it is called with the file
422control block as its parameter.
423
424@c @page
425@section fpathconf
426
427@subheading File:
428
429fpathconf.c
430
431@subheading Processing:
432
433This routine is layered on the following functions and macros:
434
435@itemize @bullet
436
437@item rtems_file_descriptor_type()
438
439@item rtems_libio_iop()
440
441@item rtems_libio_check_fd()
442
443@item rtems_libio_check_permissions()
444
445@end itemize
446
447When a filesystem is mounted, a set of constants is specified for the
448filesystem.  These constants are stored with the mount table entry for the
449filesystem. These constants appear in the POSIX standard and are listed
450below.
451
452@itemize @bullet
453
454@item PCLINKMAX
455
456@item PCMAXCANON
457
458@item PCMAXINPUT
459
460@item PCNAMEMAX
461
462@item PCPATHMAX
463
464@item PCPIPEBUF
465
466@item PCCHOWNRESTRICTED
467
468@item PCNOTRUNC
469
470@item PCVDISABLE
471
472@item PCASYNCIO
473
474@item PCPRIOIO
475
476@item PCSYNCIO
477
478
479@end itemize
480
481This routine will find the mount table information associated the file
482control block for the specified file descriptor parameter. The mount table
483entry structure contains a set of filesystem specific constants that can
484be accessed by individual identifiers.
485
486@subheading Development Comments:
487
488The routine will test to see if the file descriptor index is associated
489with a network connection. If it is, an error is returned from this
490routine.
491
492The file descriptor index is used to obtain the associated file control
493block.
494
495The file descriptor value is range checked.
496
497The file control block is examined to determine if it has read permissions
498to the file.
499
500Pathinfo in the file control block is used to locate the mount table entry
501for the filesystem associated with the file descriptor.
502
503The mount table entry contains the pathconf_limits_and_options element.
504This element is a table of constants that is associated with the
505filesystem.
506
507The name argument is used to reference the desired constant from the
508pathconf_limits_and_options table.
509
510
511@c @page
512@section fstat
513
514@subheading File:
515
516fstat.c
517
518@subheading Processing:
519
520This routine will return information concerning a file or network
521connection. If the file descriptor is associated with a network
522connection, the current implementation of @code{fstat()} will return a
523mode set to @code{S_IFSOCK}. In a later version, this routine will map the
524status of a network connection to an external handler routine.
525
526If the file descriptor is associated with a node under a filesystem, the
527fstat()  routine will map to the fstat() function taken from the node
528handler table.
529
530@subheading Development Comments:
531
532This routine validates that the struct stat pointer is not NULL so that
533the return location is valid.
534
535The struct stat is then initialized to all zeros.
536
537rtems_file_descriptor_type() is then used to determine if the file
538descriptor is associated with a network connection. If it is, network
539status processing is performed. In the current implementation, the file
540descriptor type processing needs to be improved. It currently just drops
541into the normal processing for file system nodes.
542
543If the file descriptor is associated with a node under a filesystem, the
544following steps are performed:
545
546@enumerate
547
548@item Obtain the file control block that is associated with the file descriptor
549index.
550
551@item Range check the file descriptor index.
552
553@item Test to see if there is a non-NULL function pointer in the handler
554table for the fstat() function. If there is, invoke the function with the
555file control block and the pointer to the stat structure.
556
557@end enumerate
558
559@c @page
560@section ioctl
561
562@subheading File:
563
564ioctl.c
565
566@subheading Processing:
567
568Not defined in the POSIX 1003.1b standard but commonly supported in most
569UNIX and POSIX system. Ioctl() is a catchall for I/O operations. Routine
570is layered on external network handlers and filesystem specific handlers.
571The development of new filesystems should not alter the basic processing
572performed by this routine.
573
574@subheading Development Comments:
575
576
577The file descriptor is examined to determine if it is associated with a
578network device. If it is processing is mapped to an external network
579handler. The value returned by this handler is then returned to the
580calling program.
581
582File descriptors that are associated with a filesystem undergo the
583following processing:
584
585@enumerate
586
587@item The file descriptor index is used to obtain the associated file
588control block.
589
590@item The file descriptor value is range checked.
591
592@item A test is made to determine if the handler table that is referenced
593in the file control block contains an entry for the ioctl() handler
594function. If it does not, an error is returned to the calling routine.
595
596@item If the ioctl() handler function exists, it is called with the file
597control block, the command and buffer as its parameters.
598
599@item The return code from this function is then sent to the calling
600routine.
601
602@end enumerate
603
604
605@c @page
606@section link
607
608@subheading File:
609
610link.c
611
612@subheading Processing:
613
614This routine will establish a hard link to a file, directory or a device.
615The target of the hard link must be in the same filesystem as the new link
616being created. A link to an existing link is also permitted but the
617existing link is evaluated before the new link is made. This implies that
618links to links are reduced to links to files, directories or devices
619before they are made.
620
621@subheading Development Comments:
622
623Calling parameters:
624const char   *existing
625    const char   *new
626
627link() will determine if the target of the link actually exists using
628rtems_filesystem_evaluate_path()
629
630rtems_filesystem_get_start_loc() is used to determine where to start the
631path evaluation of the new name. This macro examines the first characters
632of the name to see if the name of the new link starts with a
633rtems_filesystem_is_separator. If it does the search starts from the root
634of the RTEMS filesystem; otherwise the search will start from the current
635directory.
636
637The OPS table evalformake() function for the parent's filesystem is used
638to locate the node that will be the parent of the new link. It will also
639locate the start of the new path's name. This name will be used to define
640a child under the parent directory.
641
642If the parent is found, the routine will determine if the hard link that
643we are trying to create will cross a filesystem boundary. This is not
644permitted for hard-links.
645
646If the hard-link does not cross a filesystem boundary, a check is
647performed to determine if the OPS table contains an entry for the link()
648function.
649
650If a link() function is defined, the OPS table link() function will be
651called to establish the actual link within the filesystem.
652
653The return code from the OPS table link() function is returned to the
654calling program.
655
656@c @page
657@section lseek
658
659@subheading File:
660
661lseek.c
662
663@subheading Processing:
664
665This routine is layered on both external handlers and filesystem / node
666type specific handlers. This routine should allow for the support of new
667filesystems without modification.
668
669@subheading Development Comments:
670
671This routine will determine if the file descriptor is associated with a
672network device. If it is lseek will map to an external network handler.
673The handler will be called with the file descriptor, offset and whence as
674its calling parameters. The return code from the external handler will be
675returned to the calling routine.
676
677If the file descriptor is not associated with a network connection, it is
678associated with a node in a filesystem. The following steps will be
679performed for filesystem nodes:
680
681@enumerate
682
683@item The file descriptor is used to obtain the file control block for the
684node.
685
686@item The file descriptor is range checked.
687
688@item The offset element of the file control block is altered as indicated
689by the offset and whence calling parameters
690
691@item The handler table in the file control block is examined to determine
692if it contains an entry for the lseek() function. If it does not an error
693is returned to the calling program.
694
695@item The lseek() function from the designated handler table is called
696with the file control block, offset and whence as calling arguments
697
698@item The return code from the lseek() handler function is returned to the
699calling program
700
701@end enumerate
702
703
704@c @page
705@section mkdir
706
707@subheading File:
708
709mkdir.c
710
711@subheading Processing:
712
713This routine attempts to create a directory node under the filesystem. The
714routine is layered the mknod() function.
715
716@subheading Development Comments:
717
718See mknod() for developmental comments.
719
720@c @page
721@section mkfifo
722
723@subheading File:
724
725mkfifo.c
726
727@subheading Processing:
728
729This routine attempts to create a FIFO node under the filesystem. The
730routine is layered the mknod() function.
731
732@subheading Development Comments:
733
734See mknod() for developmental comments
735
736@c @page
737@section mknod
738
739@subheading File:
740
741mknod.c
742
743@subheading Processing:
744
745This function will allow for the creation of the following types of nodes
746under the filesystem:
747
748@itemize @bullet
749
750@item directories
751
752@item regular files
753
754@item character devices
755
756@item block devices
757
758@item fifos
759
760@end itemize
761
762At the present time, an attempt to create a FIFO will result in an ENOTSUP
763error to the calling function. This routine is layered the filesystem
764specific routines evalformake and mknod. The introduction of a new
765filesystem must include its own evalformake and mknod function to support
766the generic mknod() function.  Under this condition the generic mknod()
767function should accommodate other filesystem types without alteration.
768
769@subheading Development Comments:
770
771Test for nodal types - I thought that this test should look like the
772following code:
773
774@example
775if ( (mode & S_IFDIR) = = S_IFDIR) ||
776     (mode & S_IFREG) = = S_IFREG) ||
777     (mode & S_IFCHR) = = S_IFCHR) ||
778     (mode & S_IFBLK) = = S_IFBLK) ||
779     (mode & S_IFIFO) = = S_IFIFO))
780     Set_errno_and_return_minus_one (EINVAL);
781
782@end example
783
784Where:
785
786@itemize @bullet
787@item S_IFREG (0100000) - Creation of a regular file
788@item S_IFCHR (0020000) - Creation of a character device
789@item S_IFBLK (0060000) - Creation of a block device
790@item S_IFIFO (0010000) - Creation of a FIFO
791@end itemize
792
793Determine if the pathname that we are trying to create starts at the root
794directory or is relative to the current directory using the
795rtems_filesystem_get_start_loc()  function.
796
797Determine if the pathname leads to a valid directory that can be accessed
798for the creation of a node.
799
800If the pathname is a valid location to create a node, verify that a
801filesystem specific mknod() function exists.
802
803If the mknod() function exists, call the filesystem specific mknod()
804function.  Pass the name, mode, device type and the location information
805associated with the directory under which the node will be created.
806
807@c @page
808@section mount
809
810@subheading File:
811
812mount.c
813
814
815Arguments (Not a standard POSIX call):
816
817rtems_filesystem_mount_table_entry_t   **mt_entry,
818
819If the mount operation is successful, this pointer to a pointer will be
820set to reference the mount table chain entry that has been allocated for
821this file system mount.
822
823rtems_filesystem_operations_table   *fs_ops,
824
825This is a pointer to a table of functions that are associated with the
826file system that we are about to mount. This is the mechanism to selected
827file system type without keeping a dynamic database of all possible file
828system types that are valid for the mount operation. Using this method, it
829is only necessary to configure the filesystems that we wish to use into
830the RTEMS build. Unused filesystems types will not be drawn into the
831build.
832
833char                      *fsoptions,
834
835This argument points to a string that selects mounting for read only
836access or read/write access. Valid states are "RO" and "RW"
837
838char                      *device,
839
840This argument is reserved for the name of a device that will be used to
841access the filesystem information. Current filesystem implementations are
842memory based and do not require a device to access filesystem information.
843
844char                      *mount_point
845
846This is a pathname to a directory in a currently mounted filesystem that
847allows read, write and execute permissions.  If successful, the node found
848by evaluating this name, is stored in the mt_entry.
849
850@subheading Processing:
851
852This routine will handle the mounting of a filesystem on a mount point. If
853the operation is successful, a pointer to the mount table chain entry
854associated with the mounted filesystem will be returned to the calling
855function. The specifics about the processing required at the mount point
856and within the filesystem being mounted is isolated in the filesystem
857specific mount() and fsmount_me()  functions. This allows the generic
858mount() function to remain unaltered even if new filesystem types are
859introduced.
860
861
862
863@subheading Development Comments:
864
865This routine will use get_file_system_options() to determine if the mount
866options are valid ("RO" or "RW").
867
868It confirms that a filesystem ops-table has been selected.
869
870Space is allocated for a mount table entry and selective elements of the
871temporary mount table entry are initialized.
872
873If a mount point is specified: The mount point is examined to determine
874that it is a directory and also has the appropriate permissions to allow a
875filesystem to be mounted.
876
877The current mount table chain is searched to determine that there is not
878another filesystem mounted at the mount point we are trying to mount onto.
879
880If a mount function is defined in the ops table for the filesystem
881containing the mount point, it is called at this time.
882
883If no mount point is specified: Processing if performed to set up the
884mount table chain entry as the base filesystem.
885
886If the fsmount_me() function is specified for ops-table of the filesystem
887being mounted, that function is called to initialize for the new
888filesystem.
889
890On successful completion, the temporary mount table entry will be placed
891on the mount table chain to record the presence of the mounted filesystem.
892
893@c @page
894@section open
895
896@subheading File:
897
898open.c
899
900@subheading Processing:
901
902This routine is layered on both RTEMS calls and filesystem specific
903implementations of the open() function. These functional interfaces should
904not change for new filesystems and therefore this code should be stable as
905new file systems are introduced.
906
907@subheading Development Comments:
908
909This routine will allocate a file control block for the file or device
910that we are about to open.
911
912It will then test to see if the pathname exists. If it does a
913rtems_filesystem_location_info_t data structure will be filled out. This
914structure contains information that associates node information,
915filesystem specific functions and mount table chain information with the
916pathname.
917
918If the create option has been it will attempt to create a node for a
919regular file along the specified path. If a file already exists along this
920path, an error will be generated; otherwise, a node will be allocated for
921the file under the filesystem that contains the pathname. When a new node
922is created, it is also evaluated so that an appropriate
923rtems_filesystem_location_info_t data structure can be filled out for the
924newly created node.
925
926If the file exists or the new file was created successfully, the file
927control block structure will be initialized with handler table
928information, node information and the rtems_filesystem_location_info_t
929data structure that describes the node and filesystem data in detail.
930
931If an open() function exists in the filesystem specific handlers table for
932the node that we are trying to open, it will be called at this time.
933
934If any error is detected in the process, cleanup is performed. It consists
935of freeing the file control block structure that was allocated at the
936beginning of the generic open() routine.
937
938On a successful open(), the index into the file descriptor table will be
939calculated and returned to the calling routine.
940
941@c @page
942@section opendir
943
944@subheading File:
945
946opendir.c
947
948@subheading Processing:
949
950This routine will attempt to open a directory for read access. It will
951setup a DIR control structure that will be used to access directory
952information. This routine is layered on the generic open() routine and
953filesystem specific directory processing routines.
954
955@subheading Development Comments:
956
957The BSD group provided this routine.
958
959@c @page
960@section pathconf
961
962@subheading File:
963
964pathconf.c
965
966@subheading Processing:
967
968This routine will obtain the value of one of the path configuration
969parameters and return it to the calling routine. It is layered on the
970generic open() and fpathconf()  functions. These interfaces should not
971change with the addition of new filesystem types.
972
973@subheading Development Comments:
974
975This routine will try to open the file indicated by path.
976
977If successful, the file descriptor will be used to access the pathconf
978value specified by @code{name} using the fpathconf() function.
979
980The file that was accessed is then closed.
981
982@c @page
983@section read
984
985@subheading File:
986
987deviceio.c
988
989@subheading Processing:
990
991This routine is layered on a set of RTEMS calls and filesystem specific
992read operations. The functions are layered in such a way as to isolate
993them from change as new filesystems are introduced.
994
995@subheading Development Comments:
996
997This routine will examine the type of file descriptor it is sent.
998
999If the file descriptor is associated with a network device, the read
1000function will be mapped to a special network handler. The return code from
1001the network handler will then be sent as the return code from generic
1002read() function.
1003
1004For file descriptors that are associated with the filesystem the following
1005sequence will be performed:
1006
1007@enumerate
1008
1009@item Obtain the file control block associated with the file descriptor
1010
1011@item Range check the file descriptor
1012
1013@item Determine that the buffer pointer is not invalid
1014
1015@item Check that the count is not zero
1016
1017@item Check the file control block to see if we have permissions to read
1018
1019@item If there is a read function in the handler table, invoke the handler
1020table read() function
1021
1022@item Use the return code from the handler table read function(number of
1023bytes read) to increment the offset element of the file control block
1024
1025@item Return the number of bytes read to the calling program
1026
1027@end enumerate
1028
1029@c @page
1030@section readdir
1031
1032@subheading File:
1033
1034readdir.c
1035
1036@subheading Processing:
1037
1038This routine was acquired from the BSD group. It has not been altered from
1039its original form.
1040
1041@subheading Development Comments:
1042
1043The routine calls a customized getdents() function that is provided by the
1044user.  This routine provides the filesystem specific aspects of reading a
1045directory.
1046
1047It is layered on the read() function in the directory handler table. This
1048function has been mapped to the Imfs_dir_read() function.
1049
1050@c @page
1051@section unmount
1052
1053@subheading File:
1054
1055unmount.c
1056
1057@subheading Processing:
1058
1059This routine will attempt to dismount a mounted filesystem and then free
1060all resources that were allocated for the management of that filesystem.
1061
1062@subheading Development Comments:
1063
1064@itemize @bullet
1065
1066@item This routine will determine if there are any filesystems currently
1067mounted under the filesystem that we are trying to dismount. This would
1068prevent the dismount of the filesystem.
1069
1070@item It will test to see if the current directory is in the filesystem
1071that we are attempting to dismount. This would prevent the dismount of the
1072filesystem.
1073
1074@item It will scan all the currently open file descriptors to determine is
1075there is an open file descriptor to a file in the filesystem that we are
1076attempting to unmount().
1077
1078@end itemize
1079
1080If the above preconditions are met then the following sequence is
1081performed:
1082
1083@enumerate
1084
1085@item Call the filesystem specific unmount() function for the filesystem
1086that contains the mount point. This routine should indicate that the mount
1087point no longer has a filesystem mounted below it.
1088
1089@item Call the filesystem specific fsunmount_me() function for the mounted
1090filesystem that we are trying to unmount(). This routine should clean up
1091any resources that are no longer needed for the management of the file
1092system being un-mounted.
1093
1094@item Extract the mount table entry for the filesystem that was just
1095dismounted from the mount table chain.
1096
1097@item Free the memory associated with the extracted mount table entry.
1098
1099@end enumerate
1100
1101@c @page
1102@section eval
1103
1104@subheading File:
1105
1106XXX
1107
1108@subheading Processing:
1109
1110XXX
1111
1112@subheading Development Comments:
1113
1114XXX
1115
1116@c @page
1117@section getdentsc
1118
1119@subheading File:
1120
1121XXX
1122
1123@subheading Processing:
1124
1125XXX
1126
1127@subheading Development Comments:
1128
1129XXX
1130
Note: See TracBrowser for help on using the repository browser.