Directory

From VSI OpenVMS Wiki
Revision as of 06:47, 30 March 2019 by Darya.zelenina (talk | contribs) (Created page with "A '''directory''' is a file system structure that contains references to other files that are contained in the directory (including other directories). In OpenVMS, directories...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A directory is a file system structure that contains references to other files that are contained in the directory (including other directories). In OpenVMS, directories look like files with the extension of .DIR and version 1 that reside in the parent directory that contain a list of files with their FIDs.

Directory File

A directory file is a file with the extension of .DIR and version 1 that contains file names and FIDs. This file resides in the parent directory - the directory above in the directory tree - and may contain references to other directory files, in which case they are considered nested directory files. This is what a directory file looks like:

SYS0.DIR;1 

Here's a portion of a directory file dump:

Dump of file DKA0:[000000]SYS0.DIR;1 on 29-MAR-2019 15:01:02.99
File ID (11,1,0)   End of file block 1 / Allocated 16

Virtual block number 1 (00000001), 512 (0200) bytes

 2E534C4F 4F542441 49440D00 7FFF001A ......DIA$TOOLS. 000000
 7FFF001A 00000003 001C0001 00524944 DIR............. 000010
 5249442E 4D455453 5953244D 4F4D0E00 ..MOM$SYSTEM.DIR 000020
 53501200 7FFF001E 00000001 11FD0001 ..Щ...........PS 000030
 5249442E 5345524F 4850414D 45532458 X$SEMAPHORES.DIR 000040
 59530C00 7FFF0018 00000002 172E0001 ..............SY 000050
 000111FE 00015249 442E4E38 31492453 S$I18N.DIR..Ч... 000060
 

Nesting Directories

When directories reside one inside the other, i.e. directory files contain references to subdirectories, these directories are called nested. ODS-2 and ODS-5 support up to 255 directory levels:

 DKA0:[000000.SUB1.SUB2.SUB3.SUB4.SUB5.SUB6.SUB7.SUB8.SUB9.SUB10.SUB11.SUB12]

Default Directory

The default directory is the "working directory" of the user that is used to complete file specifications - they can be supplied relative to the default directory. When a user logs in, their default directory is their login default directory SYS$LOGIN. They can change the default directory with SET DEFAULT or display with SHOW DEFAULT.

So, if the user's default directory is their SYS$LOGIN and they want to access a file inside that directory, they only need to suply the file name (and sometimes type and extension), and the directory part is filled in for them. If they want to access a file in a subdirectory of their SYS$LOGIN, they only need to specify the subdirectory - or in other words, the path relative to their default directory:

 $ dir [...]

 Directory DKA0:[JDOE]

 DATA.DIR;1          REPORT.DAT;1

 Total of 2 files.

 Directory DKA0:[JDOE.DATA]

 EMPLOYEES.DB;1

 Total of 1 file.

 Grand total of 2 directories, 3 files.
 $ type report.dat
 <...>
 
 $ @process [.data]employees.db
 <...>
 

Directory Specification

In an OpenVMS file specification, the directory path is included in square brackets. A period before the first directory in the specification indicates that the path is relative to the default directory; otherwise the system looks for the first directory in the master file directory.

Directory wildcards include:

  • [-]

Signifies the parent directory

  • [...]

Signifies all directories underneath the last specified directory or the master file directory if used on its own

Master File Directory

The master file directory, [000000] is the top directory on the volume. It contains its own directory file. This is what a master file directory of a newly initialized volume looks like:

Directory DKA0:[000000]

000000.DIR;1        ALPHA_TOOLS.DIR;1   BACKUP.SYS;1        BADBLK.SYS;1
BADLOG.SYS;1        BITMAP.SYS;1        CONTIN.SYS;1        CORIMG.SYS;1
INDEXF.SYS;1        SECURITY.SYS;1      VOLSET.SYS;1

Total of 11 files.
 

This is what the master file directory of a standalone system disk looks like:


Directory DKA0:[000000]

000000.DIR;1        ALPHA_TOOLS.DIR;1   BACKUP.SYS;1        BADBLK.SYS;1
BADLOG.SYS;1        BITMAP.SYS;1        CONTIN.SYS;1        CORIMG.SYS;1
INDEXF.SYS;1        SECURITY.SYS;1      SUB1.DIR;1          SYS0.DIR;1         
VMS$COMMON.DIR;1    VOLSET.SYS;1

Total of 18 files.

 


Directory Protection

By default, directory files inherit their protection from their parent directories. Files in a given directory, on the other hand, get the default protection of the process that created them. To ensure that the files created in a directory and all subdirectories underneath it get a particular protection code, apply a Default Protection ACE to the directory file. To make sure a particular ACE is added to all new files created in the directory and all subdirectories underneath it, add an Identifier ACE with the Default attribute to the directory file.

See also