Method to map multi-path device number to disk number.
Original Publication Date: 2005-Mar-23
Included in the Prior Art Database: 2005-Mar-23
Method to map multi-path device number to disk number .
Disclosure is a method that maps Windows* disk number to Microsoft* MPIO drivers' and DSM driver's internal device number.
Using this method, it's easy to get the Windows disk number and map to MPIO/DSM drivers' internal device number.
When Windows MPIO creates a multi-path virtual disk device, it assigns a number to this device to identify it. This number is unique to MPIO and can be used to identify MPIO device but it's not unique to the entire operating system.
As a generic disk class driver. the Windows disk class driver (disk.sys) is the function driver of all types of disk devices. When it is attached to MPIO device stack and starts the MPIO disk device, it assigns an unique number to the MPIO disk device. This number is unique to entire operating system.
Many applications need access to a multi-path device from the system point of view. The applications use the disk number to identify disk device. However, the Disk Number cannot be used to identify multi-path device if there is no way to map MPIO device number or identifier to disk number.
The method in this disclosure provides a way to implement this mapping.
When SDDDSM driver is loaded, it registers a Plug&Play notification callback routine to PnP
manager for specific event category, so that when that category of PNP event occurs, the
SDDDSM driver can notify the PnP manager. For this method, SDDDSM is only interested in
the device arrival event of the disk device, so when registering, SDDDSM specifies the
parameters EventCategory, EventCategoryFlags and EventCategoryData as
PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACESand GUID_DEVINTERFACE_DISK(53F56307-B6BF-11D0-94F2-00A0C91EFB8B) respectively. The callback routine SDDDSM registered is called GmPnpNotifyInterfaceChange.
When there is a device interface change event (device arrival and device removal) occuring, the callback routine GmPnpNotifyInterfaceChange is called with the parameters NotificationStruct and NotificationContext passed in. For this specific PnP event, the NotificationStruct includes the symbolic link name of the device on which the PnP event just happened. Using the symbolic link name, SDDDSM gets the device object of the device by calling the kernel API IoGetDeviceObjectPointer.
After getting the device object, SDDDSM sends that device object an IOCTL request SDDDSM_IOCTL_GET_DISK_NUMBER. Because this IOCTL is private to SDDDSM, all drivers in the device stack other than SDDDSM, don't know how to handle it, they just pass it down to next lower driver when they receive it, hopin...