Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changes between Version 20 and Version 21 of FSDesign


Ignore:
Timestamp:
2009-11-17T17:17:40Z (10 years ago)
Author:
Jakub Jermář
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • FSDesign

    v20 v21  
    141141=== PLB and canonical file paths ===
    142142
    143 VFS and the endpoint file system servers cooperate in resolving file system paths to VFS triplets. Roughly speaking, VFS consults the file systems mounted along the given path. Each of them resolves maximum of the yet unresolved portion of the path until it either reaches a mount point or the end of the path. Eventually, the last file system server will manage to resolve the path and reply to the VFS server by sending the resulting VFS triplet. One of the design goals of the HelenOS file system layer is to avoid the situation in which a path or its portion would be repeatedly copied back and forth between VFS and each endpoint file system server. In order to meet this design criteria, VFS allocates and maintains a ring buffer in which it stores all looked-up paths. Owing to its use, the buffer is called Pathname Lookup Buffer, or PLB, and each endpoint file system server shares it read-only with VFS. The paths are places into the buffer by the above mentioned function ''vfs_lookup_internal()''.
     143VFS and the endpoint file system servers cooperate in resolving file system paths to VFS triplets. Roughly speaking, VFS consults the file systems mounted along the given path. Each of them resolves maximum of the yet unresolved portion of the path until it either reaches a mount point or the end of the path. Eventually, the last file system server will manage to resolve the path and reply to the VFS server by sending the resulting VFS triplet. One of the design goals of the HelenOS file system layer is to avoid the situation in which a path or its portion would be repeatedly copied back and forth between VFS and each endpoint file system server. In order to meet this design criteria, VFS allocates and maintains a ring buffer in which it stores all looked-up paths. Owing to its use, the buffer is called Pathname Lookup Buffer, or PLB, and each endpoint file system server shares it read-only with VFS. The paths are placed into the buffer by the above mentioned function ''vfs_lookup_internal()''.
     144
     145To maximally ease the process of path resolution, the PLB is expected to contain only paths that are in the canonical form, which can be defined as follows:
     146
     147 1. the path is absolute (i.e. a/b/c is not canonical)
     148
     149 2. there is no trailing slash in the path (i.e. /a/b/c/ is not canonical)
     150
     151 3. there is no extra slash in the path (i.e. /a//b/c is not canonical)
     152
     153 4. there is no ''dot'' component in the path (i.e. /a/./b/c is not canonical)
     154
     155 5. there is no 'dot-dot' component in the path (i.e. /a/b/../c is not canonical)
     156 
     157The standard library contains the ''canonify()'' function, which checks whether a path is canonical and possibly converts a non-canonical path to a canonical one.
     158
     159In a more detailed view, the path translation starts by ''vfs_lookup_internal()'' storing a canonical path into the PLB. VFS then contacts the file system server which is mounted under the file system root and sends it the VFS_OUT_LOOKUP request along with the indices of the first and last characters of the path in the PLB. After the root file system resolves its part of the path it does not necessarily reply back to VFS. If there is still a portion of the path to be resolved, it forwards the VFS_OUT_LOOKUP request to the file system which is mounted under the mount point where the resolution stopped. At the same time, it modifies the argument of the forwarded call, which contains the PLB index of the path's first character, to index the first character of the yet unresolved portion of the path. The resolution continues in the same spirit until one of the file system servers reaches the end of the path. This file system will complete the path resolution by specifying the VFS triplet of the resulting node in an answer to the VFS_OUT_LOOKUP request. The answer will go directly to the originator of the request, which is the VFS server.