|
|
New Features of MPE/iX: Using the Hierarchical File System: 300 MPE/iX Computer Systems > Chapter 4 What's New for Programmers?Hierarchical Directory Files |
|
The following sections provide information about hierarchical directory files of interest to application developers who wish to use MPE/iX system intrinsics to manage their applications within the hierarchical directory structure. A directory is a repository of information about objects on a computer system. Objects can be either files or directories. Directory services are a set of routines that manipulate directory objects and retrieve information about the objects found in a directory. Prior to MPE/iX Release 4.5, the MPE/iX directory structure organized the file system as a four-level hierarchy:
This traditional MPE directory structure was implemented to meet the demands of the commercial business community and continues to serve as an excellent directory structure. Beginning with MPE/iX Release 4.5, the directory structure has been greatly enhanced with the introduction of the MPE/iX hierarchical directory structure. The challenge Hewlett-Packard faced was to provide an "open" directory structure while preserving the traditional MPE directory structure. This has been accomplished by successfully integrating MPE/iX hierarchical directory structure within and around the traditional MPE directory structure, thus providing the benefits of both directory structures to existing and new users.
The new MPE/iX hierarchical file system directory services organize the file system as a file hierarchy. The HFS file system hierarchy conceptually resembles a tree. In the hierarchy, files are grouped together as leaf nodes in name contexts called directories. Files and directories are referred to using a pathname that describes their location in the file system hierarchy relative to either a process's root directory (absolute pathname) or current working directory (relative pathname). A process's current working directory may change during the lifetime of a process. Files may have exactly one pathname relative to the system's root directory (the absolute pathname). Each file name reference is known as a link. MPE/iX hierarchical directory services present an integrated view of the file system. There exists a common root for all directories (exposing the traditional MPE root directory to users). Traditional MPE accounts and groups are considered in the HFS context to be directories. However, they are special directory structures that include hierarchical directory behavior while continuing to serve within the MPE framework. Following are special features of the MPE/iX root directory and MPE/iX account and group directories to ensure both backward compatibility and forward benefit.
MPE/iX hierarchical directory services can access any file in the file system hierarchy including files in the traditional MPE directory structure using HFS syntax. For example, both of the following fully qualified file name specifications refer to the same file.
Beginning with MPE/iX Release 4.5, the directory file type is available to allow an MPE/iX file to reproduce POSIX directory file behavior. The POSIX standard defines a directory to be a special file that contains directory entries of all files and directories located directly beneath it. Users can create directories and read directory entries but cannot directly write to directory files. Instead, the system creates a new directory entry each time a file is created and placed in that directory, and it removes the entry when the file either purged or moved to a different directory.
You use the HPFOPEN intrinsic to create a hierarchical directory. The FOPEN intrinsic can open an existing hierarchical directory but cannot create one because the foptions parameter cannot be extended to specify a file type of directory or a record format type of hierarchical directory. The following table defines the file and access attributes imposed on a hierarchical directory when it is created. These attributes cannot be changed during the life of the hierarchical directory. Table 4-2 HFS Directory File Attributes and/or Access Options
When a hierarchical directory is first created, two special directory files are placed in the directory:
The dot and dot-dot directories provide additional navigation aids to a process. Applications using the dot and dot-dot directories to express a directory or parent directory need not be concerned with their absolute location on the system. The dot and dot-dot directories can be opened just like any other hierarchical directory. File information intrinsics can be used to return information about these directories. However, the dot and dot-dot directories cannot be modified by a user. In addition, these two directories cannot be explicitly purged except by purging the directory they live in.
Both HPFOPEN and FOPEN can be used to open an existing hierarchical directory. The HPFOPEN intrinsic provides the "read directory" access option when creating or opening a directory, but there are no system intrinsics that allow you to either read from or write to a directory. Note that POSIX interfaces exist to read directory entries from directories. The system itself manages a directory file, managing read access during pathname resolution and write access when new files are either created or purged in the hierarchical directory. The FCONTROL intrinsic item number 5 "rewind" option allows you to rewind a hierarchical directory entry pointer to the first entry of the directory. The following file information intrinsics provide support for hierarchical directory files:
The FCLOSE intrinsic has been enhanced to allow you to close a hierarchical directory, but the directory must be closed in the permanent file domain. For more information, refer to the section "Closing a File" later in this chapter. You cannot purge a hierarchical directory that has entries in it other than the dot and dot-dot directory entries. You must first purge all objects under a hierarchical directory before you can purge that directory. The only exception to this rule is when you use the PURGEGROUP command from the MPE/iX CI to purge an MPE/iX group directory, or the PURGEACCT command to purge an MPE/iX account directory (and all groups under it). When this occurs, all hierarchical directories located under the purged groups are automatically purged, whether or not they contain entries. |
|