source: rtems-docs/filesystem/pathname_eval.rst @ 489740f

4.115
Last change on this file since 489740f was 489740f, checked in by Chris Johns <chrisj@…>, on 05/20/16 at 02:47:09

Set SPDX License Identifier in each source file.

  • Property mode set to 100644
File size: 4.1 KB
Line 
1.. comment SPDX-License-Identifier: CC-BY-SA-4.0
2
3Pathname Evaluation
4###################
5
6This chapter describes the pathname evaluation process for the
7RTEMS Filesystem Infrastructure.
8.. code:: c
9
10    XXX Include graphic of the path evaluation process
11
12Pathname Evaluation Handlers
13============================
14
15There are two pathname evaluation routines.  The handler patheval()
16is called to find, verify privlages on and return information on a node
17that exists.  The handler evalformake() is called to find, verify
18permissions, and return information on a node that is to become a parent.
19Additionally, evalformake() returns a pointer to the start of the name of
20the new node to be created.
21
22Pathname evaluation is specific to a filesystem.
23Each filesystem is required to provide both a patheval() and an evalformake()
24routine.  Both of these routines gets a name to evaluate and a node indicating
25where to start the evaluation.
26
27Crossing a Mount Point During Path Evaluation
28=============================================
29
30If the filesystem supports the mount command, the evaluate routines
31must handle crossing the mountpoint.  The evaluate routine should evaluate
32the name upto the first directory node where the new filesystem is mounted.
33The filesystem may process terminator characters prior to calling the
34evaluate routine for the new filesystem.   A pointer to the portion of the
35name which has not been evaluated along with the root node of the new
36file system ( gotten from the mount table entry ) is passed to the correct
37mounted filesystem evaluate routine.
38
39The rtems_filesystem_location_info_t Structure
40==============================================
41
42The ``rtems_filesystem_location_info_t`` structure contains all information
43necessary for identification of a node.
44
45The generic rtems filesystem code defines two global
46rtems_filesystem_location_info_t structures, the``rtems_filesystem_root`` and the ``rtems_filesystem_current``.
47Both are initially defined to be the root node of the base filesystem.
48Once the chdir command is correctly used the ``rtems_filesystem_current``
49is set to the location specified by the command.
50
51The filesystem generic code peeks at the first character in the name to be
52evaluated.  If this character is a valid seperator, the``rtems_filesystem_root`` is used as the node to start the evaluation
53with.  Otherwise, the ``rtems_filesystem_current`` node is used as the
54node to start evaluating with.  Therefore, a valid
55rtems_filesystem_location_info_t is given to the evaluate routine to start
56evaluation with.  The evaluate routines are then responsible for making
57any changes necessary to this structure to correspond to the name being
58parsed.
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
Note: See TracBrowser for help on using the repository browser.