HP OpenVMS Systems Documentation |
OpenVMS I/O User's Reference Manual
2.2.14.6 Application Program Example Using SCSI Audio Capabilities (VAX only)The file SYS$EXAMPLES:CDROM_AUDIO.C contains an example of an application program that performs the following tasks:
2.3 Disk Driver Device InformationYou can obtain information on all disk device characteristics by usingthe Get Device/Volume Information ($GETDVI) system service (refer tothe OpenVMS System Services Reference Manual). $GETDVI returns disk characteristics when you specify the item codesDVI$_DEVCHAR and DVI$_DEVCHAR2. Table 2-4 lists the possiblecharacteristics for disk devices.
1Defined by the $DEVDEF macro. 2These bits are located in DVI$_DEVCHAR2. 3MASSBUS only. DVI$_DEVBUFSIZ returns the buffer size. The buffer size is the defaultto 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 thedevice type. For example, the device type for the RA81 is DT$_RA81.(Foreign device types take the form DT$_FD1 through DT$_FD8.) Thedevice class for disks is DC$_DISK. DVI$_CYLINDERS returns the number of cylinders per volume (that is, perdisk), DVI$_TRACKS returns the number of tracks per cylinder, andDVI$_SECTORS returns the number of sectors per track. Values arereturned as 4-byte decimal numbers. DVI$_MAXBLOCK returns the maximum number of blocks (1 block = 512bytes) that can be contained on the volume (that is, on the disk).Values are returned as 4-byte decimal numbers. This information can beused, for example, to determine the density of an RX02 diskette (singledensity = 494 blocks, double density = 988 blocks). Disk drivers can perform logical, virtual, and physical I/O functions.Foreign-mounted devices do not require privilege to perform logical andvirtual I/O requests. Logical and physical I/O functions allow access to volume storage andrequire only that the issuing process have access to the volume.However, DSA disks and the disk class driver (DUDRIVER) do not acceptphysical QIO data transfers or seek operations.
Virtual I/O functions require an ACP for Files-11 On-Disk StructureLevel 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 thefile, you read the information and then deaccess the file. Delete thefile when the information is no longer useful. Non-DSA disk devices can read or write up to 65,535 bytes in a singlerequest. DSA devices connected to an HSC50 can transfer up to 4 billionbytes in a single request. In all cases, the maximum size of thetransfer is limited by the number of pages that can be faulted into theprocess's working set, and then locked into physical memory. (The diskdriver is responsible for any memory management functions of thistype.) 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/Ooperations of each type, not the size of the I/O operation beingperformed. The volume to which a logical or virtual function is directed must bemounted for the function actually to be executed. If it is not mounted,either a device not mounted or invalid volume status is returned in theI/O status block. Table 2-5 lists the logical, virtual, and physical disk I/Ofunctions and their function codes. Chapter 1 describes the QIOlevel interface to the disk device ACP.
1V = virtual; L = logical; P = physical 2Not for RX01 and RX02 disks. 3Not for TU58, RX01, RX02, RB02, and RL02 drives. 4RX02 only. 5Not for DSA and SCSI disks. 6On OpenVMS Alpha, P1 supports a 64-bit address. 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, andIO$_WRITEPBLK functions that include the IO$M_ERASE function modifierare as follows:
The function-dependent arguments for IO$_WRITECHECK, IO$_READPBLK, andIO$_WRITEPBLK are as follows:
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). 2.4.1 ReadThe read function reads data into a specified buffer from disk startingat 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 ismounted foreign, that function is converted to read logical block. If aread virtual block function is directed to a volume that is mountedstructured, the volume is handled in the same way as for afile-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 allread functions.If this modifier is specified, a data check operation is performedafter the read operation completes. A data check operation is alsoperformed if the volume that has been read, or the volume on which thefile resides (virtual read) has the characteristic "data check allreads." Furthermore, a data check is performed after a virtualread if the file has the attribute "data check on read." TheRX01 and RX02 drivers do not support the data check function. If IO$M_DATACHECK is specified with a read function code to a TU58, orifthe volume read has the characteristic "data check allreads," a read check operation is performed. This alters certainTU58 hardware parameters when the tape is read. (The read threshold inthe 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 fiveerror codes in the I/O status block:
If no errors are detected, the disk or tape data is considered reliable. The inhibit retry function modifier (IO$M_INHRETRY) can be used withall read functions.If this modifier is specified, all error recovery attempts areinhibited. IO$M_INHRETRY takes precedence over IO$M_DATACHECK. If bothare specified and an error occurs, there is no attempt at errorrecovery and no data check operation is performed. If an error does notoccur, the data check operation is performed. The write function writes data from a specified buffer to disk startingat 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 ismounted foreign, the function is converted to write logical block. If awrite virtual block function is directed to a volume that is mountedstructured, the volume is handled in the same way as for afile-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 allwrite operations.If this modifier is specified, a data check operation is performedafter the write operation completes. A data check operation is alsoperformed if the volume written, or the volume on which the fileresides (virtual write), has the characteristic "data check allwrites." Furthermore, a data check is performed after a virtualwrite 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, orif thevolume written has the characteristic "data check allwrites," a write check operation is performed. The write checkverifies data written on the tape. First, the specified data is writtenon the tape. Then the tape is reversed and the TU58 controller readsthe data internally to perform a checksum verification. If the checksumverification is unsuccessful after eight attempts, the write checkoperation is aborted and an error status is returned. The inhibit retry function modifier (IO$M_INHRETRY) can be used withall write functions.If that modifier is specified, all error recovery attempts areinhibited. IO$M_INHRETRY takes precedence over IO$M_DATACHECK. If bothIO$M_INHRETRY and IO$M_DATACHECK are specified and an error occurs,there is no attempt at error recovery, and no data check operation isperformed. If an error does not occur, the data check operation isperformed. IO$M_INHRETRY has no effect on DSA disks. The write deleted data function modifier (IO$M_DELDATA) can be used withthe write physical block (IO$_WRITEPBLK) function to the RX02. If thismodifier is specified, a deleted data address mark instead of thestandard data address mark is written preceding the data. Otherwise,the operation of the IO$_WRITEPBLK function is the same; write data istransferred to the disk. When a successful read operation is performedon this data, the status code SS$_RDDELDATA is returned in the I/Ostatus block rather than the usual SS$_NORMAL status code. The IO$M_ERASE function modifier can be used with all write functioncodes toerase a user-selected part of a disk. This modifier propagates an erasepattern through the specified range. Section 2.4 describes the writefunction arguments to be used with IO$M_ERASE.
|