Document revision date: 30 March 2001 | |
![]() |
![]() ![]() ![]() ![]() |
![]() |
Previous | Contents | Index |
The file SYS$EXAMPLES:CDROM_AUDIO.C contains an example of an application program that performs the following tasks:
You can obtain information on all disk device characteristics by using the Get Device/Volume Information ($GETDVI) system service (refer to the OpenVMS System Services Reference Manual).
$GETDVI returns disk characteristics when you specify the item codes DVI$_DEVCHAR and DVI$_DEVCHAR2. Table 2-4 lists the possible characteristics for disk devices.
Characteristic1 | Meaning |
---|---|
Dynamic Bits (Conditionally Set) | |
DEV$M_AVL | Device is on line and available. |
DEV$M_CDP 2,3 | Dual-path device with two unit control blocks (UCBs). |
DEV$M_CLU 2 | Device is available clusterwide. |
DEV$M_2P 2 | Device is dual-pathed. |
DEV$M_FOR | Device is foreign. |
DEV$M_MNT | Volume is mounted. |
DEV$M_RCK | Perform data check on all reads. |
DEV$M_WCK | Perform data check on all writes. |
DEV$M_MSCP 2 | Device is accessed using the mass storage control protocol. |
DEV$M_RCT | Disk contains replacement and caching table. |
DEV$M_SRV 2 | For a cluster, device is served by the MSCP server. |
Static Bits (Always Set) | |
DEV$M_FOD | Device is file-oriented. |
DEV$M_IDV | Device is capable of input. |
DEV$M_ODV | Device is capable of output. |
DEV$M_RND | Device is capable of random access. |
DEV$M_SHR | Device is shareable. |
DVI$_DEVBUFSIZ returns the buffer size. The buffer size is the default to be used for disk transfers (this default is normally 512 bytes). DVI$_DEVTYPE and DVI$_DEVCLASS return the device type and class names, which are defined by the $DCDEF macro. The disk model determines the device type. For example, the device type for the RA81 is DT$_RA81. (Foreign device types take the form DT$_FD1 through DT$_FD8.) The device class for disks is DC$_DISK.
DVI$_CYLINDERS returns the number of cylinders per volume (that is, per disk), DVI$_TRACKS returns the number of tracks per cylinder, and DVI$_SECTORS returns the number of sectors per track. Values are returned as 4-byte decimal numbers.
DVI$_MAXBLOCK returns the maximum number of blocks (1 block = 512
bytes) that can be contained on the volume (that is, on the disk).
Values are returned as 4-byte decimal numbers. This information can be
used, for example, to determine the density of an RX02 diskette (single
density = 494 blocks, double density = 988 blocks).
2.4 Disk Function Codes
Disk drivers can perform logical, virtual, and physical I/O functions. Foreign-mounted devices do not require privilege to perform logical and virtual I/O requests.
Logical and physical I/O functions allow access to volume storage and require only that the issuing process have access to the volume. However, DSA disks and the disk class driver (DUDRIVER) do not accept physical QIO data transfers or seek operations.
The results of logical and physical I/O operations are unpredictable if an ancillary control process (ACP) or extended QIO processing (XQP) is present. |
Virtual I/O functions require an ACP for Files-11 On-Disk Structure Level 1 files or an XQP for Files-11 On-Disk Structure Level 2 files. Virtual I/O functions must be executed in a prescribed order. First, you create and access a file, then you write information to that file, and lastly you deaccess the file. Subsequently, when you access the file, you read the information and then deaccess the file. Delete the file when the information is no longer useful.
Non-DSA disk devices can read or write up to 65,535 bytes in a single request. DSA devices connected to an HSC50 can transfer up to 4 billion bytes in a single request. In all cases, the maximum size of the transfer is limited by the number of pages that can be faulted into the process's working set, and then locked into physical memory. (The disk driver is responsible for any memory management functions of this type.) The size of the transfer does not affect the applicable quotas (direct I/O count, buffered I/O count, and asynchronous system trap (AST) count limit). These quotas refer to the number of outstanding I/O operations of each type, not the size of the I/O operation being performed.
The volume to which a logical or virtual function is directed must be mounted for the function actually to be executed. If it is not mounted, either a device not mounted or invalid volume status is returned in the I/O status block.
Table 2-5 lists the logical, virtual, and physical disk I/O functions and their function codes. Chapter 1 describes the QIO level interface to the disk device ACP.
Function Code | Arguments | Type1 | Function Modifiers |
Function |
---|---|---|---|---|
IO$_ACCESS | P1, [P2],[P3],[P4],[P5] | V |
IO$M_CREATE
IO$M_ACCESS |
Search a directory for a specified file and access the file if found. |
IO$_ACPCONTROL | P1,[P2],[P3],[P4],[P5] | V | IO$M_DMOUNT | Perform miscellaneous control functions. |
IO$_AVAILABLE | P | Clear volume valid; make DSA units available. | ||
IO$_CREATE | P1,[P2],[P3],[P4],[P5] | V |
IO$M_CREATE
IO$M_ACCESS IO$M_DELETE |
Create a directory entry or a file. |
IO$_DEACCESS | P1,[P2],[P3],[P4],[P5] | V | Deaccess a file and, if specified, write final attributes in the file header. | |
IO$_DELETE | P1,[P2],[P3],[P4],[P5] | V | IO$M_DELETE | Remove a directory entry or file header, or both. |
IO$_FORMAT | P1 | P | Set density (RX02 only). | |
IO$_MODIFY | P1,[P2],[P3],[P4],[P5] | V | Modify the file attributes or allocation, or both. | |
IO$_PACKACK | P | Update UCB fields if RX02; initialize volume valid on other devices. Bring DSA units on line. | ||
IO$_READLBLK 6 | P1,P2,P3 | L |
IO$M_DATACHECK
2
IO$M_INHRETRY |
Read logical block. |
IO$_READPBLK 6 | P1,P2,P3 | P |
IO$M_DATACHECK
2
IO$M_INHRETRY IO$M_INHSEEK 3 |
Read physical block. 5 |
IO$_READVBLK 6 | P1,P2,P3 | V |
IO$M_DATACHECK
2
IO$M_INHRETRY |
Read virtual block. |
IO$_SEARCH | P1 | P | Search for specified block or sector (only for TU58). | |
IO$_SEEK | P1 | P | Seek to specified cylinder. 5 | |
IO$_SENSECHAR | P | Sense the device-dependent characteristics and return them in the I/O status block. | ||
IO$_SENSEMODE | L | Sense the device-dependent characteristics and return them in the I/O status block. | ||
IO$_SETPRFPATH | P1 | P | IO$M_FORCEPTH | Specifies a preferred path for DSA disks. |
IO$_UNLOAD | P | Clear volume valid; make DSA units available and spin down the volume. | ||
IO$_WRITECHECK 6 | P1,P2,P3 | P | Verify data written to disk by a previous write QIO. 2 | |
IO$_WRITELBLK 6 | P1,P2,P3 | L |
IO$M_DATACHECK
2
IO$M_ERASE IO$M_INHRETRY |
Write logical block. |
IO$_WRITEPBLK 6 | P1,P2,P3 | P |
IO$M_DATACHECK
2
IO$M_ERASE IO$M_INHRETRY IO$M_INHSEEK 3 IO$M_DELDATA 4 |
Write physical block. 5 |
IO$_WRITEVBLK 6 | P1,P2,P3 | V |
IO$M_DATACHECK
2
IO$M_ERASE IO$M_INHRETRY |
Write virtual block. |
The function-dependent arguments for IO$_CREATE, IO$_ACCESS, IO$_DEACCESS, IO$_MODIFY, and IO$_DELETE are as follows:
See Chapter 1 for more information on these functions.
The function-dependent arguments for IO$_READVBLK, IO$_READLBLK, IO$_WRITEVBLK, and IO$_WRITELBLK are as follows:
The function-dependent arguments for IO$_WRITEVBLK, IO$_WRITELBLK, and IO$_WRITEPBLK functions that include the IO$M_ERASE function modifier are as follows:
DSA disk controllers provide controlled, assisted erasing for the IO$M_ERASE modifier (with virtual and logical write functions) only when the erase pattern is all zeros. If a nonzero erase pattern is used, there is a significant performance degradation with these disks. DSA disks do not accept physical QIO transfers. |
The function-dependent arguments for IO$_WRITECHECK, IO$_READPBLK, and IO$_WRITEPBLK are as follows:
On the RB80 and RM80, do not address cylinders 560 and 561. These two cylinders are used for diagnostic testing only. |
The function-dependent argument for IO$_SEARCH is as follows:
P1---The physical disk address where the tape is positioned. The address is expressed as sector, track, and cylinder in the format shown in Figure 2-5.
Figure 2-5 Starting Physical Address
The function-dependent argument for IO$_SEEK is as follows:
P1---The physical cylinder number where the disk heads are positioned. The address is expressed in the format shown in Figure 2-6.
Figure 2-6 Physical Cylinder Number Format
The function-dependent argument for IO$_FORMAT is as follows:
P1---The density at which an RX02 diskette is reformatted (see Section 2.4.4).
The read function reads data into a specified buffer from disk starting at a specified disk address.
The operating system provides the following read function codes:
If a read virtual block function is directed to a volume that is mounted foreign, that function is converted to read logical block. If a read virtual block function is directed to a volume that is mounted structured, the volume is handled in the same way as for a file-structured device.
Three function-dependent arguments are used with these codes: P1, P2, and P3. These arguments are described in Section 2.4.
The data check function modifier (IO$M_DATACHECK) can be used with all read functions. If this modifier is specified, a data check operation is performed after the read operation completes. A data check operation is also performed if the volume that has been read, or the volume on which the file resides (virtual read) has the characteristic "data check all reads." Furthermore, a data check is performed after a virtual read if the file has the attribute "data check on read." The RX01 and RX02 drivers do not support the data check function.
If IO$M_DATACHECK is specified with a read function code to a TU58, or if the volume read has the characteristic "data check all reads," a read check operation is performed. This alters certain TU58 hardware parameters when the tape is read. (The read threshold in the data recovery circuit is increased; if the tape has any weak spots, errors are detected.)
The data check function modifier to a disk or tape can return five error codes in the I/O status block:
SS$_CTRLERR | SS$_DRVERR | SS$_MEDOFL |
SS$_NONEXDRV | SS$_NORMAL |
If no errors are detected, the disk or tape data is considered reliable.
The inhibit retry function modifier (IO$M_INHRETRY) can be used with
all read functions.
If this modifier is specified, all error recovery attempts are
inhibited. IO$M_INHRETRY takes precedence over IO$M_DATACHECK. If both
are specified and an error occurs, there is no attempt at error
recovery and no data check operation is performed. If an error does not
occur, the data check operation is performed.
2.4.2 Write
The write function writes data from a specified buffer to disk starting at a specified disk address.
The operating system provides the following write function codes:
If a write virtual block function is directed to a volume that is mounted foreign, the function is converted to write logical block. If a write virtual block function is directed to a volume that is mounted structured, the volume is handled in the same way as for a file-structured device.
Three function-dependent arguments are used with these codes: P1, P2, and P3. These arguments are described in Section 2.4.
The data check function modifier (IO$M_DATACHECK) can be used with all write operations. If this modifier is specified, a data check operation is performed after the write operation completes. A data check operation is also performed if the volume written, or the volume on which the file resides (virtual write), has the characteristic "data check all writes." Furthermore, a data check is performed after a virtual write if the file has the attribute "data check on write." The RX01 and RX02 drivers do not support the data check function.
If IO$M_DATACHECK is specified with a write function code to a TU58, or if the volume written has the characteristic "data check all writes," a write check operation is performed. The write check verifies data written on the tape. First, the specified data is written on the tape. Then the tape is reversed and the TU58 controller reads the data internally to perform a checksum verification. If the checksum verification is unsuccessful after eight attempts, the write check operation is aborted and an error status is returned.
The inhibit retry function modifier (IO$M_INHRETRY) can be used with all write functions. If that modifier is specified, all error recovery attempts are inhibited. IO$M_INHRETRY takes precedence over IO$M_DATACHECK. If both IO$M_INHRETRY and IO$M_DATACHECK are specified and an error occurs, there is no attempt at error recovery, and no data check operation is performed. If an error does not occur, the data check operation is performed. IO$M_INHRETRY has no effect on DSA disks.
The write deleted data function modifier (IO$M_DELDATA) can be used with the write physical block (IO$_WRITEPBLK) function to the RX02. If this modifier is specified, a deleted data address mark instead of the standard data address mark is written preceding the data. Otherwise, the operation of the IO$_WRITEPBLK function is the same; write data is transferred to the disk. When a successful read operation is performed on this data, the status code SS$_RDDELDATA is returned in the I/O status block rather than the usual SS$_NORMAL status code.
The IO$M_ERASE function modifier can be used with all write function codes to erase a user-selected part of a disk. This modifier propagates an erase pattern through the specified range. Section 2.4 describes the write function arguments to be used with IO$M_ERASE.
Previous | Next | Contents | Index |
![]() ![]() ![]() ![]() |
privacy and legal statement | ||
6136PRO_008.HTML |