1 | .. comment SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | Pathname Evaluation |
---|
4 | ################### |
---|
5 | |
---|
6 | This chapter describes the pathname evaluation process for the |
---|
7 | RTEMS Filesystem Infrastructure. |
---|
8 | .. code:: c |
---|
9 | |
---|
10 | XXX Include graphic of the path evaluation process |
---|
11 | |
---|
12 | Pathname Evaluation Handlers |
---|
13 | ============================ |
---|
14 | |
---|
15 | There are two pathname evaluation routines. The handler patheval() |
---|
16 | is called to find, verify privlages on and return information on a node |
---|
17 | that exists. The handler evalformake() is called to find, verify |
---|
18 | permissions, and return information on a node that is to become a parent. |
---|
19 | Additionally, evalformake() returns a pointer to the start of the name of |
---|
20 | the new node to be created. |
---|
21 | |
---|
22 | Pathname evaluation is specific to a filesystem. |
---|
23 | Each filesystem is required to provide both a patheval() and an evalformake() |
---|
24 | routine. Both of these routines gets a name to evaluate and a node indicating |
---|
25 | where to start the evaluation. |
---|
26 | |
---|
27 | Crossing a Mount Point During Path Evaluation |
---|
28 | ============================================= |
---|
29 | |
---|
30 | If the filesystem supports the mount command, the evaluate routines |
---|
31 | must handle crossing the mountpoint. The evaluate routine should evaluate |
---|
32 | the name upto the first directory node where the new filesystem is mounted. |
---|
33 | The filesystem may process terminator characters prior to calling the |
---|
34 | evaluate routine for the new filesystem. A pointer to the portion of the |
---|
35 | name which has not been evaluated along with the root node of the new |
---|
36 | file system ( gotten from the mount table entry ) is passed to the correct |
---|
37 | mounted filesystem evaluate routine. |
---|
38 | |
---|
39 | The rtems_filesystem_location_info_t Structure |
---|
40 | ============================================== |
---|
41 | |
---|
42 | The ``rtems_filesystem_location_info_t`` structure contains all information |
---|
43 | necessary for identification of a node. |
---|
44 | |
---|
45 | The generic rtems filesystem code defines two global |
---|
46 | rtems_filesystem_location_info_t structures, the``rtems_filesystem_root`` and the ``rtems_filesystem_current``. |
---|
47 | Both are initially defined to be the root node of the base filesystem. |
---|
48 | Once the chdir command is correctly used the ``rtems_filesystem_current`` |
---|
49 | is set to the location specified by the command. |
---|
50 | |
---|
51 | The filesystem generic code peeks at the first character in the name to be |
---|
52 | evaluated. If this character is a valid seperator, the``rtems_filesystem_root`` is used as the node to start the evaluation |
---|
53 | with. Otherwise, the ``rtems_filesystem_current`` node is used as the |
---|
54 | node to start evaluating with. Therefore, a valid |
---|
55 | rtems_filesystem_location_info_t is given to the evaluate routine to start |
---|
56 | evaluation with. The evaluate routines are then responsible for making |
---|
57 | any changes necessary to this structure to correspond to the name being |
---|
58 | parsed. |
---|
59 | .. code:: c |
---|
60 | |
---|
61 | struct rtems_filesystem_location_info_tt { |
---|
62 | void \*node_access; |
---|
63 | rtems_filesystem_file_handlers_r \*handlers; |
---|
64 | rtems_filesystem_operations_table \*ops; |
---|
65 | rtems_filesystem_mount_table_entry_t \*mt_entry; |
---|
66 | }; |
---|
67 | |
---|
68 | *node_access* |
---|
69 | This element is filesystem specific. A filesystem can define and store |
---|
70 | any information necessary to identify a node at this location. This element |
---|
71 | is normally filled in by the filesystem's evaluate routine. For the |
---|
72 | filesystem's root node, the filesystem's initilization routine should |
---|
73 | fill this in, and it should remain valid until the instance of the |
---|
74 | filesystem is unmounted. |
---|
75 | |
---|
76 | *handlers* |
---|
77 | This element is defined as a set of routines that may change within a |
---|
78 | given filesystem based upon node type. For example a directory and a |
---|
79 | memory file may have to completely different read routines. This element |
---|
80 | is set to an initialization state defined by the mount table, and may |
---|
81 | be set to the desired state by the evaluation routines. |
---|
82 | |
---|
83 | *ops* |
---|
84 | This element is defined as a set of routines that remain static for the |
---|
85 | filesystem. This element identifies entry points into the filesystem |
---|
86 | to the generic code. |
---|
87 | |
---|
88 | *mt_entry* |
---|
89 | This element identifies the mount table entry for this instance of the |
---|
90 | filesystem. |
---|
91 | |
---|
92 | .. COMMENT: COPYRIGHT (c) 1988-2002. |
---|
93 | |
---|
94 | .. COMMENT: On-Line Applications Research Corporation (OAR). |
---|
95 | |
---|
96 | .. COMMENT: All rights reserved. |
---|
97 | |
---|