HPlogo 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

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

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.

The traditional MPE 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:

  • The root directory. This directory was never exposed to the user.

  • Accounts, or account directories, immediately under the root directory. Only group directories were allowed under account directories.

  • Groups, or group directories, at the level immediately under account directories. Only files are allowed under group directories.

  • Files at the level immediately under group directories.

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.

NOTE: All existing applications provided on HP 3000 Series 900 computer systems continue to function exactly as they have in the past. In the future, more and more applications will be available that take advantage of the new MPE/iX hierarchical directory structure. This includes both POSIX-conformant applications as well as existing applications enhanced to take advantage of MPE/iX "Open" features.

MPE/iX hierarchical directory structure features

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.

Root directory features

  • The MPE/iX root directory (/) cannot be renamed, copied, or purged.

  • Only users with SM capability can create objects directly under the root directory.

  • Access permissions for the root directory are RD (read directory) and TD (traverse directory) for all users and CD (create directory entries) and DD (delete directory entries) for none. Attempts to remove or change access permissions of the root directory result in an error.

  • Names of files and hierarchical directories created directly under the root directory are restricted to 16 characters in length.

  • The root directory is restricted to the MPE/iX system volume set.

  • The root directory does not contain explicit dot (.) and dot-dot (..) directories; however, dot and dot-dot directory behavior is supported.

  • The user ID (UID) and group ID (GID) associated with the root directory cannot be modified.

Account directory features

  • MPE/iX accounts can be created directly under the root directory only by a user with SM capability using the MPE/iX NEWACCT command. MPE/iX accounts cannot be created, renamed, copied, or purged through the MPE/iX shell.

  • GID = account name

  • Access permissions for an MPE/iX account are RD & TD for all users and CD & DD for none. Attempts to use the ALTSEC command or chmod MPE/iX shell command to remove access permissions of an MPE/iX account result in an error.

  • When an MPE/iX account name is a component in an HFS pathname, it must be specified in uppercase.

  • MPE/iX accounts are restricted to the MPE/iX system volume set.

  • MPE/iX accounting limits for disk space apply to both hierarchical directories and files located at all levels under MPE/iX groups.

  • An MPE/iX account does not contain explicit dot and dot-dot directories; however, dot and dot-dot directory behavior is supported.

  • The user ID (UID) and group ID (GID) associated with an MPE/iX account cannot be modified.

  • Names of files and directories created under accounts are limited to 16 characters.

Group directory features

  • MPE/iX groups can be created directly under MPE/iX accounts only by a user with SM capability or a user with AM capability who is a member of that account (whose GID matches the GID of the account), using the MPE/iX NEWGROUP command. They can be modified using the ALTGROUP command. MPE/iX groups cannot be created, modified, or purged through the MPE/iX shell.

  • Default access permissions for MPE/iX groups are RD & TD for all users and CD access for none. Attempts to remove access permissions of an MPE/iX group result in an error. An MPE/iX group must have MPE/iX save access assigned to it before files and directories can be created at any level under it. For more information about MPE/iX save access, refer to the manual Manager's Guide to MPE/iX Security (32650-90474).

  • When an MPE/iX group name is a component in an HFS pathname, it must be specified in uppercase.

  • GID inheritance from ACCOUNT.

  • Names of files and hierarchical directories created directly under MPE/iX groups are restricted to 16 characters in length.

  • MPE/iX groups (and, indirectly, all files and hierarchical directories at all levels under them) can optionally be assigned to a user volume set.

  • MPE/iX accounting limits for disk space apply to both hierarchical directories and files located at all levels under MPE/iX groups.

  • An MPE/iX group does not contain explicit dot and dot-dot directories; however, dot and dot-dot directory behavior is supported.

  • The user ID (UID) and group ID (GID) associated with an MPE/iX group cannot be modified.

Hierarchical directory features

  • Hierarchical directories cannot be copied. Hierarchical directories can be purged only when they are empty (containing only the dot and dot-dot directory entries).

  • HFS directories can be renamed through the POSIX.1 rename function, or through the shell MV command. The renaming of a directory must be within the same disk space accounting domain.

  • Users can define and modify access permissions for hierarchical directories.

  • The group ID (GID) of a hierarchical directory is inherited from its parent directory. The user ID (UID) of a hierarchical directory is inherited from the user who created it. The UID and GID of a hierarchical directory can be modified using the ALTSEC command or the MPE/iX shell chown command.

  • Hierarchical directories (and all objects under them) that are not under MPE/iX groups are restricted to the MPE/iX system volume set.

  • Names of hierarchical directories and files located directly under either the system's root directory or MPE/iX accounts or groups are restricted to 16 characters in length.

  • Names of files and hierarchical directories created directly under a hierarchical directory are restricted to 255 characters in length.

  • Hierarchical directories contain explicit dot and dot-dot directory entries.

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.

   MYFILE.MYGROUP.MYACCT



   /MYACCT/MYGROUP/MYFILE

Hierarchical directory files

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.

NOTE: In this manual, the term "hierarchical directory" is used to refer to an MPE/iX disk file whose file type is directory, and its record type is the hierarchical directory record type.

Creating a hierarchical 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

Attribute NameDefault
File typeDirectory (DIR) disk file. Must be explicitly specified in order to create a hierarchical directory.
Dynamic lockingDisabled. Any value other than 0 will result in error.
ExclusiveShared. Any attempt to open with exclusive access(1) will result in error.
Nowait I/ODisabled. Any attempt to open nowait(1) will result in error.
Record formatHierarchical directory. All other specifications are ignored.
DomainCreate as a permanent file. All other specifications are ignored.
Carriage controlSpecifying cctl will result in error.
Access typeDirectory read access. Must be explicitly specified to create a hierarchical directory.
MultirecordMultirecord access (MULTI). All other specifications are ignored.
ASCII/binaryASCII. All other specifications are ignored.
Remote environmentRemote access to hierarchical directories is not supported. Specifying this option results in an error.
File sizeTwo gigabytes. Specifying a file size will result in error.
Copy modeIgnored.
Record size32 bytes. Any value specified will be ignored.
File codeSpecifying any value will result in error.
Number of buffersIgnored.
User labelsNot allowed. Attempting to specify this option results in an error.
File equationsOnly applicable with MPE namespace directories.

 

The dot (.) and dot-dot (..) directories

When a hierarchical directory is first created, two special directory files are placed in the directory:

  • The dot (.) directory entry is an alternative way to specify the directory itself without having to use a formal directory file name.

  • The dot-dot (..) directory is an alternative way to specify the directory's parent directory without having to use a formal directory file name.

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.

NOTE: The dot and dot-dot directories are not found explicitly under the root directory or under MPE/iX accounts and MPE/iX groups; however, dot and dot dot behavior is supported.

Opening a hierarchical directory

Both HPFOPEN and FOPEN can be used to open an existing hierarchical directory.

Record selection and data transfer

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.

Getting hierarchical directory information

The following file information intrinsics provide support for hierarchical directory files:

FFILEINFO

Item numbers 3, 52, 53, 54, and 55 have been enhanced to return information about hierarchical directories. Item numbers 80 through 91 are new.

FGETINFO

FFILEINFO is the recommended intrinsic for returning information on a hierarchical directory (or any file, for that matter). The foptions parameter of FGETINFO cannot return the file type or record format of a hierarchical directory.

FLABELINFO

Item numbers 6, 7, 8, 13, 20, and 21 have been enhanced to return information about hierarchical directories. Item numbers 37 through 49 are new.

PRINTFILEINFO

Enhanced to display information about an open hierarchical directory. For more information, refer to "Listing File Information" later in this chapter.

Closing or purging a hierarchical directory

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.

Feedback to webmaster