如果设备可以为驱动程序提供唯一的标识符,则驱动程序可以直接使用此标识符初始化设备 ID 并使用 Solaris DDI 注册此 ID。
/*
* The device provides a guaranteed unique identifier,
* in this case a SCSI3-WWN. The WWN for the device has been
* stored in the device's soft state.
*/
if (ddi_devid_init(dip, DEVID_SCSI3_WWN, un->un_wwn_len, un->un_wwn,
&un->un_devid) != DDI_SUCCESS)
return (DDI_FAILURE);
(void) ddi_devid_register(dip, un->un_devid);