Writing Device Drivers

Layered Identifiers – Kernel Device Consumers

Layered identifiers enable the LDI to track and report kernel device usage information. A layered identifier (ldi_ident_t) identifies a kernel device consumer. Kernel device consumers must obtain a layered identifier prior to opening a target device using the LDI.

Layered drivers are the only supported types of kernel device consumers. Therefore, a layered driver must obtain a layered identifier that is associated with the device number, the device information node, or the stream of the layered driver. The layered identifier is associated with the layered driver. The layered identifier is not associated with the target device.

You can retrieve the kernel device usage information that is collected by the LDI by using the libdevinfo(3LIB) interfaces, the fuser(1M) command, or the prtconf(1M) command. For example, the prtconf(1M) command can show which target devices a layered driver is accessing or which layered drivers are accessing a particular target device. See User Interfaces to learn more about how to retrieve device usage information.

The following describes the LDI layered identifier interfaces:

ldi_ident_t

Layered identifier. An opaque type.

ldi_ident_from_dev(9F)

Allocate and retrieve a layered identifier that is associated with a dev_t device number.

ldi_ident_from_dip(9F)

Allocate and retrieve a layered identifier that is associated with a dev_info_t device information node.

ldi_ident_from_stream(9F)

Allocate and retrieve a layered identifier that is associated with a stream.

ldi_ident_release(9F)

Release a layered identifier that was allocated with ldi_ident_from_dev(9F), ldi_ident_from_dip(9F), or ldi_ident_from_stream(9F).