1 | |
---|
2 | @chapter In-Memory Filesystem |
---|
3 | |
---|
4 | This chapter describes the In-Memory Filesystem. |
---|
5 | |
---|
6 | @section Filesystem Handler Table Functions |
---|
7 | |
---|
8 | OPS table functions are defined in a rtems_filesystem_operations_table |
---|
9 | structure. It defines functions that are specific to a given file system. |
---|
10 | One table exists for each file system that is supported in the RTEMS |
---|
11 | configuration. The structure definition appears below and is followed by |
---|
12 | general developmental information on each of the functions contained in this |
---|
13 | function management structure. |
---|
14 | |
---|
15 | @example |
---|
16 | typedef 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 | |
---|
48 | XXX |
---|
49 | |
---|
50 | @subheading Arguments: |
---|
51 | |
---|
52 | XXX |
---|
53 | |
---|
54 | @subheading File: |
---|
55 | |
---|
56 | XXX |
---|
57 | |
---|
58 | @subheading Development Comments: |
---|
59 | |
---|
60 | XXX |
---|
61 | |
---|
62 | |
---|
63 | @c |
---|
64 | @c |
---|
65 | @c |
---|
66 | |
---|
67 | @page |
---|
68 | |
---|
69 | @subsection evalformake() |
---|
70 | |
---|
71 | @subheading Slot Function: |
---|
72 | |
---|
73 | XXX |
---|
74 | |
---|
75 | @subheading Arguments: |
---|
76 | |
---|
77 | XXX |
---|
78 | |
---|
79 | @subheading File: |
---|
80 | |
---|
81 | XXX |
---|
82 | |
---|
83 | @subheading Development Comments: |
---|
84 | |
---|
85 | XXX |
---|
86 | |
---|
87 | |
---|
88 | @c |
---|
89 | @c |
---|
90 | @c |
---|
91 | |
---|
92 | @page |
---|
93 | |
---|
94 | @subsection link() |
---|
95 | |
---|
96 | @subheading Slot Function: |
---|
97 | |
---|
98 | link |
---|
99 | |
---|
100 | @subheading Arguments: |
---|
101 | |
---|
102 | |
---|
103 | @example |
---|
104 | rtems_filesystem_location_info_t *to_loc, /* IN */ |
---|
105 | rtems_filesystem_location_info_t *parent_loc, /* IN */ |
---|
106 | const char *token /* IN */ |
---|
107 | @end example |
---|
108 | |
---|
109 | @subheading File: |
---|
110 | |
---|
111 | imfs_link.c |
---|
112 | |
---|
113 | @subheading Development Comments: |
---|
114 | |
---|
115 | |
---|
116 | This routine is used in the IMFS file system to create a hard-link. |
---|
117 | |
---|
118 | It will first examine the st_nlink count of the node that we are trying to. |
---|
119 | If the link count exceeds LINK_MAX an error will be returned. |
---|
120 | |
---|
121 | The name of the link will be normalized to remove extraneous separators from |
---|
122 | the end of the name. |
---|
123 | |
---|
124 | IMFS_create_node will be used to create a file system node that will have the |
---|
125 | following 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 | |
---|
139 | If there was trouble allocating memory for the new node an error will be |
---|
140 | returned. |
---|
141 | |
---|
142 | The st_nlink count of the target node will be incremented to reflect the new |
---|
143 | link. |
---|
144 | |
---|
145 | The time fields of the link will be set to reflect the creation time of the |
---|
146 | hard-link. |
---|
147 | |
---|
148 | |
---|
149 | @c @c @c |
---|
150 | |
---|
151 | @page |
---|
152 | |
---|
153 | @subsection unlink() |
---|
154 | |
---|
155 | @subheading Slot Function: |
---|
156 | |
---|
157 | XXX |
---|
158 | |
---|
159 | @subheading Arguments: |
---|
160 | |
---|
161 | XXX |
---|
162 | |
---|
163 | @subheading File: |
---|
164 | |
---|
165 | XXX |
---|
166 | |
---|
167 | @subheading Development Comments: |
---|
168 | |
---|
169 | XXX |
---|
170 | |
---|
171 | |
---|
172 | @c |
---|
173 | @c |
---|
174 | @c |
---|
175 | |
---|
176 | @page |
---|
177 | |
---|
178 | @subsection node_type() |
---|
179 | |
---|
180 | @subheading Slot Function: |
---|
181 | |
---|
182 | IMFS_node_type() |
---|
183 | |
---|
184 | @subheading Arguments: |
---|
185 | |
---|
186 | @example |
---|
187 | rtems_filesystem_location_info_t *pathloc /* IN */ |
---|
188 | @end example |
---|
189 | |
---|
190 | @subheading File: |
---|
191 | |
---|
192 | imfs_ntype.c |
---|
193 | |
---|
194 | @subheading Development Comments: |
---|
195 | |
---|
196 | This routine will locate the IMFS_jnode_t structure that holds ownership |
---|
197 | information for the selected node in the file system. |
---|
198 | |
---|
199 | This structure is pointed to by pathloc->node_access. |
---|
200 | |
---|
201 | The 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 | |
---|
225 | IMFS_mknod() |
---|
226 | |
---|
227 | @subheading Arguments: |
---|
228 | |
---|
229 | @example |
---|
230 | const char *token, /* IN */ |
---|
231 | mode_t mode, /* IN */ |
---|
232 | dev_t dev, /* IN */ |
---|
233 | rtems_filesystem_location_info_t *pathloc /* IN/OUT */ |
---|
234 | @end example |
---|
235 | |
---|
236 | @subheading File: |
---|
237 | |
---|
238 | imfs_mknod.c |
---|
239 | |
---|
240 | @subheading Development Comments: |
---|
241 | |
---|
242 | This routine will examine the mode argument to determine is we are trying to |
---|
243 | create a directory, regular file and a device node. The creation of other |
---|
244 | node types is not permitted and will cause an assert. |
---|
245 | |
---|
246 | Memory space will be allocated for a @code{jnode} and the node will be set up |
---|
247 | according to the nodal type that was specified. The IMFS_create_node() |
---|
248 | function performs the allocation and setup of the node. |
---|
249 | |
---|
250 | The only problem that is currently reported is the lack of memory when we |
---|
251 | attempt 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 | |
---|
264 | XXX |
---|
265 | |
---|
266 | @subheading Arguments: |
---|
267 | |
---|
268 | XXX |
---|
269 | |
---|
270 | @subheading File: |
---|
271 | |
---|
272 | XXX |
---|
273 | |
---|
274 | @subheading Development Comments: |
---|
275 | |
---|
276 | XXX |
---|
277 | |
---|
278 | |
---|
279 | @c |
---|
280 | @c |
---|
281 | @c |
---|
282 | |
---|
283 | @page |
---|
284 | |
---|
285 | @subsection chown() |
---|
286 | |
---|
287 | @subheading Slot Function: |
---|
288 | |
---|
289 | IMFS_chown() |
---|
290 | |
---|
291 | @subheading Arguments: |
---|
292 | |
---|
293 | @example |
---|
294 | rtems_filesystem_location_info_t *pathloc /* IN */ |
---|
295 | uid_t owner /* IN */ |
---|
296 | gid_t group /* IN */ |
---|
297 | @end example |
---|
298 | |
---|
299 | @subheading File: |
---|
300 | |
---|
301 | imfs_chown.c |
---|
302 | |
---|
303 | @subheading Development Comments: |
---|
304 | |
---|
305 | This routine will locate the IMFS_jnode_t structure that holds ownership |
---|
306 | information for the selected node in the file system. |
---|
307 | |
---|
308 | This structure is pointed to by pathloc->node_access. |
---|
309 | |
---|
310 | The st_uid and st_gid fields of the node are then modified. Since this is a |
---|
311 | memory based file system, no further action is required to alter the |
---|
312 | ownership 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 | |
---|
326 | XXX |
---|
327 | |
---|
328 | @subheading Arguments: |
---|
329 | |
---|
330 | XXX |
---|
331 | |
---|
332 | @subheading File: |
---|
333 | |
---|
334 | XXX |
---|
335 | |
---|
336 | @subheading Development Comments: |
---|
337 | |
---|
338 | XXX |
---|
339 | |
---|
340 | |
---|
341 | @c |
---|
342 | @c |
---|
343 | @c |
---|
344 | |
---|
345 | @page |
---|
346 | |
---|
347 | @subsection mount() |
---|
348 | |
---|
349 | @subheading Slot Function: |
---|
350 | |
---|
351 | IMFS_mount() |
---|
352 | |
---|
353 | @subheading Arguments: |
---|
354 | |
---|
355 | @example |
---|
356 | rtems_filesystem_mount_table_entry_t *mt_entry |
---|
357 | @end example |
---|
358 | |
---|
359 | @subheading File: |
---|
360 | |
---|
361 | imfs_mount.c |
---|
362 | |
---|
363 | @subheading Development Comments: |
---|
364 | |
---|
365 | This routine provides the file system specific processing required to mount a |
---|
366 | file system for the system that contains the mount point. It will determine |
---|
367 | if the point that we are trying to mount onto is a node of IMFS_DIRECTORY |
---|
368 | type. |
---|
369 | |
---|
370 | If it is the node's info element is altered so that the info.directory.mt_fs |
---|
371 | element points to the mount table chain entry that is associated with the |
---|
372 | mounted file system at this point. The info.directory.mt_fs element can be |
---|
373 | examined to determine if a file system is mounted at a directory. If it is |
---|
374 | NULL, the directory does not serve as a mount point. A non-NULL entry |
---|
375 | indicates that the directory does serve as a mount point and the value of |
---|
376 | info.directory.mt_fs can be used to locate the mount table chain entry that |
---|
377 | describes 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 | |
---|
390 | IMFS_initialize() |
---|
391 | |
---|
392 | @subheading Arguments: |
---|
393 | |
---|
394 | @example |
---|
395 | rtems_filesystem_mount_table_entry_t *mt_entry |
---|
396 | @end example |
---|
397 | |
---|
398 | @subheading File: |
---|
399 | |
---|
400 | imfs_init.c |
---|
401 | |
---|
402 | @subheading Development Comments: |
---|
403 | |
---|
404 | This function is provided with a file system to take care of the internal |
---|
405 | file system management details associated with mounting that file system |
---|
406 | under the RTEMS environment. |
---|
407 | |
---|
408 | It is not responsible for the mounting details associated the file system |
---|
409 | containing the mount point. |
---|
410 | |
---|
411 | The rtems_filesystem_mount_table_entry_t structure contains the key elements |
---|
412 | below: |
---|
413 | |
---|
414 | rtems_filesystem_location_info_t *mt_point_node, |
---|
415 | |
---|
416 | This structure contains information about the mount point. This |
---|
417 | allows us to find the ops-table and the handling functions |
---|
418 | associated with the file system containing the mount point. |
---|
419 | |
---|
420 | rtems_filesystem_location_info_t *fs_root_node, |
---|
421 | |
---|
422 | This structure contains information about the root node in the file |
---|
423 | system to be mounted. It allows us to find the ops-table and the |
---|
424 | handling functions associated with the file system to be mounted. |
---|
425 | |
---|
426 | rtems_filesystem_options_t options, |
---|
427 | |
---|
428 | Read only or read/write access |
---|
429 | |
---|
430 | void *fs_info, |
---|
431 | |
---|
432 | This points to an allocated block of memory the will be used to |
---|
433 | hold any file system specific information of a global nature. This |
---|
434 | allocated region if important because it allows us to mount the |
---|
435 | same file system type more than once under the RTEMS system. |
---|
436 | Each instance of the mounted file system has its own set of global |
---|
437 | management information that is separate from the global |
---|
438 | management information associated with the other instances of the |
---|
439 | mounted file system type. |
---|
440 | |
---|
441 | rtems_filesystem_limits_and_options_t pathconf_info, |
---|
442 | |
---|
443 | The table contains the following set of values associated with the |
---|
444 | mounted 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 | |
---|
474 | These values are accessed with the pathconf() and the fpathconf () |
---|
475 | functions. |
---|
476 | |
---|
477 | const char *dev |
---|
478 | |
---|
479 | The is intended to contain a string that identifies the device that contains |
---|
480 | the file system information. The file systems that are currently implemented |
---|
481 | are memory based and don't require a device specification. |
---|
482 | |
---|
483 | If the mt_point_node.node_access is NULL then we are mounting the base file |
---|
484 | system. |
---|
485 | |
---|
486 | The routine will create a directory node for the root of the IMFS file |
---|
487 | system. |
---|
488 | |
---|
489 | The node will have read, write and execute permissions for owner, group and |
---|
490 | others. |
---|
491 | |
---|
492 | The node's name will be a null string. |
---|
493 | |
---|
494 | A file system information structure(fs_info) will be allocated and |
---|
495 | initialized for the IMFS file system. The fs_info pointer in the mount table |
---|
496 | entry will be set to point the file system information structure. |
---|
497 | |
---|
498 | The pathconf_info element of the mount table will be set to the appropriate |
---|
499 | table of path configuration constants ( IMFS_LIMITS_AND_OPTIONS ). |
---|
500 | |
---|
501 | The 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 | |
---|
513 | A 0 will be returned to the calling routine if the process succeeded, |
---|
514 | otherwise 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 | |
---|
527 | XXX |
---|
528 | |
---|
529 | @subheading Arguments: |
---|
530 | |
---|
531 | XXX |
---|
532 | |
---|
533 | @subheading File: |
---|
534 | |
---|
535 | XXX |
---|
536 | |
---|
537 | @subheading Development Comments: |
---|
538 | |
---|
539 | XXX |
---|
540 | |
---|
541 | |
---|
542 | @c |
---|
543 | @c |
---|
544 | @c |
---|
545 | |
---|
546 | @page |
---|
547 | |
---|
548 | @subsection fsunmount_me() |
---|
549 | |
---|
550 | @subheading Slot Function: |
---|
551 | |
---|
552 | imfs_fsunmount_me() |
---|
553 | |
---|
554 | @subheading Arguments: |
---|
555 | |
---|
556 | @example |
---|
557 | rtems_filesystem_mount_table_entry_t *mt_entry |
---|
558 | @end example |
---|
559 | |
---|
560 | @subheading File: |
---|
561 | |
---|
562 | imfs_fsunmount_me.c |
---|
563 | |
---|
564 | @subheading Development Comments: |
---|
565 | |
---|
566 | XXX |
---|
567 | |
---|
568 | |
---|
569 | @c |
---|
570 | @c |
---|
571 | @c |
---|
572 | |
---|
573 | @page |
---|
574 | |
---|
575 | @subsection utime() |
---|
576 | |
---|
577 | @subheading Slot Function: |
---|
578 | |
---|
579 | XXX |
---|
580 | |
---|
581 | @subheading Arguments: |
---|
582 | |
---|
583 | XXX |
---|
584 | |
---|
585 | @subheading File: |
---|
586 | |
---|
587 | XXX |
---|
588 | |
---|
589 | @subheading Development Comments: |
---|
590 | |
---|
591 | XXX |
---|
592 | |
---|
593 | |
---|
594 | @c |
---|
595 | @c |
---|
596 | @c |
---|
597 | |
---|
598 | @page |
---|
599 | |
---|
600 | @subsection eval_link() |
---|
601 | |
---|
602 | @subheading Slot Function: |
---|
603 | |
---|
604 | XXX |
---|
605 | |
---|
606 | @subheading Arguments: |
---|
607 | |
---|
608 | XXX |
---|
609 | |
---|
610 | @subheading File: |
---|
611 | |
---|
612 | XXX |
---|
613 | |
---|
614 | @subheading Development Comments: |
---|
615 | |
---|
616 | XXX |
---|
617 | |
---|
618 | @c |
---|
619 | @c |
---|
620 | @c |
---|
621 | @page |
---|
622 | @section Regular File Handler Table Functions |
---|
623 | |
---|
624 | Handler table functions are defined in a rtems_filesystem_file_handlers_r |
---|
625 | structure. It defines functions that are specific to a node type in a given |
---|
626 | file system. One table exists for each of the file system's node types. The |
---|
627 | structure definition appears below. It is followed by general developmental |
---|
628 | information on each of the functions associated with regular files contained |
---|
629 | in this function management structure. |
---|
630 | |
---|
631 | @example |
---|
632 | typedef 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 | |
---|
659 | memfile_open() |
---|
660 | |
---|
661 | @subheading Arguments: |
---|
662 | |
---|
663 | @example |
---|
664 | rtems_libio_t *iop, |
---|
665 | const char *pathname, |
---|
666 | unsigned32 flag, |
---|
667 | unsigned32 mode |
---|
668 | @end example |
---|
669 | |
---|
670 | @subheading File: |
---|
671 | |
---|
672 | memfile.c |
---|
673 | |
---|
674 | @subheading Development Comments: |
---|
675 | |
---|
676 | Currently this function is a shell. No meaningful processing is performed and |
---|
677 | a 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 | |
---|
689 | memfile_close() |
---|
690 | |
---|
691 | @subheading Arguments: |
---|
692 | |
---|
693 | @example |
---|
694 | rtems_libio_t *iop |
---|
695 | @end example |
---|
696 | |
---|
697 | @subheading File: |
---|
698 | |
---|
699 | memfile.c |
---|
700 | |
---|
701 | @subheading Development Comments: |
---|
702 | |
---|
703 | This routine is a dummy for regular files under the base file system. It |
---|
704 | performs a capture of the IMFS_jnode_t pointer from the file control block |
---|
705 | and 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 | |
---|
718 | memfile_read() |
---|
719 | |
---|
720 | @subheading Arguments: |
---|
721 | |
---|
722 | @example |
---|
723 | rtems_libio_t *iop, |
---|
724 | void *buffer, |
---|
725 | unsigned32 count |
---|
726 | @end example |
---|
727 | |
---|
728 | @subheading File: |
---|
729 | |
---|
730 | memfile.c |
---|
731 | |
---|
732 | @subheading Development Comments: |
---|
733 | |
---|
734 | This routine will determine the @code{jnode} that is associated with this file. |
---|
735 | |
---|
736 | It will then call IMFS_memfile_read() with the @code{jnode}, file position index, |
---|
737 | buffer and transfer count as arguments. |
---|
738 | |
---|
739 | IMFS_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 | |
---|
765 | XXX |
---|
766 | |
---|
767 | @subheading Arguments: |
---|
768 | |
---|
769 | XXX |
---|
770 | @subheading File: |
---|
771 | |
---|
772 | XXX |
---|
773 | |
---|
774 | @subheading Development Comments: |
---|
775 | |
---|
776 | XXX |
---|
777 | |
---|
778 | @c |
---|
779 | @c |
---|
780 | @c |
---|
781 | |
---|
782 | @page |
---|
783 | |
---|
784 | @subsection ioctl() for Regular Files |
---|
785 | |
---|
786 | @subheading Slot Function: |
---|
787 | |
---|
788 | XXX |
---|
789 | |
---|
790 | @subheading Arguments: |
---|
791 | |
---|
792 | @example |
---|
793 | rtems_libio_t *iop, |
---|
794 | unsigned32 command, |
---|
795 | void *buffer |
---|
796 | @end example |
---|
797 | |
---|
798 | @subheading File: |
---|
799 | |
---|
800 | memfile.c |
---|
801 | |
---|
802 | @subheading Development Comments: |
---|
803 | |
---|
804 | The current code is a placeholder for future development. The routine returns |
---|
805 | a 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 | |
---|
817 | Memfile_lseek() |
---|
818 | |
---|
819 | @subheading Arguments: |
---|
820 | |
---|
821 | @example |
---|
822 | rtems_libio_t *iop, |
---|
823 | off_t offset, |
---|
824 | int whence |
---|
825 | @end example |
---|
826 | |
---|
827 | @subheading File: |
---|
828 | |
---|
829 | memfile.c |
---|
830 | |
---|
831 | @subheading Development Comments: |
---|
832 | |
---|
833 | This routine make sure that the memory based file is sufficiently large to |
---|
834 | allow for the new file position index. |
---|
835 | |
---|
836 | The IMFS_memfile_extend() function is used to evaluate the current size of |
---|
837 | the memory file and allocate additional memory blocks if required by the new |
---|
838 | file 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 | |
---|
850 | IMFS_stat() |
---|
851 | |
---|
852 | @subheading Arguments: |
---|
853 | |
---|
854 | @example |
---|
855 | rtems_filesystem_location_info_t *loc, |
---|
856 | struct stat *buf |
---|
857 | @end example |
---|
858 | |
---|
859 | @subheading File: |
---|
860 | |
---|
861 | imfs_stat.c |
---|
862 | |
---|
863 | @subheading Development Comments: |
---|
864 | |
---|
865 | This routine actually performs status processing for both devices and regular |
---|
866 | files. |
---|
867 | |
---|
868 | The IMFS_jnode_t structure is referenced to determine the type of node under |
---|
869 | the file system. |
---|
870 | |
---|
871 | If the node is associated with a device, node information is extracted and |
---|
872 | transformed to set the st_dev element of the stat structure. |
---|
873 | |
---|
874 | If the node is a regular file, the size of the regular file is extracted from |
---|
875 | the node. |
---|
876 | |
---|
877 | This routine rejects other node types. |
---|
878 | |
---|
879 | The following information is extracted from the node and placed in the stat |
---|
880 | structure: |
---|
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 | |
---|
912 | IMFS_fchmod() |
---|
913 | |
---|
914 | @subheading Arguments: |
---|
915 | |
---|
916 | @example |
---|
917 | rtems_libio_t *iop |
---|
918 | mode_t mode |
---|
919 | @end example |
---|
920 | |
---|
921 | @subheading File: |
---|
922 | |
---|
923 | imfs_fchmod.c |
---|
924 | |
---|
925 | @subheading Development Comments: |
---|
926 | |
---|
927 | This routine will obtain the pointer to the IMFS_jnode_t structure from the |
---|
928 | information currently in the file control block. |
---|
929 | |
---|
930 | Based on configuration the routine will acquire the user ID from a call to |
---|
931 | getuid() or from the IMFS_jnode_t structure. |
---|
932 | |
---|
933 | It then checks to see if we have the ownership rights to alter the mode of |
---|
934 | the file. If the caller does not, an error code is returned. |
---|
935 | |
---|
936 | An additional test is performed to verify that the caller is not trying to |
---|
937 | alter the nature of the node. If the caller is attempting to alter more than |
---|
938 | the permissions associated with user group and other, an error is returned. |
---|
939 | |
---|
940 | If all the preconditions are met, the user, group and other fields are set |
---|
941 | based 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 | |
---|
953 | XXX |
---|
954 | |
---|
955 | @subheading Arguments: |
---|
956 | |
---|
957 | XXX |
---|
958 | @subheading File: |
---|
959 | |
---|
960 | XXX |
---|
961 | |
---|
962 | @subheading Development Comments: |
---|
963 | |
---|
964 | XXX |
---|
965 | |
---|
966 | @c |
---|
967 | @c |
---|
968 | @c |
---|
969 | |
---|
970 | @page |
---|
971 | |
---|
972 | @subsection fpathconf() for Regular Files |
---|
973 | |
---|
974 | @subheading Slot Function: |
---|
975 | |
---|
976 | NULL |
---|
977 | |
---|
978 | @subheading Arguments: |
---|
979 | |
---|
980 | Not Implemented |
---|
981 | |
---|
982 | @subheading File: |
---|
983 | |
---|
984 | Not Implemented |
---|
985 | |
---|
986 | @subheading Development Comments: |
---|
987 | |
---|
988 | Not 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 | |
---|
1001 | XXX |
---|
1002 | |
---|
1003 | @subheading Arguments: |
---|
1004 | |
---|
1005 | XXX |
---|
1006 | @subheading File: |
---|
1007 | |
---|
1008 | XXX |
---|
1009 | |
---|
1010 | @subheading Development Comments: |
---|
1011 | |
---|
1012 | XXX |
---|
1013 | |
---|
1014 | |
---|
1015 | @c |
---|
1016 | @c |
---|
1017 | @c |
---|
1018 | |
---|
1019 | @page |
---|
1020 | |
---|
1021 | @subsection fdatasync() for Regular Files |
---|
1022 | |
---|
1023 | @subheading Slot Function: |
---|
1024 | |
---|
1025 | XXX |
---|
1026 | |
---|
1027 | @subheading Arguments: |
---|
1028 | |
---|
1029 | XXX |
---|
1030 | @subheading File: |
---|
1031 | |
---|
1032 | XXX |
---|
1033 | |
---|
1034 | @subheading Development Comments: |
---|
1035 | |
---|
1036 | XXX |
---|
1037 | |
---|
1038 | @c |
---|
1039 | @c |
---|
1040 | @c |
---|
1041 | @page |
---|
1042 | @section Directory Handler Table Functions |
---|
1043 | |
---|
1044 | Handler table functions are defined in a rtems_filesystem_file_handlers_r |
---|
1045 | structure. It defines functions that are specific to a node type in a given |
---|
1046 | file system. One table exists for each of the file system's node types. The |
---|
1047 | structure definition appears below. It is followed by general developmental |
---|
1048 | information on each of the functions associated with directories contained in |
---|
1049 | this function management structure. |
---|
1050 | |
---|
1051 | @example |
---|
1052 | typedef 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 | |
---|
1079 | imfs_dir_open() |
---|
1080 | |
---|
1081 | @subheading Arguments: |
---|
1082 | |
---|
1083 | @example |
---|
1084 | rtems_libio_t *iop, |
---|
1085 | const char *pathname, |
---|
1086 | unsigned32 flag, |
---|
1087 | unsigned32 mode |
---|
1088 | @end example |
---|
1089 | |
---|
1090 | @subheading File: |
---|
1091 | |
---|
1092 | imfs_directory.c |
---|
1093 | |
---|
1094 | @subheading Development Comments: |
---|
1095 | |
---|
1096 | This routine will look into the file control block to find the @code{jnode} that |
---|
1097 | is associated with the directory. |
---|
1098 | |
---|
1099 | The routine will verify that the node is a directory. If its not a directory |
---|
1100 | an error code will be returned. |
---|
1101 | |
---|
1102 | If it is a directory, the offset in the file control block will be set to 0. |
---|
1103 | This 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 | |
---|
1115 | imfs_dir_close() |
---|
1116 | |
---|
1117 | @subheading Arguments: |
---|
1118 | |
---|
1119 | @example |
---|
1120 | rtems_libio_t *iop |
---|
1121 | @end example |
---|
1122 | |
---|
1123 | @subheading File: |
---|
1124 | |
---|
1125 | imfs_directory.c |
---|
1126 | |
---|
1127 | @subheading Development Comments: |
---|
1128 | |
---|
1129 | This routine is a dummy for directories under the base file system. It |
---|
1130 | immediately 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 | |
---|
1142 | imfs_dir_read |
---|
1143 | |
---|
1144 | @subheading Arguments: |
---|
1145 | |
---|
1146 | @example |
---|
1147 | rtems_libio_t *iop, |
---|
1148 | void *buffer, |
---|
1149 | unsigned32 count |
---|
1150 | @end example |
---|
1151 | |
---|
1152 | @subheading File: |
---|
1153 | |
---|
1154 | imfs_directory.c |
---|
1155 | |
---|
1156 | @subheading Development Comments: |
---|
1157 | |
---|
1158 | This routine will read a fixed number of directory entries from the current |
---|
1159 | directory offset. The number of directory bytes read will be returned from |
---|
1160 | this routine. |
---|
1161 | |
---|
1162 | |
---|
1163 | @c |
---|
1164 | @c |
---|
1165 | @c |
---|
1166 | |
---|
1167 | @page |
---|
1168 | |
---|
1169 | @subsection write() for Directories |
---|
1170 | |
---|
1171 | @subheading Slot Function: |
---|
1172 | |
---|
1173 | XXX |
---|
1174 | |
---|
1175 | @subheading Arguments: |
---|
1176 | |
---|
1177 | XXX |
---|
1178 | |
---|
1179 | @subheading File: |
---|
1180 | |
---|
1181 | XXX |
---|
1182 | |
---|
1183 | @subheading Development Comments: |
---|
1184 | |
---|
1185 | XXX |
---|
1186 | |
---|
1187 | @c |
---|
1188 | @c |
---|
1189 | @c |
---|
1190 | |
---|
1191 | @page |
---|
1192 | |
---|
1193 | @subsection ioctl() for Directories |
---|
1194 | |
---|
1195 | @subheading Slot Function: |
---|
1196 | |
---|
1197 | ioctl |
---|
1198 | |
---|
1199 | @subheading Arguments: |
---|
1200 | |
---|
1201 | |
---|
1202 | @subheading File: |
---|
1203 | |
---|
1204 | Not supported |
---|
1205 | |
---|
1206 | @subheading Development Comments: |
---|
1207 | |
---|
1208 | XXX |
---|
1209 | |
---|
1210 | @c |
---|
1211 | @c |
---|
1212 | @c |
---|
1213 | |
---|
1214 | @page |
---|
1215 | |
---|
1216 | @subsection lseek() for Directories |
---|
1217 | |
---|
1218 | @subheading Slot Function: |
---|
1219 | |
---|
1220 | imfs_dir_lseek() |
---|
1221 | |
---|
1222 | @subheading Arguments: |
---|
1223 | |
---|
1224 | @example |
---|
1225 | rtems_libio_t *iop, |
---|
1226 | off_t offset, |
---|
1227 | int whence |
---|
1228 | @end example |
---|
1229 | |
---|
1230 | @subheading File: |
---|
1231 | |
---|
1232 | imfs_directory.c |
---|
1233 | |
---|
1234 | @subheading Development Comments: |
---|
1235 | |
---|
1236 | This routine alters the offset in the file control block. |
---|
1237 | |
---|
1238 | No test is performed on the number of children under the current open |
---|
1239 | directory. The imfs_dir_read() function protects against reads beyond the |
---|
1240 | current size to the directory by returning a 0 bytes transfered to the |
---|
1241 | calling programs whenever the file position index exceeds the last entry in |
---|
1242 | the open directory. |
---|
1243 | |
---|
1244 | @c |
---|
1245 | @c |
---|
1246 | @c |
---|
1247 | |
---|
1248 | @page |
---|
1249 | |
---|
1250 | @subsection fstat() for Directories |
---|
1251 | |
---|
1252 | @subheading Slot Function: |
---|
1253 | |
---|
1254 | imfs_dir_fstat() |
---|
1255 | |
---|
1256 | @subheading Arguments: |
---|
1257 | |
---|
1258 | |
---|
1259 | @example |
---|
1260 | rtems_filesystem_location_info_t *loc, |
---|
1261 | struct stat *buf |
---|
1262 | @end example |
---|
1263 | |
---|
1264 | @subheading File: |
---|
1265 | |
---|
1266 | imfs_directory.c |
---|
1267 | |
---|
1268 | @subheading Development Comments: |
---|
1269 | |
---|
1270 | The node access information in the rtems_filesystem_location_info_t structure |
---|
1271 | is used to locate the appropriate IMFS_jnode_t structure. The following |
---|
1272 | information is taken from the IMFS_jnode_t structure and placed in the stat |
---|
1273 | structure: |
---|
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 | |
---|
1286 | The st_size field is obtained by running through the chain of directory |
---|
1287 | entries and summing the sizes of the dirent structures associated with each |
---|
1288 | of 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 | |
---|
1300 | IMFS_fchmod() |
---|
1301 | |
---|
1302 | @subheading Arguments: |
---|
1303 | |
---|
1304 | @example |
---|
1305 | rtems_libio_t *iop |
---|
1306 | mode_t mode |
---|
1307 | @end example |
---|
1308 | |
---|
1309 | @subheading File: |
---|
1310 | |
---|
1311 | imfs_fchmod.c |
---|
1312 | |
---|
1313 | @subheading Development Comments: |
---|
1314 | |
---|
1315 | This routine will obtain the pointer to the IMFS_jnode_t structure from the |
---|
1316 | information currently in the file control block. |
---|
1317 | |
---|
1318 | Based on configuration the routine will acquire the user ID from a call to |
---|
1319 | getuid() or from the IMFS_jnode_t structure. |
---|
1320 | |
---|
1321 | It then checks to see if we have the ownership rights to alter the mode of |
---|
1322 | the file. If the caller does not, an error code is returned. |
---|
1323 | |
---|
1324 | An additional test is performed to verify that the caller is not trying to |
---|
1325 | alter the nature of the node. If the caller is attempting to alter more than |
---|
1326 | the permissions associated with user group and other, an error is returned. |
---|
1327 | |
---|
1328 | If all the preconditions are met, the user, group and other fields are set |
---|
1329 | based 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 | |
---|
1341 | XXX |
---|
1342 | |
---|
1343 | @subheading Arguments: |
---|
1344 | |
---|
1345 | XXX |
---|
1346 | |
---|
1347 | @subheading File: |
---|
1348 | |
---|
1349 | XXX |
---|
1350 | |
---|
1351 | @subheading Development Comments: |
---|
1352 | |
---|
1353 | XXX |
---|
1354 | |
---|
1355 | @c |
---|
1356 | @c |
---|
1357 | @c |
---|
1358 | |
---|
1359 | @page |
---|
1360 | |
---|
1361 | @subsection fpathconf() for Directories |
---|
1362 | |
---|
1363 | @subheading Slot Function: |
---|
1364 | |
---|
1365 | fpathconf |
---|
1366 | |
---|
1367 | @subheading Arguments: |
---|
1368 | |
---|
1369 | Not Implemented |
---|
1370 | |
---|
1371 | @subheading File: |
---|
1372 | |
---|
1373 | Not Implemented |
---|
1374 | |
---|
1375 | @subheading Development Comments: |
---|
1376 | |
---|
1377 | Not Implemented |
---|
1378 | |
---|
1379 | |
---|
1380 | @c |
---|
1381 | @c |
---|
1382 | @c |
---|
1383 | |
---|
1384 | @page |
---|
1385 | |
---|
1386 | @subsection fsync() for Directories |
---|
1387 | |
---|
1388 | @subheading Slot Function: |
---|
1389 | |
---|
1390 | XXX |
---|
1391 | |
---|
1392 | @subheading Arguments: |
---|
1393 | |
---|
1394 | XXX |
---|
1395 | @subheading File: |
---|
1396 | |
---|
1397 | XXX |
---|
1398 | |
---|
1399 | @subheading Development Comments: |
---|
1400 | |
---|
1401 | XXX |
---|
1402 | |
---|
1403 | |
---|
1404 | @c |
---|
1405 | @c |
---|
1406 | @c |
---|
1407 | |
---|
1408 | @page |
---|
1409 | |
---|
1410 | @subsection fdatasync() for Directories |
---|
1411 | |
---|
1412 | @subheading Slot Function: |
---|
1413 | |
---|
1414 | XXX |
---|
1415 | |
---|
1416 | @subheading Arguments: |
---|
1417 | |
---|
1418 | XXX |
---|
1419 | |
---|
1420 | @subheading File: |
---|
1421 | |
---|
1422 | XXX |
---|
1423 | |
---|
1424 | @subheading Development Comments: |
---|
1425 | |
---|
1426 | XXX |
---|
1427 | |
---|
1428 | |
---|
1429 | @section Device Handler Table Functions |
---|
1430 | |
---|
1431 | Handler table functions are defined in a rtems_filesystem_file_handlers_r |
---|
1432 | structure. It defines functions that are specific to a node type in a given |
---|
1433 | file system. One table exists for each of the file system's node types. The |
---|
1434 | structure definition appears below. It is followed by general developmental |
---|
1435 | information on each of the functions associated with devices contained in |
---|
1436 | this function management structure. |
---|
1437 | |
---|
1438 | @example |
---|
1439 | typedef 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 | |
---|
1465 | device_open() |
---|
1466 | |
---|
1467 | @subheading Arguments: |
---|
1468 | |
---|
1469 | @example |
---|
1470 | rtems_libio_t *iop, |
---|
1471 | const char *pathname, |
---|
1472 | unsigned32 flag, |
---|
1473 | unsigned32 mode |
---|
1474 | @end example |
---|
1475 | |
---|
1476 | @subheading File: |
---|
1477 | |
---|
1478 | deviceio.c |
---|
1479 | |
---|
1480 | @subheading Development Comments: |
---|
1481 | |
---|
1482 | This routine will use the file control block to locate the node structure for |
---|
1483 | the device. |
---|
1484 | |
---|
1485 | It will extract the major and minor device numbers from the @code{jnode}. |
---|
1486 | |
---|
1487 | The major and minor device numbers will be used to make a rtems_io_open() |
---|
1488 | function call to open the device driver. An argument list is sent to the |
---|
1489 | driver 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 | |
---|
1501 | device_close() |
---|
1502 | |
---|
1503 | @subheading Arguments: |
---|
1504 | |
---|
1505 | @example |
---|
1506 | rtems_libio_t *iop |
---|
1507 | @end example |
---|
1508 | |
---|
1509 | @subheading File: |
---|
1510 | |
---|
1511 | deviceio.c |
---|
1512 | |
---|
1513 | @subheading Development Comments: |
---|
1514 | |
---|
1515 | This routine extracts the major and minor device driver numbers from the |
---|
1516 | IMFS_jnode_t that is referenced in the file control block. |
---|
1517 | |
---|
1518 | It also forms an argument list that contains the file control block. |
---|
1519 | |
---|
1520 | A rtems_io_close() function call is made to close the device specified by the |
---|
1521 | major 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 | |
---|
1534 | device_read() |
---|
1535 | |
---|
1536 | @subheading Arguments: |
---|
1537 | |
---|
1538 | @example |
---|
1539 | rtems_libio_t *iop, |
---|
1540 | void *buffer, |
---|
1541 | unsigned32 count |
---|
1542 | @end example |
---|
1543 | |
---|
1544 | @subheading File: |
---|
1545 | |
---|
1546 | deviceio.c |
---|
1547 | |
---|
1548 | @subheading Development Comments: |
---|
1549 | |
---|
1550 | This routine will extract the major and minor numbers for the device from the - |
---|
1551 | jnode- associated with the file descriptor. |
---|
1552 | |
---|
1553 | A rtems_io_read() call will be made to the device driver associated with the file |
---|
1554 | descriptor. The major and minor device number will be sent as arguments as well |
---|
1555 | as 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 |
---|
1565 | from the device |
---|
1566 | |
---|
1567 | @item flags from the file control block |
---|
1568 | |
---|
1569 | @end itemize |
---|
1570 | |
---|
1571 | On return from the rtems_io_read() the number of bytes that were actually |
---|
1572 | read 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 | |
---|
1585 | XXX |
---|
1586 | |
---|
1587 | @subheading Arguments: |
---|
1588 | |
---|
1589 | XXX |
---|
1590 | @subheading File: |
---|
1591 | |
---|
1592 | XXX |
---|
1593 | |
---|
1594 | @subheading Development Comments: |
---|
1595 | |
---|
1596 | XXX |
---|
1597 | |
---|
1598 | @c |
---|
1599 | @c |
---|
1600 | @c |
---|
1601 | |
---|
1602 | @page |
---|
1603 | |
---|
1604 | @subsection ioctl() for Devices |
---|
1605 | |
---|
1606 | @subheading Slot Function: |
---|
1607 | |
---|
1608 | ioctl |
---|
1609 | |
---|
1610 | @subheading Arguments: |
---|
1611 | |
---|
1612 | @example |
---|
1613 | rtems_libio_t *iop, |
---|
1614 | unsigned32 command, |
---|
1615 | void *buffer |
---|
1616 | @end example |
---|
1617 | |
---|
1618 | @subheading File: |
---|
1619 | |
---|
1620 | deviceio.c |
---|
1621 | |
---|
1622 | @subheading Development Comments: |
---|
1623 | |
---|
1624 | This handler will obtain status information about a device. |
---|
1625 | |
---|
1626 | The form of status is device dependent. |
---|
1627 | |
---|
1628 | The rtems_io_control() function uses the major and minor number of the device |
---|
1629 | to obtain the status information. |
---|
1630 | |
---|
1631 | rtems_io_control() requires an rtems_libio_ioctl_args_t argument list which |
---|
1632 | contains the file control block, device specific command and a buffer pointer |
---|
1633 | to return the device status information. |
---|
1634 | |
---|
1635 | The device specific command should indicate the nature of the information |
---|
1636 | that is desired from the device. |
---|
1637 | |
---|
1638 | After the rtems_io_control() is processed, the buffer should contain the |
---|
1639 | requested device information. |
---|
1640 | |
---|
1641 | If the device information is not obtained properly a -1 will be returned to |
---|
1642 | the 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 | |
---|
1654 | device_lseek() |
---|
1655 | |
---|
1656 | @subheading Arguments: |
---|
1657 | |
---|
1658 | @example |
---|
1659 | rtems_libio_t *iop, |
---|
1660 | off_t offset, |
---|
1661 | int whence |
---|
1662 | @end example |
---|
1663 | |
---|
1664 | @subheading File: |
---|
1665 | |
---|
1666 | deviceio.c |
---|
1667 | |
---|
1668 | @subheading Development Comments: |
---|
1669 | |
---|
1670 | At the present time this is a placeholder function. It always returns a |
---|
1671 | successful status. |
---|
1672 | |
---|
1673 | @c |
---|
1674 | @c |
---|
1675 | @c |
---|
1676 | |
---|
1677 | @page |
---|
1678 | |
---|
1679 | @subsection fstat() for Devices |
---|
1680 | |
---|
1681 | @subheading Slot Function: |
---|
1682 | |
---|
1683 | IMFS_stat() |
---|
1684 | |
---|
1685 | @subheading Arguments: |
---|
1686 | |
---|
1687 | @example |
---|
1688 | rtems_filesystem_location_info_t *loc, |
---|
1689 | struct stat *buf |
---|
1690 | @end example |
---|
1691 | |
---|
1692 | @subheading File: |
---|
1693 | |
---|
1694 | imfs_stat.c |
---|
1695 | |
---|
1696 | @subheading Development Comments: |
---|
1697 | |
---|
1698 | This routine actually performs status processing for both devices and regular files. |
---|
1699 | |
---|
1700 | The IMFS_jnode_t structure is referenced to determine the type of node under the |
---|
1701 | file system. |
---|
1702 | |
---|
1703 | If the node is associated with a device, node information is extracted and |
---|
1704 | transformed to set the st_dev element of the stat structure. |
---|
1705 | |
---|
1706 | If the node is a regular file, the size of the regular file is extracted from the node. |
---|
1707 | |
---|
1708 | This routine rejects other node types. |
---|
1709 | |
---|
1710 | The following information is extracted from the node and placed in the stat |
---|
1711 | structure: |
---|
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 | |
---|
1745 | IMFS_fchmod() |
---|
1746 | |
---|
1747 | @subheading Arguments: |
---|
1748 | |
---|
1749 | @example |
---|
1750 | rtems_libio_t *iop |
---|
1751 | mode_t mode |
---|
1752 | @end example |
---|
1753 | |
---|
1754 | @subheading File: |
---|
1755 | |
---|
1756 | imfs_fchmod.c |
---|
1757 | |
---|
1758 | @subheading Development Comments: |
---|
1759 | |
---|
1760 | This routine will obtain the pointer to the IMFS_jnode_t structure from the |
---|
1761 | information currently in the file control block. |
---|
1762 | |
---|
1763 | Based on configuration the routine will acquire the user ID from a call to |
---|
1764 | getuid() or from the IMFS_jnode_t structure. |
---|
1765 | |
---|
1766 | It then checks to see if we have the ownership rights to alter the mode of |
---|
1767 | the file. If the caller does not, an error code is returned. |
---|
1768 | |
---|
1769 | An additional test is performed to verify that the caller is not trying to |
---|
1770 | alter the nature of the node. If the caller is attempting to alter more than |
---|
1771 | the permissions associated with user group and other, an error is returned. |
---|
1772 | |
---|
1773 | If all the preconditions are met, the user, group and other fields are set |
---|
1774 | based 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 | |
---|
1787 | XXX |
---|
1788 | |
---|
1789 | @subheading Arguments: |
---|
1790 | |
---|
1791 | XXX |
---|
1792 | @subheading File: |
---|
1793 | |
---|
1794 | XXX |
---|
1795 | |
---|
1796 | @subheading Development Comments: |
---|
1797 | |
---|
1798 | XXX |
---|
1799 | |
---|
1800 | @c |
---|
1801 | @c |
---|
1802 | @c |
---|
1803 | |
---|
1804 | @page |
---|
1805 | |
---|
1806 | @subsection fpathconf() for Devices |
---|
1807 | |
---|
1808 | @subheading Slot Function: |
---|
1809 | |
---|
1810 | fpathconf |
---|
1811 | |
---|
1812 | @subheading Arguments: |
---|
1813 | |
---|
1814 | Not Implemented |
---|
1815 | |
---|
1816 | @subheading File: |
---|
1817 | |
---|
1818 | Not Implemented |
---|
1819 | |
---|
1820 | @subheading Development Comments: |
---|
1821 | |
---|
1822 | Not Implemented |
---|
1823 | |
---|
1824 | |
---|
1825 | @c |
---|
1826 | @c |
---|
1827 | @c |
---|
1828 | |
---|
1829 | @page |
---|
1830 | |
---|
1831 | @subsection fsync() for Devices |
---|
1832 | |
---|
1833 | @subheading Slot Function: |
---|
1834 | |
---|
1835 | XXX |
---|
1836 | |
---|
1837 | @subheading Arguments: |
---|
1838 | |
---|
1839 | XXX |
---|
1840 | |
---|
1841 | @subheading File: |
---|
1842 | |
---|
1843 | XXX |
---|
1844 | |
---|
1845 | @subheading Development Comments: |
---|
1846 | |
---|
1847 | XXX |
---|
1848 | |
---|
1849 | |
---|
1850 | @c |
---|
1851 | @c |
---|
1852 | @c |
---|
1853 | |
---|
1854 | @page |
---|
1855 | |
---|
1856 | @subsection fdatasync() for Devices |
---|
1857 | |
---|
1858 | Not Implemented |
---|
1859 | |
---|
1860 | @subheading Slot Function: |
---|
1861 | |
---|
1862 | XXX |
---|
1863 | |
---|
1864 | @subheading Arguments: |
---|
1865 | |
---|
1866 | XXX |
---|
1867 | |
---|
1868 | @subheading File: |
---|
1869 | |
---|
1870 | XXX |
---|
1871 | |
---|
1872 | @subheading Development Comments: |
---|
1873 | |
---|
1874 | XXX |
---|
1875 | |
---|