NWPA provides a specific set of control functions to support removable-media devices. NWPA packages these control functions in CDM messages.
This section covers the following topics:
Detailed descriptions of the message control function operations can be found in CDM Message Control Functions and the message I/O function operations can be found in CDM Message I/O Functions. NWPA expects all CDMs managing removable-media devices to support the functions marked Mandatory. The remaining subsections describe the use of these control functions.
The key difference between CDMs supporting fixed-media devices and CDMs supporting removable-media devices is that the CDM_Inquiry routine of a removable-media CDM can be called at a time when there is no media in the device. As mentioned in Inquiring and Binding to a Device, CDM_Inquiry is the entry point where the CDM queries the device and decides whether it will bind (CDI_Bind_CDM_To_Object) to the device. Part of the bind process requires the CDM to fill out an instance of an UpdateInfoStruct for the device and its media. Because a piece of media might not be loaded at bind-time, it is impossible for the CDM to know all of the information necessary to fill out the UpdateInfoStruct and make the device active.
The purpose of the Mount function is to give a CDM a second opportunity (other than at bind-time) to get the additional information it needs to complete the UpdateInfoStruct after a piece of media gets loaded into the device. The Activate function follows the Mount, and its purpose is to allow the CDM to handshake with NWPA to indicate that the device is active and ready to receive I/O. The following is an outline of the binding and activating paradigm for removable-media devices
The Lock function applies only to standalone, removable-media devices, not to changer or magazine type devices. The Lock function is issued at the discretion of the controlling application.
The CDM can receive a media Dismount or device Deactivate message at any time. When the CDM receives either one of these messages, it should set the activateFlag of the device's UpdateInfoStruct to 0x0000 and update the object by calling CDI_Object_Update. For a Dismount, the CDM should reset (set to -1) the other fields of the device's UpdateInfoStructprior to updating the object
If the CDM indicates that it supports Insert and Remove functions for a device, the CDM should issue an insert media command if an Insert message is received. If a Remove message is recieved, the CDM should issue an an eject media command to the device.