source: rtems-docs/filesystem/pathname_eval.rst @ 42d50d7

5
Last change on this file since 42d50d7 was 5431beb, checked in by Chris Johns <chrisj@…>, on 11/09/16 at 05:54:02

filesystem: Fix header levels.

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