Jump to content

DSK_FORMATVERIFY

From EDM2


Category
IOCTL_DISK (08h)
Function
DSK_FORMATVERIFY (45h)
Description
Format and Verify Track

Description

This function formats and verifies a track.

Command Information

A byte with bits defined as follows:

  • Bit 0: If clear (0), the track layout contains nonconsecutive sectors or does not start with Sector 1. If set (1), the track layout starts with Sector 1 and contains only consecutive sectors.
  • Bit 1: Indicates that this is a multi-track request. For multi-track requests, the track table should contain a single entry.
  • All other bits are reserved and must be set to 0.

Parameter Packet Format

Parameter Packet
Field Length C Datatype
Command Information BYTE UCHAR
Head WORD USHORT
Cylinder WORD USHORT
Number of Tracks WORD USHORT
Number of Sectors WORD USHORT
Format Track Table BYTES BYTE[]

Format Track Table

Contains four-byte tuples. Each tuple is in the form (c, h, r, n) where c=cylinder number, h=head number, r=Sector ID, and n=bytes per sector:

  • n Bytes/Sector:
 * 0: 128
 * 1: 256
 * 2: 512
 * 3: 1024

There is a 4-tuple for each sector in the track to be formatted. Both the head and cylinder numbers must be consistent within the tuple and the corresponding Parameter Packet field.

Number of Tracks

The number of tracks to format/verify on a multitrack request. This is set to zero for single track requests. On return from a multitrack request, Number of Tracks is set to one of the following values:

  • 8000H: Multitrack successful
  • 4000H: Multitrack not supported
  • 2000H: Multitrack failed on FORMAT operation
  • 1000H: Multitrack failed on VERIFY operation

Starting Sector

On input, this is the starting sector on a multitrack request. This is set to zero for a single track request. On return from a multitrack format request, if a defective spot is found on the media, Starting Sector is the first logical sector number within the head and cylinder of the defective area.

Data Packet Format

Data Packet
Field Length C Datatype
Starting Sector BYTE BYTE

Returns

Possible values are shown in the following list:

Code Description
0 NO_ERROR
1 ERROR_INVALID_FUNCTION
6 ERROR_INVALID_HANDLE
15 ERROR_INVALID_DRIVE
31 ERROR_GEN_FAILURE
87 ERROR_INVALID_PARAMETER
111 ERROR_BUFFER_OVERFLOW
115 ERROR_PROTECTION_VIOLATION
117 ERROR_INVALID_CATEGORY
119 ERROR_BAD_DRIVER_LEVEL
163 ERROR_UNCERTAIN_MEDIA
165 ERROR_MONITORS_NOT_SUPPORTED

Remarks

This routine formats and verifies the track specified according to the information passed in the Format Track Table. The track is passed to the controller, which performs the formatting. Note that some controllers do not support formatting tracks with varying sector sizes; therefore, applications must ensure that the sector sizes specified in the Track Layout Table are all the same. The Head Ani: TRACKLAYOUT data structure can be used by C programmers. To include this data structure in your file, make sure INCL_DOSDEVIOCTL is defined before including OS2.H. An example format track table for a single track request with 12 sectors, starting with sector 1 and containing consecutive sectors (Command Information Bit 0 set to 1), formatted to 512 bytes-per-sector, contains 12 four-byte tuples with consistent head and cylinder numbers, sector IDs from 0 to 11, and sector size code 2 (512 bytes).