From the point of view of the user, there are three types of files:
Regular files contain whatever information users write onto them (for example, character data, source programs or binary objects). Any file other than a special file or a directory file is a regular file. Every file is a (one-dimensional) array of bytes; UnixWare imposes no further structure on the contents of files. A file of text consists simply of a string of characters, with the new-line character delimiting lines. Binary files are sequences of machine instructions as they appear in memory when the file executes. Some programs operate on files with more structure; for example, the assembler generates, and the loader expects, object files in a specific format. The programs that use files dictate their structure, not the system.
Directory files (also called ``directories'') provide the mapping (paths) between the names of files and the files themselves. Directories induce a tree-like structure on the file system as a whole to create a hierarchical system of files with directories as the nodes in the hierarchy. A directory is a file that catalogs the files, including directories (sub-directories), directly beneath it in the hierarchy.
Each user owns a directory of files, and may also create sub-directories to contain groups of files conveniently treated together. A directory behaves exactly like a regular file except that only the operating system can write onto it. UnixWare controls the contents of directories; however, users with permission may read a directory just like any other file.
The operating system maintains several directories for its own use. One of these is the root-directory. Each file in the file system can be found by tracing a path from the root-directory through a chain of directories until the desired file is reached. Other system directories contain any programs provided for general use; that is, all ``commands''; however, it is by no means necessary that a program reside in one of these directories for it to be executed.
Entries in a directory file are called links. A link associates a file-identifier with a filename. Each directory has at least two links, ``.'' (dot) and ``..'' (dot-dot). The link dot refers to the directory itself; while dot-dot refers to the parent of the directory in which dot-dot appears. Programs may read the current-directory using ``.'' without knowing its complete pathname.
The root-directory, which is the top-most node of the hierarchy, has itself as its parent-directory; thus, ``/'' is the pathname of both the root-directory and the parent-directory of the root-directory.
The directory structure is constrained to have the form of a rooted tree. Except for the special entries ``.'' and ``..'', each directory must appear as an entry in exactly one other directory, which is its parent. The reason for this is to simplify the writing of programs that visit sub-trees of the directory structure, and more important, to avoid the separation of portions of the hierarchy. If arbitrary links to directories were permitted, it would be quite difficult to detect when the last connection from the root-directory to a directory was severed.
Special files constitute the most unusual feature of the UnixWare file system. Each supported I/O device is associated with at least one special file. Special files are read and written just like regular files, but requests to read or write result in activation of the associated device-handler (driver) rather than the normal file mechanism.
An entry for each special file resides under the directory ``/dev'', although a link may be made to one of these files just as it may to a regular file. For example, to write on magnetic tape one may write on the file ``/dev/rmt''. Special files exist for peripheral devices such as terminal ports, communication links, disk drives, tape drives and for physical main memory. Of course, the active disks and memory special files are protected from indiscriminate access by appropriate read and write permissions.
There are several advantages to treating I/O devices this way: