source: rtems/doc/filesystem/imfs.t @ ffce9b39

4.104.114.84.95
Last change on this file since ffce9b39 was ffce9b39, checked in by Joel Sherrill <joel.sherrill@…>, on 10/11/99 at 20:10:03

More cleanup.

  • Property mode set to 100644
File size: 31.2 KB
Line 
1
2@chapter In-Memory Filesystem
3
4This chapter describes the In-Memory Filesystem.
5
6@section Filesystem Handler Table Functions
7
8OPS table functions are defined in a rtems_filesystem_operations_table
9structure.  It defines functions that are specific to a given file system.
10One table exists for each file system that is supported in the RTEMS
11configuration. The structure definition appears below and is followed by
12general developmental information on each of the functions contained in this
13function management structure.
14
15@example
16typedef struct @{
17  rtems_filesystem_evalpath_t        evalpath;
18  rtems_filesystem_evalmake_t        evalformake;
19  rtems_filesystem_link_t            link;
20  rtems_filesystem_unlink_t          unlink;
21  rtems_filesystem_node_type_t       node_type;
22  rtems_filesystem_mknod_t           mknod;
23  rtems_filesystem_rmnod_t           rmnod;
24  rtems_filesystem_chown_t           chown;
25  rtems_filesystem_freenode_t        freenod;
26  rtems_filesystem_mount_t           mount;
27  rtems_filesystem_fsmount_me_t      fsmount_me;
28  rtems_filesystem_unmount_t         unmount;
29  rtems_filesystem_fsunmount_me_t    fsunmount_me;
30  rtems_filesystem_utime_t           utime;
31  rtems_filesystem_evaluate_link_t   eval_link;
32  rtems_filesystem_symlink_t         symlink;
33@} rtems_filesystem_operations_table;
34@end example
35
36
37
38@c
39@c
40@c
41
42@page
43
44@subsection evalpath()
45
46@subheading Slot Function:
47
48XXX
49
50@subheading Arguments:
51
52XXX
53
54@subheading File:
55
56XXX
57
58@subheading Development Comments:
59
60XXX
61
62
63@c
64@c
65@c
66
67@page
68
69@subsection evalformake()
70
71@subheading Slot Function:
72
73XXX
74
75@subheading Arguments:
76
77XXX
78
79@subheading File:
80
81XXX
82
83@subheading Development Comments:
84
85XXX
86
87
88@c
89@c
90@c
91
92@page
93
94@subsection link()
95
96@subheading Slot Function:
97
98link
99
100@subheading Arguments:
101
102
103@example
104rtems_filesystem_location_info_t    *to_loc,      /* IN */
105rtems_filesystem_location_info_t    *parent_loc,  /* IN */
106const char                          *token        /* IN */
107@end example
108
109@subheading File:
110
111imfs_link.c
112
113@subheading Development Comments:
114
115
116This routine is used in the IMFS file system to create a hard-link.
117
118It will first examine the st_nlink count of the node that we are trying to.
119If the link count exceeds LINK_MAX an error will be returned.
120
121The name of the link will be normalized to remove extraneous separators from
122the end of the name.
123
124IMFS_create_node will be used to create a file system node that will have the
125following characteristics:
126
127@itemize @bullet
128
129@item parent that was determined in the link() function in file link.c
130
131@item Type will be set to IMFS_HARD_LINK
132
133@item name will be set to the normalized name
134
135@item mode of the hard-link will be set to the mode of the target node
136
137@end itemize
138
139If there was trouble allocating memory for the new node an error will be
140returned.
141
142The st_nlink count of the target node will be incremented to reflect the new
143link.
144
145The time fields of the link will be set to reflect the creation time of the
146hard-link.
147
148
149@c @c @c
150
151@page
152
153@subsection unlink()
154
155@subheading Slot Function:
156
157XXX
158
159@subheading Arguments:
160
161XXX
162
163@subheading File:
164
165XXX
166
167@subheading Development Comments:
168
169XXX
170
171
172@c
173@c
174@c
175
176@page
177
178@subsection node_type()
179
180@subheading Slot Function:
181
182IMFS_node_type()
183
184@subheading Arguments:
185
186@example
187rtems_filesystem_location_info_t    *pathloc        /* IN */
188@end example
189
190@subheading File:
191
192imfs_ntype.c
193
194@subheading Development Comments:
195
196This routine will locate the IMFS_jnode_t structure that holds ownership
197information for the selected node in the file system.
198
199This structure is pointed to by pathloc->node_access.
200
201The IMFS_jnode_t type element indicates one of the node types listed below:
202
203@itemize @bullet
204
205@item RTEMS_FILESYSTEM_DIRECTORY
206
207@item RTEMS_FILESYSTEM_DEVICE
208
209@item RTEMS_FILESYSTEM_HARD_LINK
210
211@item RTEMS_FILESYSTEM_MEMORY_FILE
212
213@end itemize
214
215@c
216@c
217@c
218
219@page
220
221@subsection mknod()
222
223@subheading Slot Function:
224
225IMFS_mknod()
226
227@subheading Arguments:
228
229@example
230const char                          *token,        /* IN */
231mode_t                               mode,         /* IN */
232dev_t                                dev,          /* IN */
233rtems_filesystem_location_info_t    *pathloc       /* IN/OUT */
234@end example
235
236@subheading File:
237
238imfs_mknod.c
239
240@subheading Development Comments:
241
242This routine will examine the mode argument to determine is we are trying to
243create a directory, regular file and a device node. The creation of other
244node types is not permitted and will cause an assert.
245
246Memory space will be allocated for a @code{jnode} and the node will be set up
247according to the nodal type that was specified. The IMFS_create_node()
248function performs the allocation and setup of the node.
249
250The only problem that is currently reported is the lack of memory when we
251attempt to allocate space for the @code{jnode} (ENOMEN).
252
253
254@c
255@c
256@c
257
258@page
259
260@subsection rmnod()
261
262@subheading Slot Function:
263
264XXX
265
266@subheading Arguments:
267
268XXX
269
270@subheading File:
271
272XXX
273
274@subheading Development Comments:
275
276XXX
277
278
279@c
280@c
281@c
282
283@page
284
285@subsection chown()
286
287@subheading Slot Function:
288
289IMFS_chown()
290
291@subheading Arguments:
292
293@example
294rtems_filesystem_location_info_t    *pathloc        /* IN */
295uid_t                                owner          /* IN */
296gid_t                                group          /* IN */
297@end example
298
299@subheading File:
300
301imfs_chown.c
302
303@subheading Development Comments:
304
305This routine will locate the IMFS_jnode_t structure that holds ownership
306information for the selected node in the file system.
307
308This structure is pointed to by pathloc->node_access.
309
310The st_uid and st_gid fields of the node are then modified. Since this is a
311memory based file system, no further action is required to alter the
312ownership of the IMFS_jnode_t structure.
313
314
315
316@c
317@c
318@c
319
320@page
321
322@subsection freenod()
323
324@subheading Slot Function:
325
326XXX
327
328@subheading Arguments:
329
330XXX
331
332@subheading File:
333
334XXX
335
336@subheading Development Comments:
337
338XXX
339
340
341@c
342@c
343@c
344
345@page
346
347@subsection mount()
348
349@subheading Slot Function:
350
351IMFS_mount()
352
353@subheading Arguments:
354
355@example
356rtems_filesystem_mount_table_entry_t   *mt_entry
357@end example
358
359@subheading File:
360
361imfs_mount.c
362
363@subheading Development Comments:
364
365This routine provides the file system specific processing required to mount a
366file system for the system that contains the mount point. It will determine
367if the point that we are trying to mount onto is a node of IMFS_DIRECTORY
368type.
369
370If it is the node's info element is altered so that the info.directory.mt_fs
371element points to the mount table chain entry that is associated with the
372mounted file system at this point. The info.directory.mt_fs element can be
373examined to determine if a file system is mounted at a directory. If it is
374NULL, the directory does not serve as a mount point. A non-NULL entry
375indicates that the directory does serve as a mount point and the value of
376info.directory.mt_fs can be used to locate the mount table chain entry that
377describes the file system mounted at this point.
378
379
380@c
381@c
382@c
383
384@page
385
386@subsection fsmount_me()
387
388@subheading Slot Function:
389
390IMFS_initialize()
391
392@subheading Arguments:
393
394@example
395rtems_filesystem_mount_table_entry_t   *mt_entry   
396@end example
397
398@subheading File:
399
400imfs_init.c
401
402@subheading Development Comments:
403
404This function is provided with a file system to take care of the internal
405file system management details associated with mounting that file system
406under the RTEMS environment.
407
408It is not responsible for the mounting details associated the file system
409containing the mount point.
410
411The rtems_filesystem_mount_table_entry_t structure contains the key elements
412below:
413
414rtems_filesystem_location_info_t         *mt_point_node,
415
416This structure contains information about the mount point. This
417allows us to find the ops-table and the handling functions
418associated with the file system containing the mount point.
419
420rtems_filesystem_location_info_t         *fs_root_node,
421
422This structure contains information about the root node in the file
423system to be mounted. It allows us to find the ops-table and the
424handling functions associated with the file system to be mounted.
425
426rtems_filesystem_options_t                 options,
427
428Read only or read/write access
429
430void                                         *fs_info,
431
432This points to an allocated block of memory the will be used to
433hold any file system specific information of a global nature. This
434allocated region if important because it allows us to mount the
435same file system type more than once under the RTEMS system.
436Each instance of the mounted file system has its own set of global
437management information that is separate from the global
438management information associated with the other instances of the
439mounted file system type.
440
441rtems_filesystem_limits_and_options_t    pathconf_info,
442
443The table contains the following set of values associated with the
444mounted file system:
445
446@itemize @bullet
447
448@item link_max
449
450@item max_canon
451
452@item max_input
453
454@item name_max
455
456@item path_max
457
458@item pipe_buf
459
460@item posix_async_io
461
462@item posix_chown_restrictions
463
464@item posix_no_trunc
465
466@item posix_prio_io
467
468@item posix_sync_io
469
470@item posix_vdisable
471
472@end itemize
473
474These values are accessed with the pathconf() and the fpathconf () 
475functions.
476
477const char                                   *dev
478
479The is intended to contain a string that identifies the device that contains
480the file system information. The file systems that are currently implemented
481are memory based and don't require a device specification.
482
483If the mt_point_node.node_access is NULL then we are mounting the base file
484system.
485
486The routine will create a directory node for the root of the IMFS file
487system.
488
489The node will have read, write and execute permissions for owner, group and
490others.
491
492The node's name will be a null string.
493
494A file system information structure(fs_info) will be allocated and
495initialized for the IMFS file system. The fs_info pointer in the mount table
496entry will be set to point the file system information structure.
497
498The pathconf_info element of the mount table will be set to the appropriate
499table of path configuration constants ( IMFS_LIMITS_AND_OPTIONS ).
500
501The fs_root_node structure will be filled in with the following:
502
503@itemize @bullet
504
505@item pointer to the allocated root node of the file system
506
507@item directory handlers for a directory node under the IMFS file system
508
509@item OPS table functions for the IMFS
510
511@end itemize
512
513A 0 will be returned to the calling routine if the process succeeded,
514otherwise a 1 will be returned.
515
516
517@c
518@c
519@c
520
521@page
522
523@subsection unmount()
524
525@subheading Slot Function:
526
527XXX
528
529@subheading Arguments:
530
531XXX
532
533@subheading File:
534
535XXX
536
537@subheading Development Comments:
538
539XXX
540
541
542@c
543@c
544@c
545
546@page
547
548@subsection fsunmount_me()
549
550@subheading Slot Function:
551
552imfs_fsunmount_me()
553
554@subheading Arguments:
555
556@example
557rtems_filesystem_mount_table_entry_t   *mt_entry   
558@end example
559
560@subheading File:
561
562imfs_fsunmount_me.c
563
564@subheading Development Comments:
565
566XXX
567
568
569@c
570@c
571@c
572
573@page
574
575@subsection utime()
576
577@subheading Slot Function:
578
579XXX
580
581@subheading Arguments:
582
583XXX
584
585@subheading File:
586
587XXX
588
589@subheading Development Comments:
590
591XXX
592
593
594@c
595@c
596@c
597
598@page
599
600@subsection eval_link()
601
602@subheading Slot Function:
603
604XXX
605
606@subheading Arguments:
607
608XXX
609
610@subheading File:
611
612XXX
613
614@subheading Development Comments:
615
616XXX
617
618@c
619@c
620@c
621@page
622@section Regular File Handler Table Functions
623
624Handler table functions are defined in a rtems_filesystem_file_handlers_r
625structure. It defines functions that are specific to a node type in a given
626file system. One table exists for each of the file system's node types. The
627structure definition appears below. It is followed by general developmental
628information on each of the functions associated with regular files contained
629in this function management structure.
630
631@example
632typedef struct @{
633    rtems_filesystem_open_t           open;
634    rtems_filesystem_close_t          close;
635    rtems_filesystem_read_t           read;
636    rtems_filesystem_write_t          write;
637    rtems_filesystem_ioctl_t          ioctl;
638    rtems_filesystem_lseek_t          lseek;
639    rtems_filesystem_fstat_t          fstat;
640    rtems_filesystem_fchmod_t         fchmod;
641    rtems_filesystem_ftruncate_t      ftruncate;
642    rtems_filesystem_fpathconf_t      fpathconf;
643    rtems_filesystem_fsync_t          fsync;
644    rtems_filesystem_fdatasync_t      fdatasync;
645@} rtems_filesystem_file_handlers_r;
646@end example
647
648
649@c
650@c
651@c
652
653@page
654
655@subsection open() for Regular Files
656
657@subheading Slot Function:
658
659memfile_open()
660
661@subheading Arguments:
662
663@example
664rtems_libio_t   *iop,
665const char      *pathname,
666unsigned32       flag,
667unsigned32       mode
668@end example
669
670@subheading File:
671
672memfile.c
673
674@subheading Development Comments:
675
676Currently this function is a shell. No meaningful processing is performed and
677a success code is always returned.
678
679@c
680@c
681@c
682
683@page
684
685@subsection close() for Regular Files
686
687@subheading Slot Function:
688
689memfile_close()
690
691@subheading Arguments:
692
693@example
694rtems_libio_t     *iop
695@end example
696
697@subheading File:
698
699memfile.c
700
701@subheading Development Comments:
702
703This routine is a dummy for regular files under the base file system. It
704performs a capture of the IMFS_jnode_t pointer from the file control block
705and then immediately returns a success status.
706
707
708@c
709@c
710@c
711
712@page
713
714@subsection read() for Regular Files
715
716@subheading Slot Function:
717
718memfile_read()
719
720@subheading Arguments:
721
722@example
723rtems_libio_t     *iop,
724void              *buffer,
725unsigned32         count
726@end example
727
728@subheading File:
729
730memfile.c
731
732@subheading Development Comments:
733
734This routine will determine the @code{jnode} that is associated with this file.
735
736It will then call IMFS_memfile_read() with the @code{jnode}, file position index,
737buffer and transfer count as arguments.
738
739IMFS_memfile_read() will do the following:
740
741@itemize @bullet
742
743@item Verify that the @code{jnode} is associated with a memory file
744
745@item Verify that the destination of the read is valid
746
747@item Adjust the length of the read if it is too long
748
749@item Acquire data from the memory blocks associated with the file
750
751@item Update the access time for the data in the file
752
753@end itemize
754
755@c
756@c
757@c
758
759@page
760
761@subsection write() for Regular Files
762
763@subheading Slot Function:
764
765XXX
766
767@subheading Arguments:
768
769XXX
770@subheading File:
771
772XXX
773
774@subheading Development Comments:
775
776XXX
777
778@c
779@c
780@c
781
782@page
783
784@subsection ioctl() for Regular Files
785
786@subheading Slot Function:
787
788XXX
789
790@subheading Arguments:
791
792@example
793rtems_libio_t     *iop,
794unsigned32       command,
795void              *buffer
796@end example
797
798@subheading File:
799
800memfile.c
801
802@subheading Development Comments:
803
804The current code is a placeholder for future development. The routine returns
805a successful completion status.
806
807@c
808@c
809@c
810
811@page
812
813@subsection lseek() for Regular Files
814
815@subheading Slot Function:
816
817Memfile_lseek()
818
819@subheading Arguments:
820
821@example
822rtems_libio_t     *iop,
823off_t              offset,
824int                whence
825@end example
826
827@subheading File:
828
829memfile.c
830
831@subheading Development Comments:
832
833This routine make sure that the memory based file is sufficiently large to
834allow for the new file position index.
835
836The IMFS_memfile_extend() function is used to evaluate the current size of
837the memory file and allocate additional memory blocks if required by the new
838file position index. A success code is always returned from this routine.
839
840@c
841@c
842@c
843
844@page
845
846@subsection fstat() for Regular Files
847
848@subheading Slot Function:
849
850IMFS_stat()
851
852@subheading Arguments:
853
854@example
855rtems_filesystem_location_info_t   *loc,
856struct stat                        *buf
857@end example
858
859@subheading File:
860
861imfs_stat.c
862
863@subheading Development Comments:
864
865This routine actually performs status processing for both devices and regular
866files.
867
868The IMFS_jnode_t structure is referenced to determine the type of node under
869the file system.
870
871If the node is associated with a device, node information is extracted and
872transformed to set the st_dev element of the stat structure.
873
874If the node is a regular file, the size of the regular file is extracted from
875the node.
876
877This routine rejects other node types.
878
879The following information is extracted from the node and placed in the stat
880structure:
881
882@itemize @bullet
883
884@item st_mode
885
886@item st_nlink
887
888@item st_ino
889
890@item st_uid
891
892@item st_gid
893
894@item st_atime
895
896@item st_mtime
897
898@item st_ctime
899
900@end itemize
901
902@c
903@c
904@c
905
906@page
907
908@subsection fchmod() for Regular Files
909
910@subheading Slot Function:
911
912IMFS_fchmod()
913
914@subheading Arguments:
915
916@example
917rtems_libio_t     *iop
918mode_t              mode
919@end example
920
921@subheading File:
922
923imfs_fchmod.c
924
925@subheading Development Comments:
926
927This routine will obtain the pointer to the IMFS_jnode_t structure from the
928information currently in the file control block.
929
930Based on configuration the routine will acquire the user ID from a call to
931getuid()  or from the IMFS_jnode_t structure.
932
933It then checks to see if we have the ownership rights to alter the mode of
934the file.  If the caller does not, an error code is returned.
935
936An additional test is performed to verify that the caller is not trying to
937alter the nature of the node. If the caller is attempting to alter more than
938the permissions associated with user group and other, an error is returned.
939
940If all the preconditions are met, the user, group and other fields are set
941based on the mode calling parameter.
942
943@c
944@c
945@c
946
947@page
948
949@subsection ftruncate() for Regular Files
950
951@subheading Slot Function:
952
953XXX
954
955@subheading Arguments:
956
957XXX
958@subheading File:
959
960XXX
961
962@subheading Development Comments:
963
964XXX
965
966@c
967@c
968@c
969
970@page
971
972@subsection fpathconf() for Regular Files
973
974@subheading Slot Function:
975
976NULL
977
978@subheading Arguments:
979
980Not Implemented
981
982@subheading File:
983
984Not Implemented
985
986@subheading Development Comments:
987
988Not Implemented
989
990
991@c
992@c
993@c
994
995@page
996
997@subsection fsync() for Regular Files
998
999@subheading Slot Function:
1000
1001XXX
1002
1003@subheading Arguments:
1004
1005XXX
1006@subheading File:
1007
1008XXX
1009
1010@subheading Development Comments:
1011
1012XXX
1013
1014
1015@c
1016@c
1017@c
1018
1019@page
1020
1021@subsection fdatasync() for Regular Files
1022
1023@subheading Slot Function:
1024
1025XXX
1026
1027@subheading Arguments:
1028
1029XXX
1030@subheading File:
1031
1032XXX
1033
1034@subheading Development Comments:
1035
1036XXX
1037
1038@c
1039@c
1040@c
1041@page
1042@section Directory Handler Table Functions
1043
1044Handler table functions are defined in a rtems_filesystem_file_handlers_r
1045structure. It defines functions that are specific to a node type in a given
1046file system. One table exists for each of the file system's node types. The
1047structure definition appears below. It is followed by general developmental
1048information on each of the functions associated with directories contained in
1049this function management structure.
1050
1051@example
1052typedef struct @{
1053    rtems_filesystem_open_t           open;
1054    rtems_filesystem_close_t          close;
1055    rtems_filesystem_read_t           read;
1056    rtems_filesystem_write_t          write;
1057    rtems_filesystem_ioctl_t          ioctl;
1058    rtems_filesystem_lseek_t          lseek;
1059    rtems_filesystem_fstat_t          fstat;
1060    rtems_filesystem_fchmod_t         fchmod;
1061    rtems_filesystem_ftruncate_t      ftruncate;
1062    rtems_filesystem_fpathconf_t      fpathconf;
1063    rtems_filesystem_fsync_t          fsync;
1064    rtems_filesystem_fdatasync_t      fdatasync;
1065@} rtems_filesystem_file_handlers_r;
1066@end example
1067
1068
1069@c
1070@c
1071@c
1072
1073@page
1074
1075@subsection open() for Directories
1076
1077@subheading Slot Function:
1078
1079imfs_dir_open()
1080
1081@subheading Arguments:
1082
1083@example
1084rtems_libio_t  *iop,
1085const char     *pathname,
1086unsigned32      flag,
1087unsigned32      mode
1088@end example
1089
1090@subheading File:
1091
1092imfs_directory.c
1093
1094@subheading Development Comments:
1095
1096This routine will look into the file control block to find the @code{jnode} that
1097is associated with the directory.
1098
1099The routine will verify that the node is a directory. If its not a directory
1100an error code will be returned.
1101
1102If it is a directory, the offset in the file control block will be set to 0.
1103This allows us to start reading at the beginning of the directory.
1104
1105@c
1106@c
1107@c
1108
1109@page
1110
1111@subsection close() for Directories
1112
1113@subheading Slot Function:
1114
1115imfs_dir_close()
1116
1117@subheading Arguments:
1118
1119@example
1120rtems_libio_t     *iop
1121@end example
1122
1123@subheading File:
1124
1125imfs_directory.c
1126
1127@subheading Development Comments:
1128
1129This routine is a dummy for directories under the base file system. It
1130immediately returns a success status.
1131
1132@c
1133@c
1134@c
1135
1136@page
1137
1138@subsection read() for Directories
1139
1140@subheading Slot Function:
1141
1142imfs_dir_read
1143
1144@subheading Arguments:
1145
1146@example
1147rtems_libio_t  *iop,
1148void           *buffer,
1149unsigned32      count
1150@end example
1151
1152@subheading File:
1153
1154imfs_directory.c
1155
1156@subheading Development Comments:
1157
1158This routine will read a fixed number of directory entries from the current
1159directory offset. The number of directory bytes read will be returned from
1160this routine.
1161
1162
1163@c
1164@c
1165@c
1166
1167@page
1168
1169@subsection write() for Directories
1170
1171@subheading Slot Function:
1172
1173XXX
1174
1175@subheading Arguments:
1176
1177XXX
1178
1179@subheading File:
1180
1181XXX
1182
1183@subheading Development Comments:
1184
1185XXX
1186
1187@c
1188@c
1189@c
1190
1191@page
1192
1193@subsection ioctl() for Directories
1194
1195@subheading Slot Function:
1196
1197ioctl
1198
1199@subheading Arguments:
1200
1201
1202@subheading File:
1203
1204Not supported
1205
1206@subheading Development Comments:
1207
1208XXX
1209
1210@c
1211@c
1212@c
1213
1214@page
1215
1216@subsection lseek() for Directories
1217
1218@subheading Slot Function:
1219
1220imfs_dir_lseek()
1221
1222@subheading Arguments:
1223
1224@example
1225rtems_libio_t      *iop,
1226off_t               offset,
1227int                 whence
1228@end example
1229
1230@subheading File:
1231
1232imfs_directory.c
1233
1234@subheading Development Comments:
1235
1236This routine alters the offset in the file control block.
1237
1238No test is performed on the number of children under the current open
1239directory.  The imfs_dir_read() function protects against reads beyond the
1240current size to the directory by returning a 0 bytes transfered to the
1241calling programs whenever the file position index exceeds the last entry in
1242the open directory.
1243
1244@c
1245@c
1246@c
1247
1248@page
1249
1250@subsection fstat() for Directories
1251
1252@subheading Slot Function:
1253
1254imfs_dir_fstat()
1255
1256@subheading Arguments:
1257
1258
1259@example
1260rtems_filesystem_location_info_t   *loc,
1261struct stat                        *buf
1262@end example
1263
1264@subheading File:
1265
1266imfs_directory.c
1267
1268@subheading Development Comments:
1269
1270The node access information in the rtems_filesystem_location_info_t structure
1271is used to locate the appropriate IMFS_jnode_t structure. The following
1272information is taken from the IMFS_jnode_t structure and placed in the stat
1273structure:
1274
1275@itemize @bullet
1276@item st_ino
1277@item st_mode
1278@item st_nlink
1279@item st_uid
1280@item st_gid
1281@item st_atime
1282@item st_mtime
1283@item st_ctime
1284@end itemize
1285
1286The st_size field is obtained by running through the chain of directory
1287entries and summing the sizes of the dirent structures associated with each
1288of the children of the directory.
1289
1290@c
1291@c
1292@c
1293
1294@page
1295
1296@subsection fchmod() for Directories
1297
1298@subheading Slot Function:
1299
1300IMFS_fchmod()
1301
1302@subheading Arguments:
1303
1304@example
1305rtems_libio_t     *iop
1306mode_t             mode
1307@end example
1308
1309@subheading File:
1310
1311imfs_fchmod.c
1312
1313@subheading Development Comments:
1314
1315This routine will obtain the pointer to the IMFS_jnode_t structure from the
1316information currently in the file control block.
1317
1318Based on configuration the routine will acquire the user ID from a call to
1319getuid()  or from the IMFS_jnode_t structure.
1320
1321It then checks to see if we have the ownership rights to alter the mode of
1322the file.  If the caller does not, an error code is returned.
1323
1324An additional test is performed to verify that the caller is not trying to
1325alter the nature of the node. If the caller is attempting to alter more than
1326the permissions associated with user group and other, an error is returned.
1327
1328If all the preconditions are met, the user, group and other fields are set
1329based on the mode calling parameter.
1330
1331@c
1332@c
1333@c
1334
1335@page
1336
1337@subsection ftruncate() for Directories
1338
1339@subheading Slot Function:
1340
1341XXX
1342
1343@subheading Arguments:
1344
1345XXX
1346
1347@subheading File:
1348
1349XXX
1350
1351@subheading Development Comments:
1352
1353XXX
1354
1355@c
1356@c
1357@c
1358
1359@page
1360
1361@subsection fpathconf() for Directories
1362
1363@subheading Slot Function:
1364
1365fpathconf
1366
1367@subheading Arguments:
1368
1369Not Implemented
1370
1371@subheading File:
1372
1373Not Implemented
1374
1375@subheading Development Comments:
1376
1377Not Implemented
1378
1379
1380@c
1381@c
1382@c
1383
1384@page
1385
1386@subsection fsync() for Directories
1387
1388@subheading Slot Function:
1389
1390XXX
1391
1392@subheading Arguments:
1393
1394XXX
1395@subheading File:
1396
1397XXX
1398
1399@subheading Development Comments:
1400
1401XXX
1402
1403
1404@c
1405@c
1406@c
1407
1408@page
1409
1410@subsection fdatasync() for Directories
1411
1412@subheading Slot Function:
1413
1414XXX
1415
1416@subheading Arguments:
1417
1418XXX
1419
1420@subheading File:
1421
1422XXX
1423
1424@subheading Development Comments:
1425
1426XXX
1427
1428
1429@section Device Handler Table Functions
1430
1431Handler table functions are defined in a rtems_filesystem_file_handlers_r
1432structure. It defines functions that are specific to a node type in a given
1433file system. One table exists for each of the file system's node types. The
1434structure definition appears below. It is followed by general developmental
1435information on each of the functions associated with devices contained in
1436this function management structure.
1437
1438@example
1439typedef struct @{
1440  rtems_filesystem_open_t           open;
1441  rtems_filesystem_close_t          close;
1442  rtems_filesystem_read_t           read;
1443  rtems_filesystem_write_t          write;
1444  rtems_filesystem_ioctl_t          ioctl;
1445  rtems_filesystem_lseek_t          lseek;
1446  rtems_filesystem_fstat_t          fstat;
1447  rtems_filesystem_fchmod_t         fchmod;
1448  rtems_filesystem_ftruncate_t      ftruncate;
1449  rtems_filesystem_fpathconf_t      fpathconf;
1450  rtems_filesystem_fsync_t          fsync;
1451  rtems_filesystem_fdatasync_t      fdatasync;
1452@} rtems_filesystem_file_handlers_r;
1453@end example
1454
1455@c
1456@c
1457@c
1458
1459@page
1460
1461@subsection open() for Devices
1462
1463@subheading Slot Function:
1464
1465device_open()
1466
1467@subheading Arguments:
1468
1469@example
1470rtems_libio_t     *iop,
1471const char        *pathname,
1472unsigned32         flag,
1473unsigned32         mode
1474@end example
1475
1476@subheading File:
1477
1478deviceio.c
1479
1480@subheading Development Comments:
1481
1482This routine will use the file control block to locate the node structure for
1483the device.
1484
1485It will extract the major and minor device numbers from the @code{jnode}.
1486
1487The major and minor device numbers will be used to make a rtems_io_open() 
1488function call to open the device driver. An argument list is sent to the
1489driver that contains the file control block, flags and mode information.
1490
1491@c
1492@c
1493@c
1494
1495@page
1496
1497@subsection close() for Devices
1498
1499@subheading Slot Function:
1500
1501device_close()
1502
1503@subheading Arguments:
1504
1505@example
1506rtems_libio_t     *iop
1507@end example
1508
1509@subheading File:
1510
1511deviceio.c
1512
1513@subheading Development Comments:
1514
1515This routine extracts the major and minor device driver numbers from the
1516IMFS_jnode_t that is referenced in the file control block.
1517
1518It also forms an argument list that contains the file control block.
1519
1520A rtems_io_close() function call is made to close the device specified by the
1521major and minor device numbers.
1522
1523
1524@c
1525@c
1526@c
1527
1528@page
1529
1530@subsection read() for Devices
1531
1532@subheading Slot Function:
1533
1534device_read()
1535
1536@subheading Arguments:
1537
1538@example
1539rtems_libio_t     *iop,
1540void              *buffer,
1541unsigned32         count
1542@end example
1543
1544@subheading File:
1545
1546deviceio.c
1547
1548@subheading Development Comments:
1549
1550This routine will extract the major and minor numbers for the device from the -
1551jnode- associated with the file descriptor.
1552
1553A rtems_io_read() call will be made to the device driver associated with the file
1554descriptor. The major and minor device number will be sent as arguments as well
1555as an argument list consisting of:
1556
1557@itemize @bullet
1558@item file control block
1559
1560@item file position index
1561
1562@item buffer pointer where the data read is to be placed
1563
1564@item count indicating the number of bytes that the program wishes to read
1565from the device
1566
1567@item flags from the file control block
1568
1569@end itemize
1570
1571On return from the rtems_io_read() the number of bytes that were actually
1572read will be returned to the calling program.
1573
1574
1575@c
1576@c
1577@c
1578
1579@page
1580
1581@subsection write() for Devices
1582
1583@subheading Slot Function:
1584
1585XXX
1586
1587@subheading Arguments:
1588
1589XXX
1590@subheading File:
1591
1592XXX
1593
1594@subheading Development Comments:
1595
1596XXX
1597
1598@c
1599@c
1600@c
1601
1602@page
1603
1604@subsection ioctl() for Devices
1605
1606@subheading Slot Function:
1607
1608ioctl
1609
1610@subheading Arguments:
1611
1612@example
1613rtems_libio_t     *iop,
1614unsigned32         command,
1615void              *buffer
1616@end example
1617
1618@subheading File:
1619
1620deviceio.c
1621
1622@subheading Development Comments:
1623
1624This handler will obtain status information about a device.
1625
1626The form of status is device dependent.
1627
1628The rtems_io_control() function uses the major and minor number of the device
1629to obtain the status information.
1630
1631rtems_io_control() requires an rtems_libio_ioctl_args_t argument list which
1632contains the file control block, device specific command and a buffer pointer
1633to return the device status information.
1634
1635The device specific command should indicate the nature of the information
1636that is desired from the device.
1637
1638After the rtems_io_control() is processed, the buffer should contain the
1639requested device information.
1640
1641If the device information is not obtained properly a -1 will be returned to
1642the calling program, otherwise the ioctl_return value is returned.
1643
1644@c
1645@c
1646@c
1647
1648@page
1649
1650@subsection lseek() for Devices
1651
1652@subheading Slot Function:
1653
1654device_lseek()
1655
1656@subheading Arguments:
1657
1658@example
1659rtems_libio_t     *iop,
1660off_t              offset,
1661int                whence
1662@end example
1663
1664@subheading File:
1665
1666deviceio.c
1667
1668@subheading Development Comments:
1669
1670At the present time this is a placeholder function. It always returns a
1671successful status.
1672
1673@c
1674@c
1675@c
1676
1677@page
1678
1679@subsection fstat() for Devices
1680
1681@subheading Slot Function:
1682
1683IMFS_stat()
1684
1685@subheading Arguments:
1686
1687@example
1688rtems_filesystem_location_info_t   *loc,
1689struct stat                        *buf
1690@end example
1691
1692@subheading File:
1693
1694imfs_stat.c
1695
1696@subheading Development Comments:
1697
1698This routine actually performs status processing for both devices and regular files.
1699
1700The IMFS_jnode_t structure is referenced to determine the type of node under the
1701file system.
1702
1703If the node is associated with a device, node information is extracted and
1704transformed to set the st_dev element of the stat structure.
1705
1706If the node is a regular file, the size of the regular file is extracted from the node.
1707
1708This routine rejects other node types.
1709
1710The following information is extracted from the node and placed in the stat
1711structure:
1712
1713@itemize @bullet
1714
1715@item st_mode
1716
1717@item st_nlink
1718
1719@item st_ino
1720
1721@item st_uid
1722
1723@item st_gid
1724
1725@item st_atime
1726
1727@item st_mtime
1728
1729@item st_ctime
1730
1731@end itemize
1732
1733
1734
1735@c
1736@c
1737@c
1738
1739@page
1740
1741@subsection fchmod() for Devices
1742
1743@subheading Slot Function:
1744
1745IMFS_fchmod()
1746
1747@subheading Arguments:
1748
1749@example
1750rtems_libio_t     *iop
1751mode_t             mode
1752@end example
1753
1754@subheading File:
1755
1756imfs_fchmod.c
1757
1758@subheading Development Comments:
1759
1760This routine will obtain the pointer to the IMFS_jnode_t structure from the
1761information currently in the file control block.
1762
1763Based on configuration the routine will acquire the user ID from a call to
1764getuid()  or from the IMFS_jnode_t structure.
1765
1766It then checks to see if we have the ownership rights to alter the mode of
1767the file.  If the caller does not, an error code is returned.
1768
1769An additional test is performed to verify that the caller is not trying to
1770alter the nature of the node. If the caller is attempting to alter more than
1771the permissions associated with user group and other, an error is returned.
1772
1773If all the preconditions are met, the user, group and other fields are set
1774based on the mode calling parameter.
1775
1776
1777@c
1778@c
1779@c
1780
1781@page
1782
1783@subsection ftruncate() for Devices
1784
1785@subheading Slot Function:
1786
1787XXX
1788
1789@subheading Arguments:
1790
1791XXX
1792@subheading File:
1793
1794XXX
1795
1796@subheading Development Comments:
1797
1798XXX
1799
1800@c
1801@c
1802@c
1803
1804@page
1805
1806@subsection fpathconf() for Devices
1807
1808@subheading Slot Function:
1809
1810fpathconf
1811
1812@subheading Arguments:
1813
1814Not Implemented
1815
1816@subheading File:
1817
1818Not Implemented
1819
1820@subheading Development Comments:
1821
1822Not Implemented
1823
1824
1825@c
1826@c
1827@c
1828
1829@page
1830
1831@subsection fsync() for Devices
1832
1833@subheading Slot Function:
1834
1835XXX
1836
1837@subheading Arguments:
1838
1839XXX
1840
1841@subheading File:
1842
1843XXX
1844
1845@subheading Development Comments:
1846
1847XXX
1848
1849
1850@c
1851@c
1852@c
1853
1854@page
1855
1856@subsection fdatasync() for Devices
1857
1858Not Implemented
1859
1860@subheading Slot Function:
1861
1862XXX
1863
1864@subheading Arguments:
1865
1866XXX
1867
1868@subheading File:
1869
1870XXX
1871
1872@subheading Development Comments:
1873
1874XXX
1875
Note: See TracBrowser for help on using the repository browser.