Changeset 7441fe2c in rtems
- Timestamp:
- 10/12/99 21:54:40 (23 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- fb02e4c4
- Parents:
- 482ffbb2
- Location:
- doc/filesystem
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/filesystem/Makefile
r482ffbb2 r7441fe2c 22 22 COMMON_FILES=../common/cpright.texi ../common/setup.texi 23 23 24 GENERATED_FILES= basefs.texi applayering.texipatheval.texi \25 init.texi mounting.texi lifecycle.texi imfs.texi \26 syscalls.texi basefs.texi24 GENERATED_FILES=patheval.texi \ 25 init.texi mounting.texi fsrequirements.texi imfs.texi \ 26 syscalls.texi 27 27 28 28 FILES= $(PROJECT).texi \ … … 54 54 cp $(PROJECT).dvi $(WWW_INSTALL)/$(PROJECT) 55 55 56 basefs.texi: basefs.t Makefile57 $(BMENU) -p "Preface" \58 -u "Top" \59 -n "" ${*}.t60 61 applayering.texi: applayering.t Makefile62 $(BMENU) -p "" \63 -u "Top" \64 -n "" ${*}.t65 66 56 patheval.texi: patheval.t Makefile 67 57 $(BMENU) -p "" \ … … 79 69 -n "" ${*}.t 80 70 81 lifecycle.texi: lifecycle.t Makefile71 fsrequirements.texi: fsrequirements.t Makefile 82 72 $(BMENU) -p "" \ 83 73 -u "Top" \ -
doc/filesystem/filesystem.texi
r482ffbb2 r7441fe2c 64 64 65 65 @include preface.texi 66 @include basefs.texi67 @include applayering.texi68 66 @include patheval.texi 69 67 @include init.texi 70 68 @include mounting.texi 71 @include lifecycle.texi69 @include fsrequirements.texi 72 70 @include imfs.texi 73 71 @include syscalls.texi … … 80 78 @menu 81 79 * Preface:: 82 * Base Filesystem::83 * Applications and Functional Layering::84 80 * Pathname Evaluation:: 85 81 * System Initialization:: 86 82 * Mounting and Unmounting Filesystems:: 87 * Filesystem Lifecycle::83 * Filesystem Requirements:: 88 84 * In-Memory Filesystem:: 89 85 * System Call Development Notes:: -
doc/filesystem/fsrequirements.t
r482ffbb2 r7441fe2c 13 13 implementations must adhere to. 14 14 15 @section Filesystem File and Directory Removal Constraints 15 @section General 16 17 The RTEMS filesystem framework was intended to be compliant with the 18 POSIX Files and Directories interface standard. The following filesystem 19 characteristics resulted in a functional switching layer. 20 21 @example 22 Figure of the Filesystem Functional Layering goes here. 23 This figure includes networking and disk caching layering. 24 @end example 25 26 @ifset use-ascii 27 @example 28 @group 29 @end group 30 @end example 31 @end ifset 32 33 @ifset use-tex 34 @c @image{FunctionalLayerCake,6in,4in} 35 @end ifset 36 37 @ifset use-html 38 @end ifset 39 40 @enumerate 41 42 @item Application programs are presented with a standard set of POSIX 43 compliant functions that allow them to interface with the files, devices 44 and directories in the filesystem. The interfaces to these routines do 45 not reflect the type of subordinate filesystem implementation in which 46 the file will be found. 47 48 @item The filesystem framework developed under RTEMS allows for mounting 49 filesystem of different types under the base filesystem. 50 51 @item The mechanics of locating file information may be quite different 52 between filesystem types. 53 54 @item The process of locating a file may require crossing filesystem 55 boundaries. 56 57 @item The transitions between filesystem and the processing required to 58 access information in different filesystem is not visible at the level 59 of the POSIX function call. 60 61 @item The POSIX interface standard provides file access by character 62 pathname to the file in some functions and through an integer file 63 descriptor in other functions. 64 65 @item The nature of the integer file descriptor and its associated 66 processing is operating system and filesystem specific. 67 68 @item Directory and device information must be processed with some of the 69 same routines that apply to files. 70 71 @item The form and content of directory and device information differs 72 greatly from that of a regular file. 73 74 @item Files, directories and devices represent elements (nodes) of a tree 75 hierarchy. 76 77 @item The rules for processing each of the node types that exist under the 78 filesystem are node specific but are still not reflected in the POSIX 79 interface routines. 80 81 @end enumerate 82 83 84 @example 85 Figure of the Filesystem Functional Layering goes here. 86 This figure focuses on the Base Filesystem and IMFS. 87 @end example 88 89 @example 90 Figure of the IMFS Memfile control blocks 91 @end example 92 93 @section File and Directory Removal Constraints 16 94 17 95 The following POSIX constraints must be honored by all filesystems. … … 33 111 @end itemize 34 112 113 @c 114 @c 115 @c 116 @section API Layering 117 118 @subsection Mapping of Generic System Calls to Filesystem Specific Functions 119 120 The list of generic system calls includes the routines open(), read(), 121 write(), close(), etc.. 122 123 The Files and Directories section of the POSIX Application Programs 124 Interface specifies a set of functions with calling arguments that are 125 used to gain access to the information in a filesystem. To the 126 application program, these functions allow access to information in any 127 mounted filesystem without explicit knowledge of the filesystem type or 128 the filesystem mount configuration. The following are functions that are 129 provided to the application: 130 131 @enumerate 132 @item access() 133 @item chdir() 134 @item chmod() 135 @item chown() 136 @item close() 137 @item closedir() 138 @item fchmod() 139 @item fcntl() 140 @item fdatasync() 141 @item fpathconf() 142 @item fstat() 143 @item fsync() 144 @item ftruncate() 145 @item link() 146 @item lseek() 147 @item mkdir() 148 @item mknod() 149 @item mount() 150 @item open() 151 @item opendir() 152 @item pathconf() 153 @item read() 154 @item readdir() 155 @item rewinddir() 156 @item rmdir() 157 @item rmnod() 158 @item scandir() 159 @item seekdir() 160 @item stat() 161 @item telldir() 162 @item umask() 163 @item unlink() 164 @item unmount() 165 @item utime() 166 @item write() 167 @end enumerate 168 169 The filesystem's type as well as the node type within the filesystem 170 determine the nature of the processing that must be performed for each of 171 the functions above. The RTEMS filesystem provides a framework that 172 allows new filesystem to be developed and integrated without alteration 173 to the basic framework. 174 175 To provide the functional switching that is required, each of the POSIX 176 file and directory functions have been implemented as a shell function. 177 The shell function adheres to the POSIX interface standard. Within this 178 functional shell, filesystem and node type information is accessed which 179 is then used to invoke the appropriate filesystem and node type specific 180 routine to process the POSIX function call. 181 182 @subsection File/Device/Directory function access via file control block - rtems_libio_t structure 183 184 The POSIX open() function returns an integer file descriptor that is used 185 as a reference to file control block information for a specific file. The 186 file control block contains information that is used to locate node, file 187 system, mount table and functional handler information. The diagram in 188 Figure 8 depicts the relationship between and among the following 189 components. 190 191 @enumerate 192 193 @item File Descriptor Table 194 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 @item Allocation of entry in the File Descriptor Table 202 203 Access to the file descriptor table is controlled through a semaphore that 204 is implemented using the rtems_libio_allocate() function. This routine 205 will grab a semaphore and then scan the file control blocks to determine 206 which slot is free for use. The first free slot is marked as used and the 207 index to this slot is returned as the file descriptor for the open() 208 request. After the alterations have been made to the file control block 209 table, the semaphore is released to allow further operations on the table. 210 211 @item Maximum number of entries in the file descriptor table is 212 configurable through the src/exec/sapi/headers/confdefs.h file. If the 213 CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS constant is defined its value 214 will represent the maximum number of file descriptors that are allowed. 215 If CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS is not specified a default 216 value of 20 will be used as the maximum number of file descriptors 217 allowed. 218 219 @item File control block - rtems_libio_t structure 220 221 @example 222 struct rtems_libio_tt @{ 223 rtems_driver_name_t *driver; 224 off_t size; /* size of file */ 225 off_t offset; /* current offset into file */ 226 unsigned32 flags; 227 rtems_filesystem_location_info_t pathinfo; 228 Objects_Id sem; 229 unsigned32 data0; /* private to "driver" */ 230 void data1; / . */ 231 void file_info; /used by file handlers/ 232 rtems_filesystem_file_handlers_r handlers; /type specific handlers/ 233 @}; 234 @end example 235 236 A file control block can exist for regular files, devices and directories. 237 The following fields are important for regular file and directory access: 238 239 @itemize @bullet 240 241 @item Size - For a file this represents the number of bytes currently 242 stored in a file. For a directory this field is not filled in. 243 244 @item Offset - For a file this is the byte file position index relative to 245 the start of the file. For a directory this is the byte offset into a 246 sequence of dirent structures. 247 248 @item Pathinfo - This is a structure that provides a pointer to node 249 information, OPS table functions, Handler functions and the mount table 250 entry associated with this node. 251 252 @item file_info - A pointer to node information that is used by Handler 253 functions 254 255 @item handlers - A pointer to a table of handler functions that operate on 256 a file, device or directory through a file descriptor index 257 258 @end itemize 259 260 @end enumerate 261 262 @subsection File/Directory function access via rtems_filesystem_location_info_t structure 263 264 The rtems_filesystem_location_info_tt structure below provides sufficient 265 information to process nodes under a mounted filesystem. 266 267 @example 268 struct rtems_filesystem_location_info_tt @{ 269 void *node_access; 270 rtems_filesystem_file_handlers_r *handlers; 271 rtems_filesystem_operations_table *ops; 272 rtems_filesystem_mount_table_entry_t *mt_entry; 273 @}; 274 @end example 275 276 It contains a void pointer to filesystem specific nodal structure, 277 pointers to the OPS table for the filesystem that contains the node, the 278 node type specific handlers for the node and a reference pointer to the 279 mount table entry associated with the filesystem containing the node 280 281 @section Operation Tables 282 283 Filesystem specific operations are invoked indirectly. The set of 284 routines that implement the filesystem are configured into two tables. 285 The Filesystem Handler Table has routines that are specific to a 286 filesystem but remain constant regardless of the actual file type. 287 The File Handler Table has routines that are both filesystem and file type 288 specific. 289 290 @subsection Filesystem Handler Table Functions 291 292 OPS table functions are defined in a @code{rtems_filesystem_operations_table} 293 structure. It defines functions that are specific to a given filesystem. 294 One table exists for each filesystem that is supported in the RTEMS 295 configuration. The structure definition appears below and is followed by 296 general developmental information on each of the functions contained in this 297 function management structure. 298 299 @example 300 typedef struct @{ 301 rtems_filesystem_evalpath_t evalpath; 302 rtems_filesystem_evalmake_t evalformake; 303 rtems_filesystem_link_t link; 304 rtems_filesystem_unlink_t unlink; 305 rtems_filesystem_node_type_t node_type; 306 rtems_filesystem_mknod_t mknod; 307 rtems_filesystem_rmnod_t rmnod; 308 rtems_filesystem_chown_t chown; 309 rtems_filesystem_freenode_t freenod; 310 rtems_filesystem_mount_t mount; 311 rtems_filesystem_fsmount_me_t fsmount_me; 312 rtems_filesystem_unmount_t unmount; 313 rtems_filesystem_fsunmount_me_t fsunmount_me; 314 rtems_filesystem_utime_t utime; 315 rtems_filesystem_evaluate_link_t eval_link; 316 rtems_filesystem_symlink_t symlink; 317 @} rtems_filesystem_operations_table; 318 @end example 319 320 @c 321 @c 322 @c 323 @page 324 325 @subsubsection evalpath Handler 326 327 @subheading Corresponding Structure Element: 328 329 XXX 330 331 @subheading Arguments: 332 333 XXX 334 335 @subheading File: 336 337 XXX 338 339 @subheading Description: 340 341 XXX 342 343 344 @c 345 @c 346 @c 347 @page 348 349 @subsubsection evalformake Handler 350 351 @subheading Corresponding Structure Element: 352 353 XXX 354 355 @subheading Arguments: 356 357 XXX 358 359 @subheading File: 360 361 XXX 362 363 @subheading Description: 364 365 XXX 366 367 368 @c 369 @c 370 @c 371 @page 372 373 @subsubsection link Handler 374 375 @subheading Corresponding Structure Element: 376 377 link 378 379 @subheading Arguments: 380 381 382 @example 383 rtems_filesystem_location_info_t *to_loc, /* IN */ 384 rtems_filesystem_location_info_t *parent_loc, /* IN */ 385 const char *token /* IN */ 386 @end example 387 388 @subheading File: 389 390 imfs_link.c 391 392 @subheading Description: 393 394 395 This routine is used to create a hard-link. 396 397 It will first examine the st_nlink count of the node that we are trying to. 398 If the link count exceeds LINK_MAX an error will be returned. 399 400 The name of the link will be normalized to remove extraneous separators from 401 the end of the name. 402 403 @c 404 @c 405 @c 406 @page 407 408 @subsubsection unlink Handler 409 410 @subheading Corresponding Structure Element: 411 412 XXX 413 414 @subheading Arguments: 415 416 XXX 417 418 @subheading File: 419 420 XXX 421 422 @subheading Description: 423 424 XXX 425 426 427 @c 428 @c 429 @c 430 @page 431 432 @subsubsection node_type Handler 433 434 @subheading Corresponding Structure Element: 435 436 node_type() 437 438 @subheading Arguments: 439 440 @example 441 rtems_filesystem_location_info_t *pathloc /* IN */ 442 @end example 443 444 @subheading File: 445 446 imfs_ntype.c 447 448 @subheading Description: 449 450 XXX 451 452 @c 453 @c 454 @c 455 @page 456 457 @subsubsection mknod Handler 458 459 @subheading Corresponding Structure Element: 460 461 mknod() 462 463 @subheading Arguments: 464 465 @example 466 const char *token, /* IN */ 467 mode_t mode, /* IN */ 468 dev_t dev, /* IN */ 469 rtems_filesystem_location_info_t *pathloc /* IN/OUT */ 470 @end example 471 472 @subheading File: 473 474 mknod.c 475 476 @subheading Description: 477 478 XXX 479 480 @c 481 @c 482 @c 483 @page 484 485 @subsubsection rmnod Handler 486 487 @subheading Corresponding Structure Element: 488 489 XXX 490 491 @subheading Arguments: 492 493 XXX 494 495 @subheading File: 496 497 XXX 498 499 @subheading Description: 500 501 XXX 502 503 504 @c 505 @c 506 @c 507 @page 508 509 @subsubsection chown Handler 510 511 @subheading Corresponding Structure Element: 512 513 chown() 514 515 @subheading Arguments: 516 517 @example 518 rtems_filesystem_location_info_t *pathloc /* IN */ 519 uid_t owner /* IN */ 520 gid_t group /* IN */ 521 @end example 522 523 @subheading File: 524 525 imfs_chown.c 526 527 @subheading Description: 528 529 XXX 530 531 @c 532 @c 533 @c 534 @page 535 536 @subsubsection freenod Handler 537 538 @subheading Corresponding Structure Element: 539 540 XXX 541 542 @subheading Arguments: 543 544 XXX 545 546 @subheading File: 547 548 XXX 549 550 @subheading Description: 551 552 XXX 553 554 555 @c 556 @c 557 @c 558 @page 559 560 @subsubsection mount Handler 561 562 @subheading Corresponding Structure Element: 563 564 mount() 565 566 @subheading Arguments: 567 568 @example 569 rtems_filesystem_mount_table_entry_t *mt_entry 570 @end example 571 572 @subheading File: 573 574 mount.c 575 576 @subheading Description: 577 578 XXX 579 580 @c 581 @c 582 @c 583 @page 584 585 @subsubsection fsmount_me Handler 586 587 @subheading Corresponding Structure Element: 588 589 XXX 590 591 @subheading Arguments: 592 593 @example 594 rtems_filesystem_mount_table_entry_t *mt_entry 595 @end example 596 597 @subheading File: 598 599 XXX 600 601 @subheading Description: 602 603 This function is provided with a filesystem to take care of the internal 604 filesystem management details associated with mounting that filesystem 605 under the RTEMS environment. 606 607 It is not responsible for the mounting details associated the filesystem 608 containing the mount point. 609 610 The rtems_filesystem_mount_table_entry_t structure contains the key elements 611 below: 612 613 rtems_filesystem_location_info_t *mt_point_node, 614 615 This structure contains information about the mount point. This 616 allows us to find the ops-table and the handling functions 617 associated with the filesystem containing the mount point. 618 619 rtems_filesystem_location_info_t *fs_root_node, 620 621 This structure contains information about the root node in the file 622 system to be mounted. It allows us to find the ops-table and the 623 handling functions associated with the filesystem to be mounted. 624 625 rtems_filesystem_options_t options, 626 627 Read only or read/write access 628 629 void *fs_info, 630 631 This points to an allocated block of memory the will be used to 632 hold any filesystem specific information of a global nature. This 633 allocated region if important because it allows us to mount the 634 same filesystem type more than once under the RTEMS system. 635 Each instance of the mounted filesystem has its own set of global 636 management information that is separate from the global 637 management information associated with the other instances of the 638 mounted filesystem type. 639 640 rtems_filesystem_limits_and_options_t pathconf_info, 641 642 The table contains the following set of values associated with the 643 mounted filesystem: 644 645 @itemize @bullet 646 647 @item link_max 648 649 @item max_canon 650 651 @item max_input 652 653 @item name_max 654 655 @item path_max 656 657 @item pipe_buf 658 659 @item posix_async_io 660 661 @item posix_chown_restrictions 662 663 @item posix_no_trunc 664 665 @item posix_prio_io 666 667 @item posix_sync_io 668 669 @item posix_vdisable 670 671 @end itemize 672 673 These values are accessed with the pathconf() and the fpathconf () 674 functions. 675 676 const char *dev 677 678 The is intended to contain a string that identifies the device that contains 679 the filesystem information. The filesystems that are currently implemented 680 are memory based and don't require a device specification. 681 682 If the mt_point_node.node_access is NULL then we are mounting the base file 683 system. 684 685 The routine will create a directory node for the root of the IMFS file 686 system. 687 688 The node will have read, write and execute permissions for owner, group and 689 others. 690 691 The node's name will be a null string. 692 693 A filesystem information structure(fs_info) will be allocated and 694 initialized for the IMFS filesystem. The fs_info pointer in the mount table 695 entry will be set to point the filesystem information structure. 696 697 The pathconf_info element of the mount table will be set to the appropriate 698 table of path configuration constants (LIMITS_AND_OPTIONS). 699 700 The fs_root_node structure will be filled in with the following: 701 702 @itemize @bullet 703 704 @item pointer to the allocated root node of the filesystem 705 706 @item directory handlers for a directory node under the IMFS filesystem 707 708 @item OPS table functions for the IMFS 709 710 @end itemize 711 712 A 0 will be returned to the calling routine if the process succeeded, 713 otherwise a 1 will be returned. 714 715 716 @c 717 @c 718 @c 719 @page 720 721 @subsubsection unmount Handler 722 723 @subheading Corresponding Structure Element: 724 725 XXX 726 727 @subheading Arguments: 728 729 XXX 730 731 @subheading File: 732 733 XXX 734 735 @subheading Description: 736 737 XXX 738 739 740 @c 741 @c 742 @c 743 @page 744 745 @subsubsection fsunmount_me Handler 746 747 @subheading Corresponding Structure Element: 748 749 imfs_fsunmount_me() 750 751 @subheading Arguments: 752 753 @example 754 rtems_filesystem_mount_table_entry_t *mt_entry 755 @end example 756 757 @subheading File: 758 759 imfs_fsunmount_me.c 760 761 @subheading Description: 762 763 XXX 764 765 766 @c 767 @c 768 @c 769 @page 770 771 @subsubsection utime Handler 772 773 @subheading Corresponding Structure Element: 774 775 XXX 776 777 @subheading Arguments: 778 779 XXX 780 781 @subheading File: 782 783 XXX 784 785 @subheading Description: 786 787 XXX 788 789 @c 790 @c 791 @c 792 @page 793 794 @subsubsection eval_link Handler 795 796 @subheading Corresponding Structure Element: 797 798 XXX 799 800 @subheading Arguments: 801 802 XXX 803 804 @subheading File: 805 806 XXX 807 808 @subheading Description: 809 810 XXX 811 812 @c 813 @c 814 @c 815 @page 816 817 @subsubsection symlink Handler 818 819 @subheading Corresponding Structure Element: 820 821 XXX 822 823 @subheading Arguments: 824 825 XXX 826 827 @subheading File: 828 829 XXX 830 831 @subheading Description: 832 833 XXX 834 835 @c 836 @c 837 @c 838 @page 839 @subsection File Handler Table Functions 840 841 Handler table functions are defined in a @code{rtems_filesystem_file_handlers_r} 842 structure. It defines functions that are specific to a node type in a given 843 filesystem. One table exists for each of the filesystem's node types. The 844 structure definition appears below. It is followed by general developmental 845 information on each of the functions associated with regular files contained 846 in this function management structure. 847 848 @example 849 typedef struct @{ 850 rtems_filesystem_open_t open; 851 rtems_filesystem_close_t close; 852 rtems_filesystem_read_t read; 853 rtems_filesystem_write_t write; 854 rtems_filesystem_ioctl_t ioctl; 855 rtems_filesystem_lseek_t lseek; 856 rtems_filesystem_fstat_t fstat; 857 rtems_filesystem_fchmod_t fchmod; 858 rtems_filesystem_ftruncate_t ftruncate; 859 rtems_filesystem_fpathconf_t fpathconf; 860 rtems_filesystem_fsync_t fsync; 861 rtems_filesystem_fdatasync_t fdatasync; 862 rtems_filesystem_fcntl_t fcntl; 863 @} rtems_filesystem_file_handlers_r; 864 @end example 865 866 @c 867 @c 868 @c 869 @page 870 871 @subsubsection open Handler 872 873 @subheading Corresponding Structure Element: 874 875 open() 876 877 @subheading Arguments: 878 879 @example 880 rtems_libio_t *iop, 881 const char *pathname, 882 unsigned32 flag, 883 unsigned32 mode 884 @end example 885 886 @subheading File: 887 888 XXX 889 890 @subheading Description: 891 892 XXX 893 894 @c 895 @c 896 @c 897 @page 898 899 @subsubsection close Handler 900 901 @subheading Corresponding Structure Element: 902 903 close() 904 905 @subheading Arguments: 906 907 @example 908 rtems_libio_t *iop 909 @end example 910 911 @subheading File: 912 913 XXX 914 915 @subheading Description: 916 917 XXX 918 919 @subheading NOTES: 920 921 XXX 922 923 924 925 @c 926 @c 927 @c 928 @page 929 930 @subsubsection read Handler 931 932 @subheading Corresponding Structure Element: 933 934 read() 935 936 @subheading Arguments: 937 938 @example 939 rtems_libio_t *iop, 940 void *buffer, 941 unsigned32 count 942 @end example 943 944 @subheading File: 945 946 XXX 947 948 @subheading Description: 949 950 XXX 951 952 @subheading NOTES: 953 954 XXX 955 956 957 @c 958 @c 959 @c 960 @page 961 962 @subsubsection write Handler 963 964 @subheading Corresponding Structure Element: 965 966 XXX 967 968 @subheading Arguments: 969 970 XXX 971 @subheading File: 972 973 XXX 974 975 @subheading Description: 976 977 XXX 978 979 @subheading NOTES: 980 981 XXX 982 983 984 @c 985 @c 986 @c 987 @page 988 989 @subsubsection ioctl Handler 990 991 @subheading Corresponding Structure Element: 992 993 XXX 994 995 @subheading Arguments: 996 997 @example 998 rtems_libio_t *iop, 999 unsigned32 command, 1000 void *buffer 1001 @end example 1002 1003 @subheading File: 1004 1005 XXX 1006 1007 @subheading Description: 1008 1009 XXX 1010 1011 @subheading NOTES: 1012 1013 XXX 1014 1015 1016 @c 1017 @c 1018 @c 1019 @page 1020 1021 @subsubsection lseek Handler 1022 1023 @subheading Corresponding Structure Element: 1024 1025 lseek() 1026 1027 @subheading Arguments: 1028 1029 @example 1030 rtems_libio_t *iop, 1031 off_t offset, 1032 int whence 1033 @end example 1034 1035 @subheading File: 1036 1037 XXX 1038 1039 @subheading Description: 1040 1041 XXX 1042 1043 @subheading NOTES: 1044 1045 XXX 1046 1047 1048 @c 1049 @c 1050 @c 1051 @page 1052 1053 @subsubsection fstat Handler 1054 1055 @subheading Corresponding Structure Element: 1056 1057 fstat() 1058 1059 @subheading Arguments: 1060 1061 @example 1062 rtems_filesystem_location_info_t *loc, 1063 struct stat *buf 1064 @end example 1065 1066 @subheading File: 1067 1068 XXX 1069 1070 @subheading Description: 1071 1072 The following information is extracted from the filesystem 1073 specific node and placed in the @code{stat} structure: 1074 1075 @itemize @bullet 1076 1077 @item st_mode 1078 1079 @item st_nlink 1080 1081 @item st_ino 1082 1083 @item st_uid 1084 1085 @item st_gid 1086 1087 @item st_atime 1088 1089 @item st_mtime 1090 1091 @item st_ctime 1092 1093 @end itemize 1094 1095 1096 @subheading NOTES: 1097 1098 XXX 1099 1100 @c 1101 @c 1102 @c 1103 @page 1104 1105 @subsubsection fchmod Handler 1106 1107 @subheading Corresponding Structure Element: 1108 1109 fchmod() 1110 1111 @subheading Arguments: 1112 1113 @example 1114 rtems_libio_t *iop 1115 mode_t mode 1116 @end example 1117 1118 @subheading File: 1119 1120 imfs_fchmod.c 1121 1122 @subheading Description: 1123 1124 XXX 1125 1126 1127 @subheading NOTES: 1128 1129 XXX 1130 1131 @c 1132 @c 1133 @c 1134 @page 1135 1136 @subsubsection ftruncate Handler 1137 1138 @subheading Corresponding Structure Element: 1139 1140 XXX 1141 1142 @subheading Arguments: 1143 1144 XXX 1145 @subheading File: 1146 1147 XXX 1148 1149 @subheading Description: 1150 1151 XXX 1152 1153 @subheading NOTES: 1154 1155 XXX 1156 1157 @subsubsection fpathconf Handler 1158 1159 @subheading Corresponding Structure Element: 1160 1161 XXX 1162 1163 @subheading Arguments: 1164 1165 XXX 1166 1167 @subheading File: 1168 1169 XXX 1170 1171 @subheading Description: 1172 1173 XXX 1174 1175 @subheading NOTES: 1176 1177 XXX 1178 1179 @c 1180 @c 1181 @c 1182 @page 1183 1184 @subsubsection fsync Handler 1185 1186 @subheading Corresponding Structure Element: 1187 1188 XXX 1189 1190 @subheading Arguments: 1191 1192 XXX 1193 @subheading File: 1194 1195 XXX 1196 1197 @subheading Description: 1198 1199 XXX 1200 1201 @subheading NOTES: 1202 1203 XXX 1204 1205 @c 1206 @c 1207 @c 1208 @page 1209 1210 @subsubsection fdatasync Handler 1211 1212 @subheading Corresponding Structure Element: 1213 1214 XXX 1215 1216 @subheading Arguments: 1217 1218 XXX 1219 1220 @subheading File: 1221 1222 XXX 1223 1224 @subheading Description: 1225 1226 XXX 1227 1228 @subheading NOTES: 1229 1230 XXX 1231 1232 @c 1233 @c 1234 @c 1235 @page 1236 1237 @subsubsection fcntl Handler 1238 1239 @subheading Corresponding Structure Element: 1240 1241 XXX 1242 1243 @subheading Arguments: 1244 1245 XXX 1246 1247 @subheading File: 1248 1249 XXX 1250 1251 @subheading Description: 1252 1253 XXX 1254 1255 @subheading NOTES: 1256 1257 XXX -
doc/filesystem/imfs.t
r482ffbb2 r7441fe2c 1 @c COPYRIGHT (c) 1988-1998. 2 @c On-Line Applications Research Corporation (OAR). 3 @c All rights reserved. 4 @c 5 @c $Id$ 6 @c 1 7 2 8 @chapter In-Memory Filesystem 3 9 4 This chapter describes the In-Memory Filesystem. 5 6 @section Filesystem Handler Table Functions 10 This chapter describes the In-Memory Filesystem (IMFS). The IMFS is a 11 full featured POSIX filesystem that keeps all information in memory. 12 13 @section IMFS Per Node Data Structure 14 15 Each regular file, device, hard link, and directory is represented by a data 16 structure called a @code{jnode}. The @code{jnode} is formally represented by the 17 structure: 18 19 @example 20 struct IMFS_jnode_tt @{ 21 Chain_Node Node; /* for chaining them together */ 22 IMFS_jnode_t *Parent; /* Parent node */ 23 char name[NAME_MAX+1]; /* "basename" */ 24 mode_t st_mode; /* File mode */ 25 nlink_t st_nlink; /* Link count */ 26 ino_t st_ino; /* inode */ 27 28 uid_t st_uid; /* User ID of owner */ 29 gid_t st_gid; /* Group ID of owner */ 30 time_t st_atime; /* Time of last access */ 31 time_t st_mtime; /* Time of last modification */ 32 time_t st_ctime; /* Time of last status change */ 33 IMFS_jnode_types_t type; /* Type of this entry */ 34 IMFS_typs_union info; 35 @}; 36 @end example 37 38 The key elements of this structure are listed below together with a brief 39 explanation of their role in the filesystem. 40 41 @table @b 42 43 @item Node 44 exists to allow the entire @code{jnode} structure to be included in a chain. 45 46 @item Parent 47 is a pointer to another @code{jnode} structure that is the logical parent of the 48 node in which it appears. This field may be NULL if the file associated with 49 this node is deleted but there are open file descriptors on this file or 50 there are still hard links to this node. 51 52 @item name 53 is the name of this node within the filesystem hierarchical tree. Example: If 54 the fully qualified pathname to the @code{jnode} was @code{/a/b/c}, the 55 @code{jnode} name field would contain the null terminated string @code{"c"}. 56 57 @item st_mode 58 is the standard Unix access permissions for the file or directory. 59 60 @item st_nlink 61 is the number of hard links to this file. When a @code{jnode} is first created 62 its link count is set to 1. A @code{jnode} and its associated resources 63 cannot be deleted unless its link count is less than 1. 64 65 @item st_ino 66 is a unique node identification number 67 68 @item st_uid 69 is the user ID of the file's owner 70 71 @item st_gid 72 is the group ID of the file's owner 73 74 @item st_atime 75 is the time of the last access to this file 76 77 @item st_mtime 78 is the time of the last modification of this file 79 80 @item st_ctime 81 is the time of the last status change to the file 82 83 @item type 84 is the indication of node type must be one of the following states: 85 86 @itemize @bullet 87 @item IMFS_DIRECTORY 88 @item IMFS_MEMORY_FILE 89 @item IMFS_HARD_LINK 90 @item IMFS_SYM_LINK 91 @item IMFS_DEVICE 92 @end itemize 93 94 95 @item info 96 is this contains a structure that is unique to file type (See IMFS_typs_union 97 in imfs.h). 98 99 @itemize @bullet 100 101 @item IMFS_DIRECTORY 102 103 An IMFS directory contains a dynamic chain structure that 104 records all files and directories that are subordinate to the directory node. 105 106 @item IMFS_MEMORY_FILE 107 108 Under the in memory filesystem regular files hold data. Data is dynamically 109 allocated to the file in 128 byte chunks of memory. The individual chunks of 110 memory are tracked by arrays of pointers that record the address of the 111 allocated chunk of memory. Single, double, and triple indirection pointers 112 are used to record the locations of all segments of the file. The 113 memory organization of an IMFS file are discussed elsewhere in this manual. 114 115 @item IMFS_HARD_LINK 116 117 The IMFS filesystem supports the concept of hard links to other nodes in the 118 IMFS filesystem. These hard links are actual pointers to other nodes in the 119 same filesystem. This type of link cannot cross-filesystem boundaries. 120 121 @item IMFS_SYM_LINK 122 123 The IMFS filesystem supports the concept of symbolic links to other nodes in 124 any filesystem. A symbolic link consists of a pointer to a character string 125 that represents the pathname to the target node. This type of link can 126 cross-filesystem boundaries. Just as with most versions of UNIX supporting 127 symbolic links, a symbolic link can point to a non-existent file. 128 129 @item IMFS_DEVICE 130 131 All RTEMS devices now appear as files under the in memory filesystem. On 132 system initialization, all devices are registered as nodes under the file 133 system. 134 135 @end itemize 136 137 @end table 138 139 @section Miscellaneous IMFS Information 140 141 @section Memory associated with the IMFS 142 143 A memory based filesystem draws its resources for files and directories 144 from the memory resources of the system. When it is time to un-mount the 145 filesystem, the memory resources that supported filesystem are set free. 146 In order to free these resources, a recursive walk of the filesystems 147 tree structure will be performed. As the leaf nodes under the filesystem 148 are encountered their resources are freed. When directories are made empty 149 by this process, their resources are freed. 150 151 @subsection Node removal constraints for the IMFS 152 153 The IMFS conforms to the general filesystem requirements for node 154 removal. See @ref{File and Directory Removal Constraints}. 155 156 @subsection IMFS General Housekeeping Notes 157 158 The following is a list of odd housekeeping notes for the IMFS. 159 160 @itemize @bullet 161 162 @item If the global variable rtems_filesystem_current refers to the node that 163 we are trying to remove, the node_access element of this structure must be 164 set to NULL to invalidate it. 165 166 @item If the node was of IMFS_MEMORY_FILE type, free the memory associated 167 with the memory file before freeing the node. Use the IMFS_memfile_remove() 168 function. 169 170 @end itemize 171 172 @section IMFS Operation Tables 173 174 @subsection IMFS Filesystem Handler Table Functions 7 175 8 176 OPS table functions are defined in a rtems_filesystem_operations_table 9 structure. It defines functions that are specific to a given file 10 One table exists for each file 177 structure. It defines functions that are specific to a given filesystem. 178 One table exists for each filesystem that is supported in the RTEMS 11 179 configuration. The structure definition appears below and is followed by 12 180 general developmental information on each of the functions contained in this … … 14 182 15 183 @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: 184 rtems_filesystem_operations_table IMFS_ops = @{ 185 IMFS_eval_path, 186 IMFS_evaluate_for_make, 187 IMFS_link, 188 IMFS_unlink, 189 IMFS_node_type, 190 IMFS_mknod, 191 IMFS_rmnod, 192 IMFS_chown, 193 IMFS_freenodinfo, 194 IMFS_mount, 195 IMFS_initialize, 196 IMFS_unmount, 197 IMFS_fsunmount, 198 IMFS_utime, 199 IMFS_evaluate_link, 200 IMFS_symlink, 201 IMFS_readlink 202 @}; 203 @end example 204 205 @c 206 @c 207 @c 208 @page 209 210 @subsubsection IMFS_evalpath() 211 212 @subheading Corresponding Structure Element: 213 214 XXX 215 216 @subheading Arguments: 217 218 XXX 219 220 @subheading File: 221 222 XXX 223 224 @subheading Description: 225 226 XXX 227 228 229 @c 230 @c 231 @c 232 @page 233 234 @subsubsection IMFS_evalformake() 235 236 @subheading Corresponding Structure Element: 237 238 XXX 239 240 @subheading Arguments: 241 242 XXX 243 244 @subheading File: 245 246 XXX 247 248 @subheading Description: 249 250 XXX 251 252 253 @c 254 @c 255 @c 256 @page 257 258 @subsubsection IMFS_link() 259 260 @subheading Corresponding Structure Element: 97 261 98 262 link … … 111 275 imfs_link.c 112 276 113 @subheading De velopment Comments:114 115 116 This routine is used in the IMFS file 277 @subheading Description: 278 279 280 This routine is used in the IMFS filesystem to create a hard-link. 117 281 118 282 It will first examine the st_nlink count of the node that we are trying to. … … 122 286 the end of the name. 123 287 124 IMFS_create_node will be used to create a file 288 IMFS_create_node will be used to create a filesystem node that will have the 125 289 following characteristics: 126 290 … … 147 311 148 312 149 @c @c @c150 151 @ page152 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 @subs ectionnode_type()179 180 @subheading Slot Function:313 @c 314 @c 315 @c 316 @page 317 318 @subsubsection IMFS_unlink() 319 320 @subheading Corresponding Structure Element: 321 322 XXX 323 324 @subheading Arguments: 325 326 XXX 327 328 @subheading File: 329 330 XXX 331 332 @subheading Description: 333 334 XXX 335 336 337 @c 338 @c 339 @c 340 @page 341 342 @subsubsection IMFS_node_type() 343 344 @subheading Corresponding Structure Element: 181 345 182 346 IMFS_node_type() … … 192 356 imfs_ntype.c 193 357 194 @subheading De velopment Comments:358 @subheading Description: 195 359 196 360 This routine will locate the IMFS_jnode_t structure that holds ownership 197 information for the selected node in the file 361 information for the selected node in the filesystem. 198 362 199 363 This structure is pointed to by pathloc->node_access. … … 216 380 @c 217 381 @c 218 219 @page 220 221 @subsection mknod() 222 223 @subheading Slot Function: 382 @page 383 384 @subsubsection IMFS_mknod() 385 386 @subheading Corresponding Structure Element: 224 387 225 388 IMFS_mknod() … … 238 401 imfs_mknod.c 239 402 240 @subheading De velopment Comments:403 @subheading Description: 241 404 242 405 This routine will examine the mode argument to determine is we are trying to … … 255 418 @c 256 419 @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: 420 @page 421 422 @subsubsection IMFS_rmnod() 423 424 @subheading Corresponding Structure Element: 425 426 XXX 427 428 @subheading Arguments: 429 430 XXX 431 432 @subheading File: 433 434 XXX 435 436 @subheading Description: 437 438 XXX 439 440 441 @c 442 @c 443 @c 444 @page 445 446 @subsubsection IMFS_chown() 447 448 @subheading Corresponding Structure Element: 288 449 289 450 IMFS_chown() … … 301 462 imfs_chown.c 302 463 303 @subheading De velopment Comments:464 @subheading Description: 304 465 305 466 This routine will locate the IMFS_jnode_t structure that holds ownership 306 information for the selected node in the file 467 information for the selected node in the filesystem. 307 468 308 469 This structure is pointed to by pathloc->node_access. 309 470 310 471 The st_uid and st_gid fields of the node are then modified. Since this is a 311 memory based file 472 memory based filesystem, no further action is required to alter the 312 473 ownership of the IMFS_jnode_t structure. 313 474 … … 317 478 @c 318 479 @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: 480 @page 481 482 @subsubsection IMFS_freenod() 483 484 @subheading Corresponding Structure Element: 485 486 XXX 487 488 @subheading Arguments: 489 490 XXX 491 492 @subheading File: 493 494 XXX 495 496 @subheading Description: 337 497 338 498 XXX … … 342 502 @c 343 503 @c 344 345 @page 346 347 @subsection mount() 348 349 @subheading Slot Function: 504 @page 505 506 @subsubsection IMFS_mount() 507 508 @subheading Corresponding Structure Element: 350 509 351 510 IMFS_mount() … … 361 520 imfs_mount.c 362 521 363 @subheading De velopment Comments:364 365 This routine provides the file 366 file 522 @subheading Description: 523 524 This routine provides the filesystem specific processing required to mount a 525 filesystem for the system that contains the mount point. It will determine 367 526 if the point that we are trying to mount onto is a node of IMFS_DIRECTORY 368 527 type. … … 370 529 If it is the node's info element is altered so that the info.directory.mt_fs 371 530 element points to the mount table chain entry that is associated with the 372 mounted file 373 examined to determine if a file 531 mounted filesystem at this point. The info.directory.mt_fs element can be 532 examined to determine if a filesystem is mounted at a directory. If it is 374 533 NULL, the directory does not serve as a mount point. A non-NULL entry 375 534 indicates that the directory does serve as a mount point and the value of 376 535 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: 536 describes the filesystem mounted at this point. 537 538 539 @c 540 @c 541 @c 542 @page 543 544 @subsubsection IMFS_fsmount_me() 545 546 @subheading Corresponding Structure Element: 389 547 390 548 IMFS_initialize() … … 400 558 imfs_init.c 401 559 402 @subheading De velopment Comments:403 404 This function is provided with a file 405 file system management details associated with mounting that filesystem560 @subheading Description: 561 562 This function is provided with a filesystem to take care of the internal 563 filesystem management details associated with mounting that filesystem 406 564 under the RTEMS environment. 407 565 408 It is not responsible for the mounting details associated the file 566 It is not responsible for the mounting details associated the filesystem 409 567 containing the mount point. 410 568 … … 416 574 This structure contains information about the mount point. This 417 575 allows us to find the ops-table and the handling functions 418 associated with the file 576 associated with the filesystem containing the mount point. 419 577 420 578 rtems_filesystem_location_info_t *fs_root_node, … … 422 580 This structure contains information about the root node in the file 423 581 system to be mounted. It allows us to find the ops-table and the 424 handling functions associated with the file 582 handling functions associated with the filesystem to be mounted. 425 583 426 584 rtems_filesystem_options_t options, … … 431 589 432 590 This points to an allocated block of memory the will be used to 433 hold any file 591 hold any filesystem specific information of a global nature. This 434 592 allocated region if important because it allows us to mount the 435 same file 436 Each instance of the mounted file 593 same filesystem type more than once under the RTEMS system. 594 Each instance of the mounted filesystem has its own set of global 437 595 management information that is separate from the global 438 596 management information associated with the other instances of the 439 mounted file 597 mounted filesystem type. 440 598 441 599 rtems_filesystem_limits_and_options_t pathconf_info, 442 600 443 601 The table contains the following set of values associated with the 444 mounted file 602 mounted filesystem: 445 603 446 604 @itemize @bullet … … 478 636 479 637 The is intended to contain a string that identifies the device that contains 480 the file system information. The filesystems that are currently implemented638 the filesystem information. The filesystems that are currently implemented 481 639 are memory based and don't require a device specification. 482 640 … … 492 650 The node's name will be a null string. 493 651 494 A file 495 initialized for the IMFS file 496 entry will be set to point the file 652 A filesystem information structure(fs_info) will be allocated and 653 initialized for the IMFS filesystem. The fs_info pointer in the mount table 654 entry will be set to point the filesystem information structure. 497 655 498 656 The pathconf_info element of the mount table will be set to the appropriate … … 503 661 @itemize @bullet 504 662 505 @item pointer to the allocated root node of the file 506 507 @item directory handlers for a directory node under the IMFS file 663 @item pointer to the allocated root node of the filesystem 664 665 @item directory handlers for a directory node under the IMFS filesystem 508 666 509 667 @item OPS table functions for the IMFS … … 518 676 @c 519 677 @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: 678 @page 679 680 @subsubsection IMFS_unmount() 681 682 @subheading Corresponding Structure Element: 683 684 XXX 685 686 @subheading Arguments: 687 688 XXX 689 690 @subheading File: 691 692 XXX 693 694 @subheading Description: 538 695 539 696 XXX … … 543 700 @c 544 701 @c 545 546 @page 547 548 @subsection fsunmount_me() 549 550 @subheading Slot Function: 702 @page 703 704 @subsubsection IMFS_fsunmount_me() 705 706 @subheading Corresponding Structure Element: 551 707 552 708 imfs_fsunmount_me() … … 562 718 imfs_fsunmount_me.c 563 719 564 @subheading De velopment Comments:720 @subheading Description: 565 721 566 722 XXX … … 570 726 @c 571 727 @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: 728 @page 729 730 @subsubsection IMFS_utime() 731 732 @subheading Corresponding Structure Element: 733 734 XXX 735 736 @subheading Arguments: 737 738 XXX 739 740 @subheading File: 741 742 XXX 743 744 @subheading Description: 590 745 591 746 XXX … … 595 750 @c 596 751 @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 752 @page 753 754 @subsubsection IMFS_eval_link() 755 756 @subheading Corresponding Structure Element: 757 758 XXX 759 760 @subheading Arguments: 761 762 XXX 763 764 @subheading File: 765 766 XXX 767 768 @subheading Description: 769 770 XXX 771 772 @c 773 @c 774 @c 775 @page 776 @subsection Regular File Handler Table Functions 623 777 624 778 Handler table functions are defined in a rtems_filesystem_file_handlers_r 625 779 structure. It defines functions that are specific to a node type in a given 626 file system. One table exists for each of the filesystem's node types. The780 filesystem. One table exists for each of the filesystem's node types. The 627 781 structure definition appears below. It is followed by general developmental 628 782 information on each of the functions associated with regular files contained … … 630 784 631 785 @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 example647 648 649 @c 650 @c 651 @c 652 653 @page 654 655 @subs ectionopen() for Regular Files656 657 @subheading Slot Function:786 rtems_filesystem_file_handlers_r IMFS_memfile_handlers = @{ 787 memfile_open, 788 memfile_close, 789 memfile_read, 790 memfile_write, 791 memfile_ioctl, 792 memfile_lseek, 793 IMFS_stat, 794 IMFS_fchmod, 795 memfile_ftruncate, 796 NULL, /* fpathconf */ 797 NULL, /* fsync */ 798 IMFS_fdatasync, 799 IMFS_fcntl 800 @}; 801 @end example 802 803 804 @c 805 @c 806 @c 807 @page 808 809 @subsubsection memfile_open() for Regular Files 810 811 @subheading Corresponding Structure Element: 658 812 659 813 memfile_open() … … 672 826 memfile.c 673 827 674 @subheading De velopment Comments:828 @subheading Description: 675 829 676 830 Currently this function is a shell. No meaningful processing is performed and … … 680 834 @c 681 835 @c 682 683 @page 684 685 @subsection close() for Regular Files 686 687 @subheading Slot Function: 836 @page 837 838 @subsubsection memfile_close() for Regular Files 839 840 @subheading Corresponding Structure Element: 688 841 689 842 memfile_close() … … 699 852 memfile.c 700 853 701 @subheading De velopment Comments:702 703 This routine is a dummy for regular files under the base file 854 @subheading Description: 855 856 This routine is a dummy for regular files under the base filesystem. It 704 857 performs a capture of the IMFS_jnode_t pointer from the file control block 705 858 and then immediately returns a success status. … … 709 862 @c 710 863 @c 711 712 @page 713 714 @subsection read() for Regular Files 715 716 @subheading Slot Function: 864 @page 865 866 @subsubsection memfile_read() for Regular Files 867 868 @subheading Corresponding Structure Element: 717 869 718 870 memfile_read() … … 730 882 memfile.c 731 883 732 @subheading De velopment Comments:884 @subheading Description: 733 885 734 886 This routine will determine the @code{jnode} that is associated with this file. … … 756 908 @c 757 909 @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: 910 @page 911 912 @subsubsection memfile_write() for Regular Files 913 914 @subheading Corresponding Structure Element: 915 916 XXX 917 918 @subheading Arguments: 919 920 XXX 921 @subheading File: 922 923 XXX 924 925 @subheading Description: 926 927 XXX 928 929 @c 930 @c 931 @c 932 @page 933 934 @subsubsection memfile_ioctl() for Regular Files 935 936 @subheading Corresponding Structure Element: 787 937 788 938 XXX … … 800 950 memfile.c 801 951 802 @subheading De velopment Comments:952 @subheading Description: 803 953 804 954 The current code is a placeholder for future development. The routine returns … … 808 958 @c 809 959 @c 810 811 @page 812 813 @subsection lseek() for Regular Files 814 815 @subheading Slot Function: 960 @page 961 962 @subsubsection memfile_lseek() for Regular Files 963 964 @subheading Corresponding Structure Element: 816 965 817 966 Memfile_lseek() … … 829 978 memfile.c 830 979 831 @subheading De velopment Comments:980 @subheading Description: 832 981 833 982 This routine make sure that the memory based file is sufficiently large to … … 841 990 @c 842 991 @c 843 844 @page 845 846 @subsection fstat() for Regular Files 847 848 @subheading Slot Function: 992 @page 993 994 @subsubsection IMFS_stat() for Regular Files 995 996 @subheading Corresponding Structure Element: 849 997 850 998 IMFS_stat() … … 861 1009 imfs_stat.c 862 1010 863 @subheading De velopment Comments:1011 @subheading Description: 864 1012 865 1013 This routine actually performs status processing for both devices and regular … … 867 1015 868 1016 The IMFS_jnode_t structure is referenced to determine the type of node under 869 the file 1017 the filesystem. 870 1018 871 1019 If the node is associated with a device, node information is extracted and … … 903 1051 @c 904 1052 @c 905 906 @page 907 908 @subsection fchmod() for Regular Files 909 910 @subheading Slot Function: 1053 @page 1054 1055 @subsubsection IMFS_fchmod() for Regular Files 1056 1057 @subheading Corresponding Structure Element: 911 1058 912 1059 IMFS_fchmod() … … 923 1070 imfs_fchmod.c 924 1071 925 @subheading De velopment Comments:1072 @subheading Description: 926 1073 927 1074 This routine will obtain the pointer to the IMFS_jnode_t structure from the … … 944 1091 @c 945 1092 @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: 1093 @page 1094 1095 @subsubsection memfile_ftruncate() for Regular Files 1096 1097 @subheading Corresponding Structure Element: 1098 1099 XXX 1100 1101 @subheading Arguments: 1102 1103 XXX 1104 @subheading File: 1105 1106 XXX 1107 1108 @subheading Description: 1109 1110 XXX 1111 1112 1113 @subsubsection No pathconf() for Regular Files 1114 1115 @subheading Corresponding Structure Element: 975 1116 976 1117 NULL … … 984 1125 Not Implemented 985 1126 986 @subheading De velopment Comments:1127 @subheading Description: 987 1128 988 1129 Not Implemented … … 992 1133 @c 993 1134 @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 1135 @page 1136 1137 @subsubsection No fsync() for Regular Files 1138 1139 @subheading Corresponding Structure Element: 1140 1141 XXX 1142 1143 @subheading Arguments: 1144 1145 XXX 1146 @subheading File: 1147 1148 XXX 1149 1150 @subheading Description: 1151 1152 XXX 1153 1154 1155 @c 1156 @c 1157 @c 1158 @page 1159 1160 @subsubsection IMFS_fdatasync() for Regular Files 1161 1162 @subheading Corresponding Structure Element: 1163 1164 XXX 1165 1166 @subheading Arguments: 1167 1168 XXX 1169 @subheading File: 1170 1171 XXX 1172 1173 @subheading Description: 1174 1175 XXX 1176 1177 @c 1178 @c 1179 @c 1180 @page 1181 @subsection Directory Handler Table Functions 1043 1182 1044 1183 Handler table functions are defined in a rtems_filesystem_file_handlers_r 1045 1184 structure. It defines functions that are specific to a node type in a given 1046 file system. One table exists for each of the filesystem's node types. The1185 filesystem. One table exists for each of the filesystem's node types. The 1047 1186 structure definition appears below. It is followed by general developmental 1048 1187 information on each of the functions associated with directories contained in … … 1050 1189 1051 1190 @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: 1191 rtems_filesystem_file_handlers_r IMFS_directory_handlers = @{ 1192 IMFS_dir_open, 1193 IMFS_dir_close, 1194 IMFS_dir_read, 1195 NULL, /* write */ 1196 NULL, /* ioctl */ 1197 IMFS_dir_lseek, 1198 IMFS_dir_fstat, 1199 IMFS_fchmod, 1200 NULL, /* ftruncate */ 1201 NULL, /* fpathconf */ 1202 NULL, /* fsync */ 1203 IMFS_fdatasync, 1204 IMFS_fcntl 1205 @}; 1206 @end example 1207 1208 1209 @c 1210 @c 1211 @c 1212 @page 1213 @subsubsection IMFS_dir_open() for Directories 1214 1215 @subheading Corresponding Structure Element: 1078 1216 1079 1217 imfs_dir_open() … … 1092 1230 imfs_directory.c 1093 1231 1094 @subheading De velopment Comments:1232 @subheading Description: 1095 1233 1096 1234 This routine will look into the file control block to find the @code{jnode} that … … 1106 1244 @c 1107 1245 @c 1108 1109 @page 1110 1111 @subsection close() for Directories 1112 1113 @subheading Slot Function: 1246 @page 1247 1248 @subsubsection IMFS_dir_close() for Directories 1249 1250 @subheading Corresponding Structure Element: 1114 1251 1115 1252 imfs_dir_close() … … 1125 1262 imfs_directory.c 1126 1263 1127 @subheading De velopment Comments:1128 1129 This routine is a dummy for directories under the base file 1264 @subheading Description: 1265 1266 This routine is a dummy for directories under the base filesystem. It 1130 1267 immediately returns a success status. 1131 1268 … … 1133 1270 @c 1134 1271 @c 1135 1136 @page 1137 1138 @subsection read() for Directories 1139 1140 @subheading Slot Function: 1272 @page 1273 1274 @subsubsection IMFS_dir_read() for Directories 1275 1276 @subheading Corresponding Structure Element: 1141 1277 1142 1278 imfs_dir_read … … 1154 1290 imfs_directory.c 1155 1291 1156 @subheading De velopment Comments:1292 @subheading Description: 1157 1293 1158 1294 This routine will read a fixed number of directory entries from the current … … 1164 1300 @c 1165 1301 @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: 1302 @page 1303 1304 @subsubsection No write() for Directories 1305 1306 @subheading Corresponding Structure Element: 1307 1308 XXX 1309 1310 @subheading Arguments: 1311 1312 XXX 1313 1314 @subheading File: 1315 1316 XXX 1317 1318 @subheading Description: 1319 1320 XXX 1321 1322 @c 1323 @c 1324 @c 1325 @page 1326 1327 @subsubsection No ioctl() for Directories 1328 1329 @subheading Corresponding Structure Element: 1196 1330 1197 1331 ioctl … … 1204 1338 Not supported 1205 1339 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: 1340 @subheading Description: 1341 1342 XXX 1343 1344 @c 1345 @c 1346 @c 1347 @page 1348 1349 @subsubsection IMFS_dir_lseek() for Directories 1350 1351 @subheading Corresponding Structure Element: 1219 1352 1220 1353 imfs_dir_lseek() … … 1232 1365 imfs_directory.c 1233 1366 1234 @subheading De velopment Comments:1367 @subheading Description: 1235 1368 1236 1369 This routine alters the offset in the file control block. … … 1245 1378 @c 1246 1379 @c 1247 1248 @page 1249 1250 @subsection fstat() for Directories 1251 1252 @subheading Slot Function: 1380 @page 1381 1382 @subsubsection IMFS_dir_fstat() for Directories 1383 1384 @subheading Corresponding Structure Element: 1253 1385 1254 1386 imfs_dir_fstat() … … 1266 1398 imfs_directory.c 1267 1399 1268 @subheading De velopment Comments:1400 @subheading Description: 1269 1401 1270 1402 The node access information in the rtems_filesystem_location_info_t structure … … 1291 1423 @c 1292 1424 @c 1293 1294 @page 1295 1296 @subsection fchmod() for Directories 1297 1298 @subheading Slot Function: 1425 @page 1426 1427 @subsubsection IMFS_fchmod() for Directories 1428 1429 @subheading Corresponding Structure Element: 1299 1430 1300 1431 IMFS_fchmod() … … 1311 1442 imfs_fchmod.c 1312 1443 1313 @subheading De velopment Comments:1444 @subheading Description: 1314 1445 1315 1446 This routine will obtain the pointer to the IMFS_jnode_t structure from the … … 1332 1463 @c 1333 1464 @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: 1465 @page 1466 1467 @subsubsection No ftruncate() for Directories 1468 1469 @subheading Corresponding Structure Element: 1470 1471 XXX 1472 1473 @subheading Arguments: 1474 1475 XXX 1476 1477 @subheading File: 1478 1479 XXX 1480 1481 @subheading Description: 1482 1483 XXX 1484 1485 @c 1486 @c 1487 @c 1488 @page 1489 1490 @subsubsection No fpathconf() for Directories 1491 1492 @subheading Corresponding Structure Element: 1364 1493 1365 1494 fpathconf … … 1373 1502 Not Implemented 1374 1503 1375 @subheading De velopment Comments:1504 @subheading Description: 1376 1505 1377 1506 Not Implemented … … 1381 1510 @c 1382 1511 @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 1512 @page 1513 1514 @subsubsection No fsync() for Directories 1515 1516 @subheading Corresponding Structure Element: 1517 1518 XXX 1519 1520 @subheading Arguments: 1521 1522 XXX 1523 @subheading File: 1524 1525 XXX 1526 1527 @subheading Description: 1528 1529 XXX 1530 1531 1532 @c 1533 @c 1534 @c 1535 @page 1536 1537 @subsubsection IMFS_fdatasync() for Directories 1538 1539 @subheading Corresponding Structure Element: 1540 1541 XXX 1542 1543 @subheading Arguments: 1544 1545 XXX 1546 1547 @subheading File: 1548 1549 XXX 1550 1551 @subheading Description: 1552 1553 XXX 1554 1555 @c 1556 @c 1557 @c 1558 @page 1559 @subsection Device Handler Table Functions 1430 1560 1431 1561 Handler table functions are defined in a rtems_filesystem_file_handlers_r 1432 1562 structure. It defines functions that are specific to a node type in a given 1433 file system. One table exists for each of the filesystem's node types. The1563 filesystem. One table exists for each of the filesystem's node types. The 1434 1564 structure definition appears below. It is followed by general developmental 1435 1565 information on each of the functions associated with devices contained in … … 1456 1586 @c 1457 1587 @c 1458 1459 @page 1460 1461 @subsection open() for Devices 1462 1463 @subheading Slot Function: 1588 @page 1589 1590 @subsubsection device_open() for Devices 1591 1592 @subheading Corresponding Structure Element: 1464 1593 1465 1594 device_open() … … 1478 1607 deviceio.c 1479 1608 1480 @subheading De velopment Comments:1609 @subheading Description: 1481 1610 1482 1611 This routine will use the file control block to locate the node structure for … … 1492 1621 @c 1493 1622 @c 1494 1495 @page 1496 1497 @subsection close() for Devices 1498 1499 @subheading Slot Function: 1623 @page 1624 1625 @subsubsection device_close() for Devices 1626 1627 @subheading Corresponding Structure Element: 1500 1628 1501 1629 device_close() … … 1511 1639 deviceio.c 1512 1640 1513 @subheading De velopment Comments:1641 @subheading Description: 1514 1642 1515 1643 This routine extracts the major and minor device driver numbers from the … … 1525 1653 @c 1526 1654 @c 1527 1528 @page 1529 1530 @subsection read() for Devices 1531 1532 @subheading Slot Function: 1655 @page 1656 1657 @subsubsection device_read() for Devices 1658 1659 @subheading Corresponding Structure Element: 1533 1660 1534 1661 device_read() … … 1546 1673 deviceio.c 1547 1674 1548 @subheading De velopment Comments:1675 @subheading Description: 1549 1676 1550 1677 This routine will extract the major and minor numbers for the device from the - … … 1576 1703 @c 1577 1704 @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: 1705 @page 1706 1707 @subsubsection device_write() for Devices 1708 1709 @subheading Corresponding Structure Element: 1710 1711 XXX 1712 1713 @subheading Arguments: 1714 1715 XXX 1716 @subheading File: 1717 1718 XXX 1719 1720 @subheading Description: 1721 1722 XXX 1723 1724 @c 1725 @c 1726 @c 1727 @page 1728 1729 @subsubsection device_ioctl() for Devices 1730 1731 @subheading Corresponding Structure Element: 1607 1732 1608 1733 ioctl … … 1620 1745 deviceio.c 1621 1746 1622 @subheading De velopment Comments:1747 @subheading Description: 1623 1748 1624 1749 This handler will obtain status information about a device. … … 1645 1770 @c 1646 1771 @c 1647 1648 @page 1649 1650 @subsection lseek() for Devices 1651 1652 @subheading Slot Function: 1772 @page 1773 1774 @subsubsection device_lseek() for Devices 1775 1776 @subheading Corresponding Structure Element: 1653 1777 1654 1778 device_lseek() … … 1666 1790 deviceio.c 1667 1791 1668 @subheading De velopment Comments:1792 @subheading Description: 1669 1793 1670 1794 At the present time this is a placeholder function. It always returns a … … 1674 1798 @c 1675 1799 @c 1676 1677 @page 1678 1679 @subsection fstat() for Devices 1680 1681 @subheading Slot Function: 1800 @page 1801 1802 @subsubsection IMFS_stat() for Devices 1803 1804 @subheading Corresponding Structure Element: 1682 1805 1683 1806 IMFS_stat() … … 1694 1817 imfs_stat.c 1695 1818 1696 @subheading De velopment Comments:1819 @subheading Description: 1697 1820 1698 1821 This routine actually performs status processing for both devices and regular files. 1699 1822 1700 1823 The IMFS_jnode_t structure is referenced to determine the type of node under the 1701 file 1824 filesystem. 1702 1825 1703 1826 If the node is associated with a device, node information is extracted and … … 1736 1859 @c 1737 1860 @c 1738 1739 @page 1740 1741 @subsection fchmod() for Devices 1742 1743 @subheading Slot Function: 1861 @page 1862 1863 @subsubsection IMFS_fchmod() for Devices 1864 1865 @subheading Corresponding Structure Element: 1744 1866 1745 1867 IMFS_fchmod() … … 1756 1878 imfs_fchmod.c 1757 1879 1758 @subheading De velopment Comments:1880 @subheading Description: 1759 1881 1760 1882 This routine will obtain the pointer to the IMFS_jnode_t structure from the … … 1778 1900 @c 1779 1901 @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: 1902 @page 1903 1904 @subsubsection No ftruncate() for Devices 1905 1906 @subheading Corresponding Structure Element: 1907 1908 XXX 1909 1910 @subheading Arguments: 1911 1912 XXX 1913 @subheading File: 1914 1915 XXX 1916 1917 @subheading Description: 1918 1919 XXX 1920 1921 @c 1922 @c 1923 @c 1924 @page 1925 1926 @subsubsection No fpathconf() for Devices 1927 1928 @subheading Corresponding Structure Element: 1809 1929 1810 1930 fpathconf … … 1818 1938 Not Implemented 1819 1939 1820 @subheading De velopment Comments:1940 @subheading Description: 1821 1941 1822 1942 Not Implemented … … 1826 1946 @c 1827 1947 @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 1948 @page 1949 1950 @subsubsection No fsync() for Devices 1951 1952 @subheading Corresponding Structure Element: 1953 1954 XXX 1955 1956 @subheading Arguments: 1957 1958 XXX 1959 1960 @subheading File: 1961 1962 XXX 1963 1964 @subheading Description: 1965 1966 XXX 1967 1968 1969 @c 1970 @c 1971 @c 1972 @page 1973 1974 @subsubsection No fdatasync() for Devices 1857 1975 1858 1976 Not Implemented 1859 1977 1860 @subheading Slot Function:1861 1862 XXX 1863 1864 @subheading Arguments: 1865 1866 XXX 1867 1868 @subheading File: 1869 1870 XXX 1871 1872 @subheading De velopment Comments:1873 1874 XXX 1875 1978 @subheading Corresponding Structure Element: 1979 1980 XXX 1981 1982 @subheading Arguments: 1983 1984 XXX 1985 1986 @subheading File: 1987 1988 XXX 1989 1990 @subheading Description: 1991 1992 XXX 1993 -
doc/filesystem/init.t
r482ffbb2 r7441fe2c 12 12 initialization will be performed. Part of initialization is a call to 13 13 rtems_filesystem_initialize(). This routine will mount the `In Memory File 14 System' as the base file system. Mounting the base filesystem consists14 System' as the base filesystem. Mounting the base filesystem consists 15 15 of the following: 16 16 … … 25 25 directory handlers and pathconf limits and options. 26 26 27 @item Allocation of a memory region for file 27 @item Allocation of a memory region for filesystem specific global 28 28 management variables 29 29 30 @item Creation of first mount table entry for the base file 30 @item Creation of first mount table entry for the base filesystem 31 31 32 32 @item Initialization of the first mount table chain entry to indicate that 33 the mount point is NULL and the mounted file 33 the mount point is NULL and the mounted filesystem is the base file 34 34 system 35 35 … … 37 37 38 38 39 After the base file 39 After the base filesystem has been mounted, the following operations are 40 40 performed under its directory structure: 41 41 … … 48 48 @end itemize 49 49 50 @section Base Filesystem 51 52 RTEMS initially mounts a RAM based file system known as the base file system. 53 The root directory of this file system tree serves as the logical root of the 54 directory hierarchy (Figure 3). Under the root directory a `/dev' directory 55 is created under which all I/O device directories and files are registered as 56 part of the file system hierarchy. 57 58 @example 59 Figure of the tree structure goes here. 60 @end example 61 62 A RAM based file system draws its management resources from memory. File and 63 directory nodes are simply allocated blocks of memory. Data associated with 64 regular files is stored in collections of memory blocks. When the system is 65 turned off or restarted all memory-based components of the file system are 66 lost. 67 68 The base file system serves as a starting point for the mounting of file 69 systems that are resident on semi-permanent storage media. Examples of such 70 media include non- volatile memory, flash memory and IDE hard disk drives 71 (Figure 3). File systems of other types will be mounted onto mount points 72 within the base file system or other file systems that are subordinate to the 73 base file system. The framework set up under the base file system will allow 74 for these new file system types and the unique data and functionality that is 75 required to manage the future file systems. 76 77 @subsection Base Filesystem Mounting 78 79 At present, the first file system to be mounted is the `In Memory File 80 System'. It is mounted using a standard MOUNT() command in which the mount 81 point is NULL. This flags the mount as the first file system to be 82 registered under the operating system and appropriate initialization of file 83 system management information is performed (See figures 4 and 5). If a 84 different file system type is desired as the base file system, alterations 85 must be made to base_fs.c. This routine handles the mount of the base file 86 system. 87 88 89 @example 90 Figure of the mount table chain goes here. 91 @end example 92 93 94 Once the root of the base file system has been established and it has been 95 recorded as the mount point of the base file system, devices are integrated 96 into the base file system. For every device that is configured into the 97 system (See ioman.c) a device registration process is performed. Device 98 registration produces a unique dev_t handle that consists of a major and 99 minor device number. In addition, the configuration information for each 100 device contains a text string that represents the fully qualified pathname to 101 that device's place in the base file system's hierarchy. A file system node 102 is created for the device along the specified registration path. 103 104 105 @example 106 Figure of the Mount Table Processing goes here. 107 @end example 108 109 110 Note: Other file systems can be mounted but they are mounted onto points 111 (directory mount points) in the base file system. 112 113 -
doc/filesystem/mounting.t
r482ffbb2 r7441fe2c 17 17 @item The mount point must be a directory. It may have files and other 18 18 directories under it. These files and directories will be hidden when the 19 file 19 filesystem is mounted. 20 20 21 21 @item The task must have read/write/execute permissions to the mount point 22 22 or the mount attempt will be rejected. 23 23 24 @item Only one file 24 @item Only one filesystem can be mounted to a single mount point. 25 25 26 @item The Root of the mountable file 26 @item The Root of the mountable filesystem will be referenced by the name 27 27 of the mount point after the mount is complete. 28 28 … … 30 30 31 31 @section Mount Table Chain 32 33 The mount table chain is a dynamic list of structures that describe 34 mounted filesystems a specific points in the filesystem hierarchy. It is 35 initialized to an empty state during the base filesystem initialization. 36 The mount operation will add entries to the mount table chain. The 37 un-mount operation will remove entries from the mount table chain. 32 38 33 39 Each entry in the mount table chain is of the following type: … … 57 63 @section Adding entries to the chain during mount 58 64 59 When a file 65 When a filesystem is mounted, its presence and location in the file 60 66 system hierarchy is recorded in a dynamic list structure known as a chain. 61 67 A unique rtems_filesystem_mount_table_entry_tt structure is logged for 62 each file system that is mounted. This includes the base filesystem.68 each filesystem that is mounted. This includes the base filesystem. 63 69 64 70 @section Removing entries from the chain during unmount 65 71 66 When a file 72 When a filesystem is dismounted its entry in the mount table chain is 67 73 extracted and the memory for this entry is freed. 68 74 69 70 -
doc/filesystem/patheval.t
r482ffbb2 r7441fe2c 21 21 the new node to be created. 22 22 23 @item Pathname evaluation is specific to a file 23 @item Pathname evaluation is specific to a filesystem 24 24 25 25 @item Mechanics of crossing a mount point during the evaluation of a path … … 30 30 @itemize @bullet 31 31 32 @item Finding file 32 @item Finding filesystem node information 33 33 34 @item Finding file 34 @item Finding filesystem node handlers 35 35 36 @item Finding file 36 @item Finding filesystem node operations table 37 37 38 @item Finding mount table entry for the file 38 @item Finding mount table entry for the filesystem that this node is part 39 39 of 40 40 -
doc/filesystem/preface.texi
r482ffbb2 r7441fe2c 8 8 9 9 @ifinfo 10 @node Preface, Base Filesystem, Top, Top10 @node Preface, , Top, Top 11 11 @end ifinfo 12 12 @unnumbered Preface 13 13 14 The following file system capabilities have been added to the existing 15 RTEMS system: 14 This document describes the implementation of the RTEMS filesystem 15 infrastructure. This infrastructure supports the following 16 capabilities: 16 17 17 18 @itemize @bullet … … 41 42 @end enumerate 42 43 43 @item Hard links to files and directories are supported44 @item Hard links to files and directories 44 45 45 @item Symbolic links to files and directories are supported46 @item Symbolic links to files and directories 46 47 47 48 @end itemize 48 49 49 Th ese enhancements have been made to provide the framework for `UNIX like'50 file system support. ThePOSIX file and directory functions have been51 implemented t oallow a standard method of accessing file, device and52 directory information within the file system. The file system concept that50 This has been implemented to provide the framework for a UNIX-like 51 file system support. POSIX file and directory functions have been 52 implemented that allow a standard method of accessing file, device and 53 directory information within file systems. The file system concept that 53 54 has been implemented allows for expansion and adaptation of the file 54 55 system to a variety of existing and future data storage devices. To this … … 57 58 58 59 This framework slightly alters the manner in which devices are handled 59 under RTEMS. Devices that are defined under a given RTEMS configuration 60 will now be registered as files in a mounted file system. Access to these 61 devices and their associated device handlers will be obtained through the 62 traditional file system open(), read(), write(), lseek(), fstat() and 63 ioctl() functions. 60 under RTEMS from that of public release 4.0.0 and earlier. Devices that 61 are defined under a given RTEMS configuration will now be registered as 62 files in a mounted file system. Access to these device drivers and their 63 associated devices may now be performed through the traditional file system 64 open(), read(), write(), lseek(), fstat() and ioctl() functions in addition 65 to the interface provided by the IO Manager in the RTEMS Classic API. 64 66 65 A node structure is maintained for each file, device, and directory in the 66 file system. The node structure is used to manage ownership, access 67 rights, access time, modification time, and creation time. A union of 68 structures within the nodal structure provide for manipulation of file 69 data, device selection, or directory content as required by the nodal 70 type. Manipulation of these properties is accomplished through the POSIX 71 set of file and directory functions. 67 An In-Memory File System (IMFS) is included which provides full POSIX 68 filesystem functionality yet is RAM based. The IMFS maintains a 69 node structure for each file, device, and directory in each mounted 70 instantiation of its file system. The node structure is used to 71 manage ownership, access rights, access time, modification time, 72 and creation time. A union of structures within the IMFS nodal 73 structure provide for manipulation of file data, device selection, 74 or directory content as required by the nodal type. Manipulation of 75 these properties is accomplished through the POSIX set of file and 76 directory functions. In addition to being useful in its own right, 77 the IMFS serves as a full featured example filesystem. 72 78 79 The intended audience for this document is those persons implementing 80 their own filesystem. Users of the filesystem may find information 81 on the implementation useful. But the user interface to the filesystem 82 is through the ISO/ANSI C Library and POSIX 1003.1b file and directory 83 APIs. -
doc/filesystem/syscalls.t
r482ffbb2 r7441fe2c 10 10 11 11 This set of routines represents the application's interface to files and directories 12 under the RTEMS file 12 under the RTEMS filesystem. All routines are compliant with POSIX standards if a 13 13 specific interface has been established. The list below represents the routines that have 14 14 been included as part of the application's interface. … … 64 64 This routine is layered on top of the stat() function. As long as the st_mode 65 65 element in the returned structure follow the standard UNIX conventions, this 66 function should support other file 66 function should support other filesystems without alteration. 67 67 68 68 @page … … 85 85 86 86 This routine is layered on the rtems_filesystem_evaluate_path() routine and the 87 file 88 89 The routine node_type() must be a routine provided for each file 90 must access the file 87 filesystem specific OP table function node_type(). 88 89 The routine node_type() must be a routine provided for each filesystem since it 90 must access the filesystems node information to determine which of the 91 91 following types the node is: 92 92 … … 99 99 100 100 This acknowledges that the form of the node management information can vary 101 from one file 101 from one filesystem implementation to another. 102 102 103 103 RTEMS has a special global structure that maintains the current directory … … 119 119 This routine is layered on the open(), fchmod () and close () functions. As long as 120 120 the standard interpretation of the mode_t value is maintained, this routine should 121 not need modification to support other file 121 not need modification to support other filesystems. 122 122 123 123 @subheading Development Comments: … … 150 150 actually exists. If it does a rtems_filesystem_location_info_t structure will be 151 151 obtained that allows the shell function to locate the OPS table that is to be used 152 for this file 152 for this filesystem. 153 153 154 154 It is possible that the chown() function that should be in the OPS table is not … … 175 175 invoked. 176 176 177 If the file descriptor refers to an entry in the file 177 If the file descriptor refers to an entry in the filesystem, the appropriate handler 178 178 will be selected using information that has been placed in the file control block for 179 179 the device (rtems_libio_t structure). … … 191 191 192 192 If none of the upper bits are set in the file descriptor index, the file descriptor 193 refers to an element of the RTEMS file 194 195 The following sequence will be performed for any file 193 refers to an element of the RTEMS filesystem. 194 195 The following sequence will be performed for any filesystem file descriptor: 196 196 197 197 @enumerate … … 203 203 204 204 @item Determine if there is actually a function in the selected handler table that 205 processes the close() operation for the file 205 processes the close() operation for the filesystem and node type selected. 206 206 This is generally done to avoid execution attempts on functions that have not 207 207 been implemented. … … 230 230 memory resources that are required to track an open directory. The code is layered 231 231 on the close() function and standard memory free () functions. It should not 232 require alterations to support other file 232 require alterations to support other filesystems. 233 233 234 234 @subheading Development Comments: … … 288 288 @subheading Processing: 289 289 290 This routine will alter the permissions of a node in a file 290 This routine will alter the permissions of a node in a filesystem. It is layered on 291 291 the following functions and macros: 292 292 … … 334 334 This routine currently only interacts with the file control block. If the structure of 335 335 the file control block and the associated meanings do not change, the partial 336 implementation of fcntl() should remain unaltered for other file 336 implementation of fcntl() should remain unaltered for other filesystem 337 337 implementations. 338 338 … … 369 369 @subheading Processing: 370 370 371 This routine is a template in the in memory file 371 This routine is a template in the in memory filesystem that will route us to the 372 372 appropriate handler function to carry out the fdatasync() processing. In the in 373 memory file 373 memory filesystem this function is not necessary. Its function in a disk based file 374 374 system that employs a memory cache is to flush all memory based data buffers to 375 375 disk. It is layered on the following functions and macros: … … 431 431 @end itemize 432 432 433 When a file system is mounted, a set of constants is specified for the filesystem.434 These constants are stored with the mount table entry for the file 433 When a filesystem is mounted, a set of constants is specified for the filesystem. 434 These constants are stored with the mount table entry for the filesystem. These 435 435 constants appear in the POSIX standard and are listed below. 436 436 … … 466 466 This routine will find the mount table information associated the file control block 467 467 for the specified file descriptor parameter. The mount table entry structure 468 contains a set of file 468 contains a set of filesystem specific constants that can be accessed by individual 469 469 identifiers. 470 470 … … 482 482 483 483 Pathinfo in the file control block is used to locate the mount table entry for the 484 file 484 filesystem associated with the file descriptor. 485 485 486 486 The mount table entry contains the pathconf_limits_and_options element. This 487 element is a table of constants that is associated with the file 487 element is a table of constants that is associated with the filesystem. 488 488 489 489 The name argument is used to reference the desired constant from the … … 506 506 routine. 507 507 508 If the file descriptor is associated with a node under a file 508 If the file descriptor is associated with a node under a filesystem, the fstat() 509 509 routine will map to the fstat() function taken from the node handler table. 510 510 … … 522 522 system nodes. 523 523 524 If the file descriptor is associated with a node under a file 524 If the file descriptor is associated with a node under a filesystem, the following 525 525 steps are performed: 526 526 … … 549 549 Not defined in the POSIX 1003.1b standard but commonly supported in most 550 550 UNIX and POSIX system. Ioctl() is a catchall for I/O operations. Routine is 551 layered on external network handlers and file 552 development of new file 551 layered on external network handlers and filesystem specific handlers. The 552 development of new filesystems should not alter the basic processing performed 553 553 by this routine. 554 554 … … 560 560 returned by this handler is then returned to the calling program. 561 561 562 File descriptors that are associated with a file 562 File descriptors that are associated with a filesystem undergo the following 563 563 processing: 564 564 … … 591 591 592 592 This routine will establish a hard link to a file, directory or a device. The target of 593 the hard link must be in the same file 593 the hard link must be in the same filesystem as the new link being created. A link 594 594 to an existing link is also permitted but the existing link is evaluated before the 595 595 new link is made. This implies that links to links are reduced to links to files, … … 608 608 evaluation of the new name. This macro examines the first characters of the name 609 609 to see if the name of the new link starts with a rtems_filesystem_is_separator. If it 610 does the search starts from the root of the RTEMS file 610 does the search starts from the root of the RTEMS filesystem; otherwise the 611 611 search will start from the current directory. 612 612 613 The OPS table evalformake() function for the parent's file 613 The OPS table evalformake() function for the parent's filesystem is used to 614 614 locate the node that will be the parent of the new link. It will also locate the start 615 615 of the new path's name. This name will be used to define a child under the parent … … 617 617 618 618 If the parent is found, the routine will determine if the hard link that we are trying 619 to create will cross a file 620 621 If the hard-link does not cross a file 619 to create will cross a filesystem boundary. This is not permitted for hard-links. 620 621 If the hard-link does not cross a filesystem boundary, a check is performed to 622 622 determine if the OPS table contains an entry for the link() function. 623 623 624 624 If a link() function is defined, the OPS table link () function will be called to 625 establish the actual link within the file 625 establish the actual link within the filesystem. 626 626 627 627 The return code from the OPS table link() function is returned to the calling … … 637 637 @subheading Processing: 638 638 639 This routine is layered on both external handlers and file 640 specific handlers. This routine should allow for the support of new file 639 This routine is layered on both external handlers and filesystem / node type 640 specific handlers. This routine should allow for the support of new filesystems 641 641 without modification. 642 642 … … 649 649 650 650 If the file descriptor is not associated with a network connection, it is associated 651 with a node in a file system. The following steps will be performed for filesystem nodes:651 with a node in a filesystem. The following steps will be performed for filesystem nodes: 652 652 653 653 @enumerate … … 682 682 @subheading Processing: 683 683 684 This routine attempts to create a directory node under the file 684 This routine attempts to create a directory node under the filesystem. The routine 685 685 is layered the mknod() function. 686 686 … … 698 698 @subheading Processing: 699 699 700 This routine attempts to create a FIFO node under the file 700 This routine attempts to create a FIFO node under the filesystem. The routine is 701 701 layered the mknod() function. 702 702 … … 715 715 716 716 This function will allow for the creation of the following types of nodes under the 717 file 717 filesystem: 718 718 719 719 @itemize @bullet … … 732 732 733 733 At the present time, an attempt to create a FIFO will result in an ENOTSUP error 734 to the calling function. This routine is layered the file 735 evalformake and mknod. The introduction of a new file 734 to the calling function. This routine is layered the filesystem specific routines 735 evalformake and mknod. The introduction of a new filesystem must include its 736 736 own evalformake and mknod function to support the generic mknod() function. 737 737 Under this condition the generic mknod() function should accommodate other 738 file 738 filesystem types without alteration. 739 739 740 740 @subheading Development Comments: … … 768 768 creation of a node. 769 769 770 If the pathname is a valid location to create a node, verify that a file 770 If the pathname is a valid location to create a node, verify that a filesystem 771 771 specific mknod() function exists. 772 772 773 If the mknod() function exists, call the file 773 If the mknod() function exists, call the filesystem specific mknod () function. 774 774 Pass the name, mode, device type and the location information associated with the 775 775 directory under which the node will be created. … … 797 797 system type without keeping a dynamic database of all possible file 798 798 system types that are valid for the mount operation. Using this method, it 799 is only necessary to configure the file 800 RTEMS build. Unused file 799 is only necessary to configure the filesystems that we wish to use into the 800 RTEMS build. Unused filesystems types will not be drawn into the build. 801 801 802 802 char *fsoptions, … … 808 808 809 809 This argument is reserved for the name of a device that will be used to 810 access the file system information. Current filesystem implementations811 are memory based and do not require a device to access file 810 access the filesystem information. Current filesystem implementations 811 are memory based and do not require a device to access filesystem 812 812 information. 813 813 814 814 char *mount_point 815 815 816 This is a pathname to a directory in a currently mounted file 816 This is a pathname to a directory in a currently mounted filesystem that 817 817 allows read, write and execute permissions. 818 818 819 819 @subheading Processing: 820 820 821 This routine will handle the mounting of a file 821 This routine will handle the mounting of a filesystem on a mount point. If the 822 822 operation is successful, a pointer to the mount table chain entry associated with 823 the mounted file 824 about the processing required at the mount point and within the file 825 mounted is isolated in the file 823 the mounted filesystem will be returned to the calling function. The specifics 824 about the processing required at the mount point and within the filesystem being 825 mounted is isolated in the filesystem specific mount() and fsmount_me () 826 826 functions. This allows the generic mount() function to remain unaltered even if 827 new file 827 new filesystem types are introduced. 828 828 829 829 … … 834 834 are valid ("RO" or "RW"). 835 835 836 It confirms that a file 836 It confirms that a filesystem ops-table has been selected. 837 837 838 838 Space is allocated for a mount table entry and selective elements of the temporary … … 841 841 If a mount point is specified: 842 842 The mount point is examined to determine that it is a directory and also 843 has the appropriate permissions to allow a file 843 has the appropriate permissions to allow a filesystem to be mounted. 844 844 845 845 The current mount table chain is searched to determine that there is not 846 another file 846 another filesystem mounted at the mount point we are trying to mount 847 847 onto. 848 848 849 If a mount function is defined in the ops table for the file 849 If a mount function is defined in the ops table for the filesystem 850 850 containing the mount point, it is called at this time. 851 851 852 852 If no mount point is specified: 853 853 Processing if performed to set up the mount table chain entry as the base 854 file 855 856 If the fsmount_me() function is specified for ops-table of the file 857 mounted, that function is called to initialize for the new file 854 filesystem. 855 856 If the fsmount_me() function is specified for ops-table of the filesystem being 857 mounted, that function is called to initialize for the new filesystem. 858 858 859 859 On successful completion, the temporary mount table entry will be placed on the 860 mount table chain to record the presence of the mounted file 860 mount table chain to record the presence of the mounted filesystem. 861 861 862 862 @page … … 869 869 @subheading Processing: 870 870 871 This routine is layered on both RTEMS calls and file 871 This routine is layered on both RTEMS calls and filesystem specific 872 872 implementations of the open() function. These functional interfaces should not 873 change for new file 873 change for new filesystems and therefore this code should be stable as new file 874 874 systems are introduced. 875 875 … … 881 881 It will then test to see if the pathname exists. If it does a 882 882 rtems_filesystem_location_info_t data structure will be filled out. This structure 883 contains information that associates node information, file 883 contains information that associates node information, filesystem specific 884 884 functions and mount table chain information with the pathname. 885 885 886 886 If the create option has been it will attempt to create a node for a regular file along 887 887 the specified path. If a file already exists along this path, an error will be 888 generated; otherwise, a node will be allocated for the file under the file 888 generated; otherwise, a node will be allocated for the file under the filesystem 889 889 that contains the pathname. When a new node is created, it is also evaluated so 890 890 that an appropriate rtems_filesystem_location_info_t data structure can be filled … … 894 894 structure will be initialized with handler table information, node information and 895 895 the rtems_filesystem_location_info_t data structure that describes the node and 896 file 897 898 If an open() function exists in the file 896 filesystem data in detail. 897 898 If an open() function exists in the filesystem specific handlers table for the node 899 899 that we are trying to open, it will be called at this time. 900 900 … … 917 917 This routine will attempt to open a directory for read access. It will setup a DIR 918 918 control structure that will be used to access directory information. This routine is 919 layered on the generic open() routine and file 919 layered on the generic open() routine and filesystem specific directory 920 920 processing routines. 921 921 … … 935 935 This routine will obtain the value of one of the path configuration parameters and 936 936 return it to the calling routine. It is layered on the generic open() and fpathconf () 937 functions. These interfaces should not change with the addition of new file 937 functions. These interfaces should not change with the addition of new filesystem 938 938 types. 939 939 … … 956 956 @subheading Processing: 957 957 958 This routine is layered on a set of RTEMS calls and file 958 This routine is layered on a set of RTEMS calls and filesystem specific read 959 959 operations. The functions are layered in such a way as to isolate them from 960 change as new file 960 change as new filesystems are introduced. 961 961 962 962 @subheading Development Comments: … … 968 968 will then be sent as the return code from generic read() function. 969 969 970 For file descriptors that are associated with the file 970 For file descriptors that are associated with the filesystem the following sequence 971 971 will be performed: 972 972 … … 1008 1008 1009 1009 The routine calls a customized getdents() function that is provided by the user. 1010 This routine provides the file 1010 This routine provides the filesystem specific aspects of reading a directory. 1011 1011 1012 1012 It is layered on the read() function in the directory handler table. This function … … 1022 1022 @subheading Processing: 1023 1023 1024 This routine will attempt to dismount a mounted file 1025 resources that were allocated for the management of that file 1024 This routine will attempt to dismount a mounted filesystem and then free all 1025 resources that were allocated for the management of that filesystem. 1026 1026 1027 1027 @subheading Development Comments: … … 1029 1029 @itemize @bullet 1030 1030 1031 @item This routine will determine if there are any file 1032 under the file 1033 dismount of the file 1034 1035 @item It will test to see if the current directory is in the file 1036 attempting to dismount. This would prevent the dismount of the file 1031 @item This routine will determine if there are any filesystems currently mounted 1032 under the filesystem that we are trying to dismount. This would prevent the 1033 dismount of the filesystem. 1034 1035 @item It will test to see if the current directory is in the filesystem that we are 1036 attempting to dismount. This would prevent the dismount of the filesystem. 1037 1037 1038 1038 @item It will scan all the currently open file descriptors to determine is there is an 1039 open file descriptor to a file in the file 1039 open file descriptor to a file in the filesystem that we are attempting to 1040 1040 unmount(). 1041 1041 … … 1046 1046 @enumerate 1047 1047 1048 @item Call the file system specific unmount() function for the filesystem that1048 @item Call the filesystem specific unmount() function for the filesystem that 1049 1049 contains the mount point. This routine should indicate that the mount point 1050 no longer has a file 1051 1052 @item Call the file 1053 file 1050 no longer has a filesystem mounted below it. 1051 1052 @item Call the filesystem specific fsunmount_me() function for the mounted 1053 filesystem that we are trying to unmount(). This routine should clean up 1054 1054 any resources that are no longer needed for the management of the file 1055 1055 system being un-mounted. 1056 1056 1057 @item Extract the mount table entry for the file 1057 @item Extract the mount table entry for the filesystem that was just dismounted 1058 1058 from the mount table chain. 1059 1059
Note: See TracChangeset
for help on using the changeset viewer.