The control and status requests defined in this section are primarily used by drivers to support the Apple File Exchange application, previously known as PC Exchange.
The partition information record is a structure used to store information about a partition on a device. The fields of the structure are:
If the device is connected via a SCSI interface, this field holds the SCSI Manager DeviceIdent of the device. If the device is connected via an ATA interface, this field holds the ATA Manager ataDeviceID. Devices connected via other interfaces can use whatever value makes sense to uniquely identify the device on that bus. If no value makes sense, a device must clear this field.
The block number of the first block in the partition.
The size (in blocks) of the partition.
You can determine the interface used by the device issuing the kdgInterface Driver Gestalt query. Drivers that support File Exchange should also support this Driver Gestalt selector. For more information about the ataDeviceID structure, consult the ATA Device 0/1 Software Developer Guide.
The kGetADrive control call ( csCode = 51) asks the driver to create a new drive queue element. This control call supports synchronous and asynchronous operation.
On input, DrvQElPtr contains the address of a drive queue element pointer. The call creates a new drive queue element based on the supplied drive queue element and places a pointer to the new drive queue element in the supplied address.
The following describes how the fields of the new drive queue element must be filled out:
Your driver must return the new drive queue element in the memory pointed by csParam[0..1]. You must not post a disk inserted event for the new drive, or send the fsmDrvQElChangedMessage message to the File System Manager.
The kRegisterPartition control call ( csCode = 50) registers a non-Macintosh partition found on a disk. This control call supports synchronous and asynchrous operation. The driver should fill in csParam as follows:
csParam[0..1] DrvQElPtr /* The drive queue element whose */
/* partition is to be changed */
(UInt32) csParam[2..3] /* The block number of the first */
/* block in the partition */
(UInt32) csParam[4..5] /* Size of partition in blocks */
In response to this call, your disk driver must retarget the specified drive queue element to represent the given partition on the disk. After this call, the drive queue element must represent a partition that starts at the block specified by csParam[2..3] and is of the size specified by csParam[4..5].
You must not post a disk inserted event for the new drive, or send the fsmDrvQElChangedMessage message to the File System Manager.
The kProhibitMounting control call ( csCode = 52) prevents the mounting of a partition. This control call supports synchronous and asynchrous operation.
In response to this call, your disk driver must mark the partition specified in csParam[0..1] so that it isn't mounted at system startup. The csParam[0..1] field contains a valid partInfoRecPtr, a pointer to a partInfoRec structure that contains information about a partition:
typedef struct partInfoRec
{
DeviceIdent SCSIID; // DeviceIdent for the device
unsigned long physPartitionLoc; // physical block number of
beginning of partition
unsigned long partitionNumber; // partition number of this
partition
} partInfoRec, *partInfoRecPtr;
Modern versions of File Exchange do not require your driver to support this call. If you decide not to support it, make sure to return controlErr.
The partition is completely determined by the fields of the partition information record, not by the ioVRefNum field of the parameter block.
The kGetPartInfo status call ( csCode = 51) returns information about a partition in the partInfoRec structure described earlier in ProhibitMounting Control Call This status call supports synchronous and asynchronous operation.
In response to this call, your disk driver must place partition information about the specified drive in the partition information record pointed to by csParam[0..1].
The driver fills in the partInfoRec structure as follows:
*(partInfoRecPtr)csParam.SCSIID <- /* DeviceIdent for */
/* the device */
*(partInfoRecPtr)csParam.physPartitionLoc <- /* physical block */
/* number of partition start */
*(partInfoRecPtr)csParam.partitionNumber
/* partition number of this partition */
The kGetPartitionStatus status call ( csCode = 50) retrieves the status of a partition. This status call supports synchronous and asynchronous operation.
(long *)csParam[0..1] /* partInfoRecPtr for partition */
(SInt16 *)csParam[2..3] /* address of a short for response */
In response to this call, the disk driver must determine whether the partition described by the partition information record pointed to by csParam[0..1] is mounted and return the volume reference number, VRefNum, of the volume in the SInt16 pointed to by csParam[2..3], or 0 if the partition is not mounted.
For SCSI and ATA devices, you can create a partInfoRec from scratch, for other types of devices, you have to get one back from the driver using kGetPartInfo and then use the returned SCSIID field to fill in the SCSIID field of your partInfoRec
SCSIID field is only valid if the driver returns kdgScsiIntf in response to a kdgInterface Driver Gestalt query.