Jump to content

DSK_WRITETRACK

From EDM2
Revision as of 04:22, 19 May 2025 by Martini (talk | contribs) (Created page with "{{DISPLAYTITLE:DSK_WRITETRACK}} ;Category:IOCTL_DISK (08h) ;Function:DSK_WRITETRACK (44h) ;Description:Write Logical Track ==Description== This function writes a logical track. ==Command Information== A byte with bit 0 defined as follows: * Bit 0: If clear (0), the track layout contains non-consecutive sectors or does not start with Sector 1. If set (1), the track layout starts with Sector 1 and contains only consecutive sectors. * All other bits are reserved and...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Category
IOCTL_DISK (08h)
Function
DSK_WRITETRACK (44h)
Description
Write Logical Track

Description

This function writes a logical track.

Command Information

A byte with bit 0 defined as follows:

  • Bit 0: If clear (0), the track layout contains non-consecutive sectors or does not start with Sector 1. If set (1), the track layout starts with Sector 1 and contains only consecutive sectors.
  • 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
First Sector WORD USHORT
Number of Sectors WORD USHORT
Track Layout Table BYTES BYTE[]

Track Layout Table

The Track Layout Table has the following format:

Track Layout Table
Field Length
Sector Number for Sector 1 WORD
Sector Size for Sector 1 WORD
Sector Number for Sector 2 WORD
Sector Size for Sector 2 WORD
Sector Number for Sector 3 WORD
Sector Size for Sector 3 WORD
... ...
Sector Number for Sector n WORD
Sector Size for Sector n WORD

The sector table provides information used during the WRITE track operation.

Data Packet Format

Data Packet
Field Length C Datatype
Buffer BYTES UCHAR[]

The Data Packet is a buffer containing the data to be written.

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 function is used to perform a write of sectors on the media and to perform the operations on the device specified in this request. The track table passed in on the call is used to determine the sector number, which is passed to the disk controller for the operation. In cases where the sectors are oddly numbered or are non-consecutive, this request breaks into n single sector operations and writes one sector at a time. This DosDevIOCtl is typically used when performing I/O outside of the normal file system data area on the media. The Head field specifies the physical head on the drive that performs the operation. The Cylinder field indicates the cylinder for the write. The First Sector field specifies the logical sector number within the Track Layout Table that starts the I/O operation (sector numbers start with 0, e.g., the third sector is number 2). The Number of Sectors field indicates the number of sectors to write (up to the maximum specified in the track table; the IOCtl subfunctions do not step heads/tracks). The TRACKLAYOUT data structure can be used by C programmers by defining INCL_DOSDEVIOCTL before including OS2.H.