source: rtems-docs/filesystem/pathname_eval.rst

Last change on this file was e52906b, checked in by Sebastian Huber <sebastian.huber@…>, on 01/09/19 at 15:14:06

Simplify SPDX-License-Identifier comment

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