1 | Filesystem Implementation Requirements |
---|
2 | ###################################### |
---|
3 | |
---|
4 | This chapter details the behavioral requirements that all filesystem |
---|
5 | implementations must adhere to. |
---|
6 | |
---|
7 | General |
---|
8 | ======= |
---|
9 | |
---|
10 | The RTEMS filesystem framework was intended to be compliant with the |
---|
11 | POSIX Files and Directories interface standard. The following filesystem |
---|
12 | characteristics resulted in a functional switching layer. |
---|
13 | .. code:: c |
---|
14 | |
---|
15 | Figure of the Filesystem Functional Layering goes here. |
---|
16 | This figure includes networking and disk caching layering. |
---|
17 | |
---|
18 | # Application programs are presented with a standard set of POSIX |
---|
19 | compliant functions that allow them to interface with the files, devices |
---|
20 | and directories in the filesystem. The interfaces to these routines do |
---|
21 | not reflect the type of subordinate filesystem implementation in which |
---|
22 | the file will be found. |
---|
23 | |
---|
24 | # The filesystem framework developed under RTEMS allows for mounting |
---|
25 | filesystem of different types under the base filesystem. |
---|
26 | |
---|
27 | # The mechanics of locating file information may be quite different |
---|
28 | between filesystem types. |
---|
29 | |
---|
30 | # The process of locating a file may require crossing filesystem |
---|
31 | boundaries. |
---|
32 | |
---|
33 | # The transitions between filesystem and the processing required to |
---|
34 | access information in different filesystem is not visible at the level |
---|
35 | of the POSIX function call. |
---|
36 | |
---|
37 | # The POSIX interface standard provides file access by character |
---|
38 | pathname to the file in some functions and through an integer file |
---|
39 | descriptor in other functions. |
---|
40 | |
---|
41 | # The nature of the integer file descriptor and its associated |
---|
42 | processing is operating system and filesystem specific. |
---|
43 | |
---|
44 | # Directory and device information must be processed with some of the |
---|
45 | same routines that apply to files. |
---|
46 | |
---|
47 | # The form and content of directory and device information differs |
---|
48 | greatly from that of a regular file. |
---|
49 | |
---|
50 | # Files, directories and devices represent elements (nodes) of a tree |
---|
51 | hierarchy. |
---|
52 | |
---|
53 | # The rules for processing each of the node types that exist under the |
---|
54 | filesystem are node specific but are still not reflected in the POSIX |
---|
55 | interface routines. |
---|
56 | |
---|
57 | .. code:: c |
---|
58 | |
---|
59 | Figure of the Filesystem Functional Layering goes here. |
---|
60 | This figure focuses on the Base Filesystem and IMFS. |
---|
61 | |
---|
62 | .. code:: c |
---|
63 | |
---|
64 | Figure of the IMFS Memfile control blocks |
---|
65 | |
---|
66 | |
---|
67 | File and Directory Removal Constraints |
---|
68 | ====================================== |
---|
69 | |
---|
70 | The following POSIX constraints must be honored by all filesystems. |
---|
71 | |
---|
72 | - If a node is a directory with children it cannot be removed. |
---|
73 | |
---|
74 | - The root node of any filesystem, whether the base filesystem or a |
---|
75 | mounted filesystem, cannot be removed. |
---|
76 | |
---|
77 | - A node that is a directory that is acting as the mount point of a file |
---|
78 | system cannot be removed. |
---|
79 | |
---|
80 | - On filesystems supporting hard links, a link count is maintained. |
---|
81 | Prior to node removal, the node's link count is decremented by one. The |
---|
82 | link count must be less than one to allow for removal of the node. |
---|
83 | |
---|
84 | API Layering |
---|
85 | ============ |
---|
86 | |
---|
87 | Mapping of Generic System Calls to Filesystem Specific Functions |
---|
88 | ---------------------------------------------------------------- |
---|
89 | |
---|
90 | The list of generic system calls includes the routines open(), read(), |
---|
91 | write(), close(), etc.. |
---|
92 | |
---|
93 | The Files and Directories section of the POSIX Application Programs |
---|
94 | Interface specifies a set of functions with calling arguments that are |
---|
95 | used to gain access to the information in a filesystem. To the |
---|
96 | application program, these functions allow access to information in any |
---|
97 | mounted filesystem without explicit knowledge of the filesystem type or |
---|
98 | the filesystem mount configuration. The following are functions that are |
---|
99 | provided to the application: |
---|
100 | |
---|
101 | # access() |
---|
102 | |
---|
103 | # chdir() |
---|
104 | |
---|
105 | # chmod() |
---|
106 | |
---|
107 | # chown() |
---|
108 | |
---|
109 | # close() |
---|
110 | |
---|
111 | # closedir() |
---|
112 | |
---|
113 | # fchmod() |
---|
114 | |
---|
115 | # fcntl() |
---|
116 | |
---|
117 | # fdatasync() |
---|
118 | |
---|
119 | # fpathconf() |
---|
120 | |
---|
121 | # fstat() |
---|
122 | |
---|
123 | # fsync() |
---|
124 | |
---|
125 | # ftruncate() |
---|
126 | |
---|
127 | # link() |
---|
128 | |
---|
129 | # lseek() |
---|
130 | |
---|
131 | # mkdir() |
---|
132 | |
---|
133 | # mknod() |
---|
134 | |
---|
135 | # mount() |
---|
136 | |
---|
137 | # open() |
---|
138 | |
---|
139 | # opendir() |
---|
140 | |
---|
141 | # pathconf() |
---|
142 | |
---|
143 | # read() |
---|
144 | |
---|
145 | # readdir() |
---|
146 | |
---|
147 | # rewinddir() |
---|
148 | |
---|
149 | # rmdir() |
---|
150 | |
---|
151 | # rmnod() |
---|
152 | |
---|
153 | # scandir() |
---|
154 | |
---|
155 | # seekdir() |
---|
156 | |
---|
157 | # stat() |
---|
158 | |
---|
159 | # telldir() |
---|
160 | |
---|
161 | # umask() |
---|
162 | |
---|
163 | # unlink() |
---|
164 | |
---|
165 | # unmount() |
---|
166 | |
---|
167 | # utime() |
---|
168 | |
---|
169 | # write() |
---|
170 | |
---|
171 | The filesystem's type as well as the node type within the filesystem |
---|
172 | determine the nature of the processing that must be performed for each of |
---|
173 | the functions above. The RTEMS filesystem provides a framework that |
---|
174 | allows new filesystem to be developed and integrated without alteration |
---|
175 | to the basic framework. |
---|
176 | |
---|
177 | To provide the functional switching that is required, each of the POSIX |
---|
178 | file and directory functions have been implemented as a shell function. |
---|
179 | The shell function adheres to the POSIX interface standard. Within this |
---|
180 | functional shell, filesystem and node type information is accessed which |
---|
181 | is then used to invoke the appropriate filesystem and node type specific |
---|
182 | routine to process the POSIX function call. |
---|
183 | |
---|
184 | File/Device/Directory function access via file control block - rtems_libio_t structure |
---|
185 | -------------------------------------------------------------------------------------- |
---|
186 | |
---|
187 | The POSIX open() function returns an integer file descriptor that is used |
---|
188 | as a reference to file control block information for a specific file. The |
---|
189 | file control block contains information that is used to locate node, file |
---|
190 | system, mount table and functional handler information. The diagram in |
---|
191 | Figure 8 depicts the relationship between and among the following |
---|
192 | components. |
---|
193 | |
---|
194 | # File Descriptor Table |
---|
195 | This is an internal RTEMS structure that tracks all currently defined file |
---|
196 | descriptors in the system. The index that is returned by the file open() |
---|
197 | operation references a slot in this table. The slot contains a pointer to |
---|
198 | the file descriptor table entry for this file. The rtems_libio_t structure |
---|
199 | represents the file control block. |
---|
200 | |
---|
201 | # Allocation of entry in the File Descriptor Table |
---|
202 | Access to the file descriptor table is controlled through a semaphore that |
---|
203 | is implemented using the rtems_libio_allocate() function. This routine |
---|
204 | will grab a semaphore and then scan the file control blocks to determine |
---|
205 | which slot is free for use. The first free slot is marked as used and the |
---|
206 | index to this slot is returned as the file descriptor for the open() |
---|
207 | request. After the alterations have been made to the file control block |
---|
208 | table, the semaphore is released to allow further operations on the table. |
---|
209 | |
---|
210 | # Maximum number of entries in the file descriptor table is |
---|
211 | configurable through the src/exec/sapi/headers/confdefs.h file. If the |
---|
212 | CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS constant is defined its value |
---|
213 | will represent the maximum number of file descriptors that are allowed. |
---|
214 | If CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS is not specified a default |
---|
215 | value of 20 will be used as the maximum number of file descriptors |
---|
216 | allowed. |
---|
217 | |
---|
218 | # File control block - rtems_libio_t structure |
---|
219 | |
---|
220 | .. code:: c |
---|
221 | |
---|
222 | struct rtems_libio_tt { |
---|
223 | rtems_driver_name_t \*driver; |
---|
224 | off_t size; |
---|
225 | off_t offset; |
---|
226 | unsigned32 flags; |
---|
227 | rtems_filesystem_location_info_t pathinfo; |
---|
228 | Objects_Id sem; |
---|
229 | unsigned32 data0; |
---|
230 | void data1; |
---|
231 | void file_info; |
---|
232 | rtems_filesystem_file_handlers_r handlers; |
---|
233 | }; |
---|
234 | |
---|
235 | A file control block can exist for regular files, devices and directories. |
---|
236 | The following fields are important for regular file and directory access: |
---|
237 | |
---|
238 | - Size - For a file this represents the number of bytes currently |
---|
239 | stored in a file. For a directory this field is not filled in. |
---|
240 | |
---|
241 | - Offset - For a file this is the byte file position index relative to |
---|
242 | the start of the file. For a directory this is the byte offset into a |
---|
243 | sequence of dirent structures. |
---|
244 | |
---|
245 | - Pathinfo - This is a structure that provides a pointer to node |
---|
246 | information, OPS table functions, Handler functions and the mount table |
---|
247 | entry associated with this node. |
---|
248 | |
---|
249 | - file_info - A pointer to node information that is used by Handler |
---|
250 | functions |
---|
251 | |
---|
252 | - handlers - A pointer to a table of handler functions that operate on |
---|
253 | a file, device or directory through a file descriptor index |
---|
254 | |
---|
255 | File/Directory function access via rtems_filesystem_location_info_t structure |
---|
256 | ----------------------------------------------------------------------------- |
---|
257 | |
---|
258 | The rtems_filesystem_location_info_tt structure below provides sufficient |
---|
259 | information to process nodes under a mounted filesystem. |
---|
260 | |
---|
261 | .. code:: c |
---|
262 | |
---|
263 | struct rtems_filesystem_location_info_tt { |
---|
264 | void \*node_access; |
---|
265 | rtems_filesystem_file_handlers_r \*handlers; |
---|
266 | rtems_filesystem_operations_table \*ops; |
---|
267 | rtems_filesystem_mount_table_entry_t \*mt_entry; |
---|
268 | }; |
---|
269 | |
---|
270 | It contains a void pointer to filesystem specific nodal structure, |
---|
271 | pointers to the OPS table for the filesystem that contains the node, the |
---|
272 | node type specific handlers for the node and a reference pointer to the |
---|
273 | mount table entry associated with the filesystem containing the node |
---|
274 | |
---|
275 | Operation Tables |
---|
276 | ================ |
---|
277 | |
---|
278 | Filesystem specific operations are invoked indirectly. The set of |
---|
279 | routines that implement the filesystem are configured into two tables. |
---|
280 | The Filesystem Handler Table has routines that are specific to a |
---|
281 | filesystem but remain constant regardless of the actual file type. |
---|
282 | The File Handler Table has routines that are both filesystem and file type |
---|
283 | specific. |
---|
284 | |
---|
285 | Filesystem Handler Table Functions |
---|
286 | ---------------------------------- |
---|
287 | |
---|
288 | OPS table functions are defined in a ``rtems_filesystem_operations_table`` |
---|
289 | structure. It defines functions that are specific to a given filesystem. |
---|
290 | One table exists for each filesystem that is supported in the RTEMS |
---|
291 | configuration. The structure definition appears below and is followed by |
---|
292 | general developmental information on each of the functions contained in this |
---|
293 | function management structure. |
---|
294 | |
---|
295 | .. code:: c |
---|
296 | |
---|
297 | typedef struct { |
---|
298 | rtems_filesystem_evalpath_t evalpath; |
---|
299 | rtems_filesystem_evalmake_t evalformake; |
---|
300 | rtems_filesystem_link_t link; |
---|
301 | rtems_filesystem_unlink_t unlink; |
---|
302 | rtems_filesystem_node_type_t node_type; |
---|
303 | rtems_filesystem_mknod_t mknod; |
---|
304 | rtems_filesystem_rmnod_t rmnod; |
---|
305 | rtems_filesystem_chown_t chown; |
---|
306 | rtems_filesystem_freenode_t freenod; |
---|
307 | rtems_filesystem_mount_t mount; |
---|
308 | rtems_filesystem_fsmount_me_t fsmount_me; |
---|
309 | rtems_filesystem_unmount_t unmount; |
---|
310 | rtems_filesystem_fsunmount_me_t fsunmount_me; |
---|
311 | rtems_filesystem_utime_t utime; |
---|
312 | rtems_filesystem_evaluate_link_t eval_link; |
---|
313 | rtems_filesystem_symlink_t symlink; |
---|
314 | } rtems_filesystem_operations_table; |
---|
315 | |
---|
316 | .. COMMENT: @page |
---|
317 | |
---|
318 | evalpath Handler |
---|
319 | ~~~~~~~~~~~~~~~~ |
---|
320 | |
---|
321 | **Corresponding Structure Element:** |
---|
322 | |
---|
323 | evalpath |
---|
324 | |
---|
325 | **Arguments:** |
---|
326 | |
---|
327 | .. code:: c |
---|
328 | |
---|
329 | const char \*pathname, /* IN \*/ |
---|
330 | int flags, /* IN \*/ |
---|
331 | rtems_filesystem_location_info_t \*pathloc /* IN/OUT \*/ |
---|
332 | |
---|
333 | **Description:** |
---|
334 | |
---|
335 | This routine is responsible for evaluating the pathname passed in |
---|
336 | based upon the flags and the valid ``rthems_filesystem_location_info_t``. |
---|
337 | Additionally, it must make any changes to pathloc necessary to identify |
---|
338 | the pathname node. This should include calling the evalpath for a mounted |
---|
339 | filesystem, if the given filesystem supports the mount command. |
---|
340 | |
---|
341 | This routine returns a 0 if the evaluation was successful. |
---|
342 | Otherwise, it returns a -1 and sets errno to the correct error. |
---|
343 | |
---|
344 | This routine is required and should NOT be set to NULL. |
---|
345 | |
---|
346 | .. COMMENT: @page |
---|
347 | |
---|
348 | evalformake Handler |
---|
349 | ~~~~~~~~~~~~~~~~~~~ |
---|
350 | |
---|
351 | **Corresponding Structure Element:** |
---|
352 | |
---|
353 | evalformake |
---|
354 | |
---|
355 | **Arguments:** |
---|
356 | |
---|
357 | .. code:: c |
---|
358 | |
---|
359 | const char \*path, /* IN \*/ |
---|
360 | rtems_filesystem_location_info_t \*pathloc, /* IN/OUT \*/ |
---|
361 | const char \**name /* OUT \*/ |
---|
362 | |
---|
363 | **Description:** |
---|
364 | |
---|
365 | This method is given a path to evaluate and a valid start location. It |
---|
366 | is responsible for finding the parent node for a requested make command, |
---|
367 | setting pathloc information to identify the parent node, and setting |
---|
368 | the name pointer to the first character of the name of the new node. |
---|
369 | Additionally, if the filesystem supports the mount command, this method |
---|
370 | should call the evalformake routine for the mounted filesystem. |
---|
371 | |
---|
372 | This routine returns a 0 if the evaluation was successful. Otherwise, it |
---|
373 | returns a -1 and sets errno to the correct error. |
---|
374 | |
---|
375 | This routine is required and should NOT be set to NULL. However, if |
---|
376 | the filesystem does not support user creation of a new node, it may |
---|
377 | set errno to ENOSYS and return -1. |
---|
378 | |
---|
379 | .. COMMENT: @page |
---|
380 | |
---|
381 | link Handler |
---|
382 | ~~~~~~~~~~~~ |
---|
383 | |
---|
384 | **Corresponding Structure Element:** |
---|
385 | |
---|
386 | link |
---|
387 | |
---|
388 | **Arguments:** |
---|
389 | |
---|
390 | .. code:: c |
---|
391 | |
---|
392 | rtems_filesystem_location_info_t \*to_loc, /* IN \*/ |
---|
393 | rtems_filesystem_location_info_t \*parent_loc, /* IN \*/ |
---|
394 | const char \*token /* IN \*/ |
---|
395 | |
---|
396 | **Description:** |
---|
397 | |
---|
398 | This routine is used to create a hard-link. |
---|
399 | |
---|
400 | It will first examine the st_nlink count of the node that we are trying to. |
---|
401 | If the link count exceeds LINK_MAX an error will be returned. |
---|
402 | |
---|
403 | The name of the link will be normalized to remove extraneous separators from |
---|
404 | the end of the name. |
---|
405 | |
---|
406 | This routine is not required and may be set to NULL. |
---|
407 | |
---|
408 | .. COMMENT: @page |
---|
409 | |
---|
410 | unlink Handler |
---|
411 | ~~~~~~~~~~~~~~ |
---|
412 | |
---|
413 | **Corresponding Structure Element:** |
---|
414 | |
---|
415 | XXX |
---|
416 | |
---|
417 | **Arguments:** |
---|
418 | |
---|
419 | XXX |
---|
420 | |
---|
421 | **Description:** |
---|
422 | |
---|
423 | XXX |
---|
424 | |
---|
425 | .. COMMENT: @page |
---|
426 | |
---|
427 | node_type Handler |
---|
428 | ~~~~~~~~~~~~~~~~~ |
---|
429 | |
---|
430 | **Corresponding Structure Element:** |
---|
431 | |
---|
432 | node_type() |
---|
433 | |
---|
434 | **Arguments:** |
---|
435 | |
---|
436 | .. code:: c |
---|
437 | |
---|
438 | rtems_filesystem_location_info_t \*pathloc /* IN \*/ |
---|
439 | |
---|
440 | **Description:** |
---|
441 | |
---|
442 | XXX |
---|
443 | |
---|
444 | .. COMMENT: @page |
---|
445 | |
---|
446 | mknod Handler |
---|
447 | ~~~~~~~~~~~~~ |
---|
448 | |
---|
449 | **Corresponding Structure Element:** |
---|
450 | |
---|
451 | mknod() |
---|
452 | |
---|
453 | **Arguments:** |
---|
454 | |
---|
455 | .. code:: c |
---|
456 | |
---|
457 | const char \*token, /* IN \*/ |
---|
458 | mode_t mode, /* IN \*/ |
---|
459 | dev_t dev, /* IN \*/ |
---|
460 | rtems_filesystem_location_info_t \*pathloc /* IN/OUT \*/ |
---|
461 | |
---|
462 | **Description:** |
---|
463 | |
---|
464 | XXX |
---|
465 | |
---|
466 | .. COMMENT: @page |
---|
467 | |
---|
468 | rmnod Handler |
---|
469 | ~~~~~~~~~~~~~ |
---|
470 | |
---|
471 | **Corresponding Structure Element:** |
---|
472 | |
---|
473 | XXX |
---|
474 | |
---|
475 | **Arguments:** |
---|
476 | |
---|
477 | XXX |
---|
478 | |
---|
479 | **Description:** |
---|
480 | |
---|
481 | XXX |
---|
482 | |
---|
483 | .. COMMENT: @page |
---|
484 | |
---|
485 | chown Handler |
---|
486 | ~~~~~~~~~~~~~ |
---|
487 | |
---|
488 | **Corresponding Structure Element:** |
---|
489 | |
---|
490 | chown() |
---|
491 | |
---|
492 | **Arguments:** |
---|
493 | |
---|
494 | .. code:: c |
---|
495 | |
---|
496 | rtems_filesystem_location_info_t \*pathloc /* IN \*/ |
---|
497 | uid_t owner /* IN \*/ |
---|
498 | gid_t group /* IN \*/ |
---|
499 | |
---|
500 | **Description:** |
---|
501 | |
---|
502 | XXX |
---|
503 | |
---|
504 | .. COMMENT: @page |
---|
505 | |
---|
506 | freenod Handler |
---|
507 | ~~~~~~~~~~~~~~~ |
---|
508 | |
---|
509 | **Corresponding Structure Element:** |
---|
510 | |
---|
511 | freenod() |
---|
512 | |
---|
513 | **Arguments:** |
---|
514 | |
---|
515 | .. code:: c |
---|
516 | |
---|
517 | rtems_filesystem_location_info_t \*pathloc /* IN \*/ |
---|
518 | |
---|
519 | **Description:** |
---|
520 | |
---|
521 | This routine is used by the generic code to allow memory to be allocated |
---|
522 | during the evaluate routines, and set free when the generic code is finished |
---|
523 | accessing a node. If the evaluate routines allocate memory to identify |
---|
524 | a node this routine should be utilized to free that memory. |
---|
525 | |
---|
526 | This routine is not required and may be set to NULL. |
---|
527 | |
---|
528 | .. COMMENT: @page |
---|
529 | |
---|
530 | mount Handler |
---|
531 | ~~~~~~~~~~~~~ |
---|
532 | |
---|
533 | **Corresponding Structure Element:** |
---|
534 | |
---|
535 | mount() |
---|
536 | |
---|
537 | **Arguments:** |
---|
538 | |
---|
539 | .. code:: c |
---|
540 | |
---|
541 | rtems_filesystem_mount_table_entry_t \*mt_entry |
---|
542 | |
---|
543 | **Description:** |
---|
544 | |
---|
545 | XXX |
---|
546 | |
---|
547 | .. COMMENT: @page |
---|
548 | |
---|
549 | fsmount_me Handler |
---|
550 | ~~~~~~~~~~~~~~~~~~ |
---|
551 | |
---|
552 | **Corresponding Structure Element:** |
---|
553 | |
---|
554 | XXX |
---|
555 | |
---|
556 | **Arguments:** |
---|
557 | |
---|
558 | .. code:: c |
---|
559 | |
---|
560 | rtems_filesystem_mount_table_entry_t \*mt_entry |
---|
561 | |
---|
562 | **Description:** |
---|
563 | |
---|
564 | This function is provided with a filesystem to take care of the internal |
---|
565 | filesystem management details associated with mounting that filesystem |
---|
566 | under the RTEMS environment. |
---|
567 | |
---|
568 | It is not responsible for the mounting details associated the filesystem |
---|
569 | containing the mount point. |
---|
570 | |
---|
571 | The rtems_filesystem_mount_table_entry_t structure contains the key elements |
---|
572 | below: |
---|
573 | |
---|
574 | rtems_filesystem_location_info_t \*mt_point_node, |
---|
575 | |
---|
576 | This structure contains information about the mount point. This |
---|
577 | allows us to find the ops-table and the handling functions |
---|
578 | associated with the filesystem containing the mount point. |
---|
579 | |
---|
580 | rtems_filesystem_location_info_t \*fs_root_node, |
---|
581 | |
---|
582 | This structure contains information about the root node in the file |
---|
583 | system to be mounted. It allows us to find the ops-table and the |
---|
584 | handling functions associated with the filesystem to be mounted. |
---|
585 | |
---|
586 | rtems_filesystem_options_t options, |
---|
587 | |
---|
588 | Read only or read/write access |
---|
589 | |
---|
590 | void \*fs_info, |
---|
591 | |
---|
592 | This points to an allocated block of memory the will be used to |
---|
593 | hold any filesystem specific information of a global nature. This |
---|
594 | allocated region if important because it allows us to mount the |
---|
595 | same filesystem type more than once under the RTEMS system. |
---|
596 | Each instance of the mounted filesystem has its own set of global |
---|
597 | management information that is separate from the global |
---|
598 | management information associated with the other instances of the |
---|
599 | mounted filesystem type. |
---|
600 | |
---|
601 | rtems_filesystem_limits_and_options_t pathconf_info, |
---|
602 | |
---|
603 | The table contains the following set of values associated with the |
---|
604 | mounted filesystem: |
---|
605 | |
---|
606 | - link_max |
---|
607 | |
---|
608 | - max_canon |
---|
609 | |
---|
610 | - max_input |
---|
611 | |
---|
612 | - name_max |
---|
613 | |
---|
614 | - path_max |
---|
615 | |
---|
616 | - pipe_buf |
---|
617 | |
---|
618 | - posix_async_io |
---|
619 | |
---|
620 | - posix_chown_restrictions |
---|
621 | |
---|
622 | - posix_no_trunc |
---|
623 | |
---|
624 | - posix_prio_io |
---|
625 | |
---|
626 | - posix_sync_io |
---|
627 | |
---|
628 | - posix_vdisable |
---|
629 | |
---|
630 | These values are accessed with the pathconf() and the fpathconf () |
---|
631 | functions. |
---|
632 | |
---|
633 | const char \*dev |
---|
634 | |
---|
635 | The is intended to contain a string that identifies the device that contains |
---|
636 | the filesystem information. The filesystems that are currently implemented |
---|
637 | are memory based and don't require a device specification. |
---|
638 | |
---|
639 | If the mt_point_node.node_access is NULL then we are mounting the base file |
---|
640 | system. |
---|
641 | |
---|
642 | The routine will create a directory node for the root of the IMFS file |
---|
643 | system. |
---|
644 | |
---|
645 | The node will have read, write and execute permissions for owner, group and |
---|
646 | others. |
---|
647 | |
---|
648 | The node's name will be a null string. |
---|
649 | |
---|
650 | A filesystem information structure(fs_info) will be allocated and |
---|
651 | initialized for the IMFS filesystem. The fs_info pointer in the mount table |
---|
652 | entry will be set to point the filesystem information structure. |
---|
653 | |
---|
654 | The pathconf_info element of the mount table will be set to the appropriate |
---|
655 | table of path configuration constants (LIMITS_AND_OPTIONS). |
---|
656 | |
---|
657 | The fs_root_node structure will be filled in with the following: |
---|
658 | |
---|
659 | - pointer to the allocated root node of the filesystem |
---|
660 | |
---|
661 | - directory handlers for a directory node under the IMFS filesystem |
---|
662 | |
---|
663 | - OPS table functions for the IMFS |
---|
664 | |
---|
665 | A 0 will be returned to the calling routine if the process succeeded, |
---|
666 | otherwise a 1 will be returned. |
---|
667 | |
---|
668 | .. COMMENT: @page |
---|
669 | |
---|
670 | unmount Handler |
---|
671 | ~~~~~~~~~~~~~~~ |
---|
672 | |
---|
673 | **Corresponding Structure Element:** |
---|
674 | |
---|
675 | XXX |
---|
676 | |
---|
677 | **Arguments:** |
---|
678 | |
---|
679 | XXX |
---|
680 | |
---|
681 | **Description:** |
---|
682 | |
---|
683 | XXX |
---|
684 | |
---|
685 | .. COMMENT: @page |
---|
686 | |
---|
687 | fsunmount_me Handler |
---|
688 | ~~~~~~~~~~~~~~~~~~~~ |
---|
689 | |
---|
690 | **Corresponding Structure Element:** |
---|
691 | |
---|
692 | imfs_fsunmount_me() |
---|
693 | |
---|
694 | **Arguments:** |
---|
695 | |
---|
696 | .. code:: c |
---|
697 | |
---|
698 | rtems_filesystem_mount_table_entry_t \*mt_entry |
---|
699 | |
---|
700 | **Description:** |
---|
701 | |
---|
702 | XXX |
---|
703 | |
---|
704 | .. COMMENT: @page |
---|
705 | |
---|
706 | utime Handler |
---|
707 | ~~~~~~~~~~~~~ |
---|
708 | |
---|
709 | **Corresponding Structure Element:** |
---|
710 | |
---|
711 | XXX |
---|
712 | |
---|
713 | **Arguments:** |
---|
714 | |
---|
715 | XXX |
---|
716 | |
---|
717 | **Description:** |
---|
718 | |
---|
719 | XXX |
---|
720 | |
---|
721 | .. COMMENT: @page |
---|
722 | |
---|
723 | eval_link Handler |
---|
724 | ~~~~~~~~~~~~~~~~~ |
---|
725 | |
---|
726 | **Corresponding Structure Element:** |
---|
727 | |
---|
728 | XXX |
---|
729 | |
---|
730 | **Arguments:** |
---|
731 | |
---|
732 | XXX |
---|
733 | |
---|
734 | **Description:** |
---|
735 | |
---|
736 | XXX |
---|
737 | |
---|
738 | .. COMMENT: @page |
---|
739 | |
---|
740 | symlink Handler |
---|
741 | ~~~~~~~~~~~~~~~ |
---|
742 | |
---|
743 | **Corresponding Structure Element:** |
---|
744 | |
---|
745 | XXX |
---|
746 | |
---|
747 | **Arguments:** |
---|
748 | |
---|
749 | XXX |
---|
750 | |
---|
751 | **Description:** |
---|
752 | |
---|
753 | XXX |
---|
754 | |
---|
755 | .. COMMENT: @page |
---|
756 | |
---|
757 | File Handler Table Functions |
---|
758 | ---------------------------- |
---|
759 | |
---|
760 | Handler table functions are defined in a ``rtems_filesystem_file_handlers_r`` |
---|
761 | structure. It defines functions that are specific to a node type in a given |
---|
762 | filesystem. One table exists for each of the filesystem's node types. The |
---|
763 | structure definition appears below. It is followed by general developmental |
---|
764 | information on each of the functions associated with regular files contained |
---|
765 | in this function management structure. |
---|
766 | .. code:: c |
---|
767 | |
---|
768 | typedef struct { |
---|
769 | rtems_filesystem_open_t open; |
---|
770 | rtems_filesystem_close_t close; |
---|
771 | rtems_filesystem_read_t read; |
---|
772 | rtems_filesystem_write_t write; |
---|
773 | rtems_filesystem_ioctl_t ioctl; |
---|
774 | rtems_filesystem_lseek_t lseek; |
---|
775 | rtems_filesystem_fstat_t fstat; |
---|
776 | rtems_filesystem_fchmod_t fchmod; |
---|
777 | rtems_filesystem_ftruncate_t ftruncate; |
---|
778 | rtems_filesystem_fpathconf_t fpathconf; |
---|
779 | rtems_filesystem_fsync_t fsync; |
---|
780 | rtems_filesystem_fdatasync_t fdatasync; |
---|
781 | rtems_filesystem_fcntl_t fcntl; |
---|
782 | } rtems_filesystem_file_handlers_r; |
---|
783 | |
---|
784 | .. COMMENT: @page |
---|
785 | |
---|
786 | open Handler |
---|
787 | ~~~~~~~~~~~~ |
---|
788 | |
---|
789 | **Corresponding Structure Element:** |
---|
790 | |
---|
791 | open() |
---|
792 | |
---|
793 | **Arguments:** |
---|
794 | |
---|
795 | .. code:: c |
---|
796 | |
---|
797 | rtems_libio_t \*iop, |
---|
798 | const char \*pathname, |
---|
799 | unsigned32 flag, |
---|
800 | unsigned32 mode |
---|
801 | |
---|
802 | **Description:** |
---|
803 | |
---|
804 | XXX |
---|
805 | |
---|
806 | .. COMMENT: @page |
---|
807 | |
---|
808 | close Handler |
---|
809 | ~~~~~~~~~~~~~ |
---|
810 | |
---|
811 | **Corresponding Structure Element:** |
---|
812 | |
---|
813 | close() |
---|
814 | |
---|
815 | **Arguments:** |
---|
816 | |
---|
817 | .. code:: c |
---|
818 | |
---|
819 | rtems_libio_t \*iop |
---|
820 | |
---|
821 | **Description:** |
---|
822 | |
---|
823 | XXX |
---|
824 | |
---|
825 | **NOTES:** |
---|
826 | |
---|
827 | XXX |
---|
828 | |
---|
829 | .. COMMENT: @page |
---|
830 | |
---|
831 | read Handler |
---|
832 | ~~~~~~~~~~~~ |
---|
833 | |
---|
834 | **Corresponding Structure Element:** |
---|
835 | |
---|
836 | read() |
---|
837 | |
---|
838 | **Arguments:** |
---|
839 | |
---|
840 | .. code:: c |
---|
841 | |
---|
842 | rtems_libio_t \*iop, |
---|
843 | void \*buffer, |
---|
844 | unsigned32 count |
---|
845 | |
---|
846 | **Description:** |
---|
847 | |
---|
848 | XXX |
---|
849 | |
---|
850 | **NOTES:** |
---|
851 | |
---|
852 | XXX |
---|
853 | |
---|
854 | .. COMMENT: @page |
---|
855 | |
---|
856 | write Handler |
---|
857 | ~~~~~~~~~~~~~ |
---|
858 | |
---|
859 | **Corresponding Structure Element:** |
---|
860 | |
---|
861 | XXX |
---|
862 | |
---|
863 | **Arguments:** |
---|
864 | |
---|
865 | XXX |
---|
866 | |
---|
867 | **Description:** |
---|
868 | |
---|
869 | XXX |
---|
870 | |
---|
871 | **NOTES:** |
---|
872 | |
---|
873 | XXX |
---|
874 | |
---|
875 | .. COMMENT: @page |
---|
876 | |
---|
877 | ioctl Handler |
---|
878 | ~~~~~~~~~~~~~ |
---|
879 | |
---|
880 | **Corresponding Structure Element:** |
---|
881 | |
---|
882 | XXX |
---|
883 | |
---|
884 | **Arguments:** |
---|
885 | |
---|
886 | .. code:: c |
---|
887 | |
---|
888 | rtems_libio_t \*iop, |
---|
889 | unsigned32 command, |
---|
890 | void \*buffer |
---|
891 | |
---|
892 | **Description:** |
---|
893 | |
---|
894 | XXX |
---|
895 | |
---|
896 | **NOTES:** |
---|
897 | |
---|
898 | XXX |
---|
899 | |
---|
900 | .. COMMENT: @page |
---|
901 | |
---|
902 | lseek Handler |
---|
903 | ~~~~~~~~~~~~~ |
---|
904 | |
---|
905 | **Corresponding Structure Element:** |
---|
906 | |
---|
907 | lseek() |
---|
908 | |
---|
909 | **Arguments:** |
---|
910 | |
---|
911 | .. code:: c |
---|
912 | |
---|
913 | rtems_libio_t \*iop, |
---|
914 | off_t offset, |
---|
915 | int whence |
---|
916 | |
---|
917 | **Description:** |
---|
918 | |
---|
919 | XXX |
---|
920 | |
---|
921 | **NOTES:** |
---|
922 | |
---|
923 | XXX |
---|
924 | |
---|
925 | .. COMMENT: @page |
---|
926 | |
---|
927 | fstat Handler |
---|
928 | ~~~~~~~~~~~~~ |
---|
929 | |
---|
930 | **Corresponding Structure Element:** |
---|
931 | |
---|
932 | fstat() |
---|
933 | |
---|
934 | **Arguments:** |
---|
935 | |
---|
936 | .. code:: c |
---|
937 | |
---|
938 | rtems_filesystem_location_info_t \*loc, |
---|
939 | struct stat \*buf |
---|
940 | |
---|
941 | **Description:** |
---|
942 | |
---|
943 | The following information is extracted from the filesystem |
---|
944 | specific node and placed in the ``stat`` structure: |
---|
945 | |
---|
946 | - st_mode |
---|
947 | |
---|
948 | - st_nlink |
---|
949 | |
---|
950 | - st_ino |
---|
951 | |
---|
952 | - st_uid |
---|
953 | |
---|
954 | - st_gid |
---|
955 | |
---|
956 | - st_atime |
---|
957 | |
---|
958 | - st_mtime |
---|
959 | |
---|
960 | - st_ctime |
---|
961 | |
---|
962 | **NOTES:** |
---|
963 | |
---|
964 | Both the ``stat()`` and ``lstat()`` services are |
---|
965 | implemented directly using the ``fstat()`` handler. The |
---|
966 | difference in behavior is determined by how the path is evaluated |
---|
967 | prior to this handler being called on a particular |
---|
968 | file entity. |
---|
969 | |
---|
970 | The ``fstat()`` system call is implemented directly |
---|
971 | on top of this filesystem handler. |
---|
972 | |
---|
973 | .. COMMENT: @page |
---|
974 | |
---|
975 | fchmod Handler |
---|
976 | ~~~~~~~~~~~~~~ |
---|
977 | |
---|
978 | **Corresponding Structure Element:** |
---|
979 | |
---|
980 | fchmod() |
---|
981 | |
---|
982 | **Arguments:** |
---|
983 | |
---|
984 | .. code:: c |
---|
985 | |
---|
986 | rtems_libio_t \*iop |
---|
987 | mode_t mode |
---|
988 | |
---|
989 | **Description:** |
---|
990 | |
---|
991 | XXX |
---|
992 | |
---|
993 | **NOTES:** |
---|
994 | |
---|
995 | XXX |
---|
996 | |
---|
997 | .. COMMENT: @page |
---|
998 | |
---|
999 | ftruncate Handler |
---|
1000 | ~~~~~~~~~~~~~~~~~ |
---|
1001 | |
---|
1002 | **Corresponding Structure Element:** |
---|
1003 | |
---|
1004 | XXX |
---|
1005 | |
---|
1006 | **Arguments:** |
---|
1007 | |
---|
1008 | XXX |
---|
1009 | |
---|
1010 | **Description:** |
---|
1011 | |
---|
1012 | XXX |
---|
1013 | |
---|
1014 | **NOTES:** |
---|
1015 | |
---|
1016 | XXX |
---|
1017 | |
---|
1018 | fpathconf Handler |
---|
1019 | ~~~~~~~~~~~~~~~~~ |
---|
1020 | |
---|
1021 | **Corresponding Structure Element:** |
---|
1022 | |
---|
1023 | XXX |
---|
1024 | |
---|
1025 | **Arguments:** |
---|
1026 | |
---|
1027 | XXX |
---|
1028 | |
---|
1029 | **Description:** |
---|
1030 | |
---|
1031 | XXX |
---|
1032 | |
---|
1033 | **NOTES:** |
---|
1034 | |
---|
1035 | XXX |
---|
1036 | |
---|
1037 | .. COMMENT: @page |
---|
1038 | |
---|
1039 | fsync Handler |
---|
1040 | ~~~~~~~~~~~~~ |
---|
1041 | |
---|
1042 | **Corresponding Structure Element:** |
---|
1043 | |
---|
1044 | XXX |
---|
1045 | |
---|
1046 | **Arguments:** |
---|
1047 | |
---|
1048 | XXX |
---|
1049 | |
---|
1050 | **Description:** |
---|
1051 | |
---|
1052 | XXX |
---|
1053 | |
---|
1054 | **NOTES:** |
---|
1055 | |
---|
1056 | XXX |
---|
1057 | |
---|
1058 | .. COMMENT: @page |
---|
1059 | |
---|
1060 | fdatasync Handler |
---|
1061 | ~~~~~~~~~~~~~~~~~ |
---|
1062 | |
---|
1063 | **Corresponding Structure Element:** |
---|
1064 | |
---|
1065 | XXX |
---|
1066 | |
---|
1067 | **Arguments:** |
---|
1068 | |
---|
1069 | XXX |
---|
1070 | |
---|
1071 | **Description:** |
---|
1072 | |
---|
1073 | XXX |
---|
1074 | |
---|
1075 | **NOTES:** |
---|
1076 | |
---|
1077 | XXX |
---|
1078 | |
---|
1079 | .. COMMENT: @page |
---|
1080 | |
---|
1081 | fcntl Handler |
---|
1082 | ~~~~~~~~~~~~~ |
---|
1083 | |
---|
1084 | **Corresponding Structure Element:** |
---|
1085 | |
---|
1086 | XXX |
---|
1087 | |
---|
1088 | **Arguments:** |
---|
1089 | |
---|
1090 | XXX |
---|
1091 | |
---|
1092 | **Description:** |
---|
1093 | |
---|
1094 | XXX |
---|
1095 | |
---|
1096 | **NOTES:** |
---|
1097 | |
---|
1098 | XXX |
---|
1099 | |
---|
1100 | .. COMMENT: COPYRIGHT (c) 1988-2002. |
---|
1101 | |
---|
1102 | .. COMMENT: On-Line Applications Research Corporation (OAR). |
---|
1103 | |
---|
1104 | .. COMMENT: All rights reserved. |
---|
1105 | |
---|