When the OS2DASD initializes, it scans .ADD drivers for fixed or removable magnetic devices. For each device found, the driver creates an internal control block that is called a UnitCB.
To access the device, the UnitCB provides the linkage to the corresponding ADD driver and ADD UnitHandle.
When UnitCBs have been created, the driver creates VolCBs to represent each of the following:
VolCBs are linked together to create a unit number ordering system, based on DOS conventions. In addition, VolCBs are linked to their corresponding UnitCB, which provides the information necessary to access the physical device by way of the ADD drivers.
Unit numbers are not equivalent to drive letters. The OS/2 Kernel/FileSystems assigns drive letters. For example, a block device driver cannot demand that a particular set of drive letters be assigned to it.
OS2DASD assigns unit numbers as follows:
80h - 98h
A VolCB is created for each non-removable drive found. This VolCB represents the drive as a single device and ignores any partitioning scheme. For each drive found, a unit number is assigned from 80h to 98h.
Regardless of whether an .ADD driver is found claiming diskette units, Unit Numbers 0,1 will be declared. This prevents the traditional unit numbering from "shifting" on workstations with 0 or 1 diskette drives installed. There is an "implicit" assumption by OS/2 System Initialization, that OS2DASD will be the first block driver loaded. In addition, if a single diskette drive is installed, OS2DASD creates a pseudo drive B unit, which is mapped to the first diskette drive.
OS2DASD scans the UnitCBs created previously for non-removable drives. The Sector 0 of each drive is read and the partition record is checked for a file system partition entry. See Boot Record Architecture for more information.
If a file system partition is found, it is considered the primary partition on the volume. A VolCB is created and given the next available unit number from this range.
When all non-removable drives have been scanned, sector 0 of each non-removable drive is read again and scanned for an extended volume entry. This entry points to a new extended boot sector on the same drive.
The extended boot sector is read and scanned for a file system partition entry. If an entry is found, then a VolCB is allocated and assigned the next available unit number from this range. The sector is also searched for another extended volume entry.
This process is repeated until the end of the extended volume chain on the drive is reached or no drive letters are left.
When the search is completed, the same search is repeated on the next physical drive.
After all non-removable drives have been processed and the primary or logical drives are allocated, then VolCBs are allocated for any remaining removable drives in the system.