Interfaces used by disk devices

The classical UNIX device interface

Layering is possible, the dk_lookup function is used to get a handle (a vnode) a child device.

Disk drivers use the kernel disk interface to provide information for iostat and property lists. There are also helper routines to handle partitions and to get a disklabel.

Almost all disk drivers have a regular driver structure that is created by the autoconf framework. An exception is the ccd(4) driver that hand-crafts its private data without autoconf.

The disklabel routines are mostly MD, the sun/sparc routines are not in arch/ but in dev/sun/, the i386/amd64 routines (also used by other archs) are in kern/subr_disk_mbr.c

A wedge is a layered device on top of the RAW_PART of a standard disk device. All disk drivers need to implement ioctls to manually attach wedge devices (using dkctl(8)) and need to call dkwedge_discover to implement autodetect

The attempt to refactor disk drivers by collecting common functionality. Hardly used, the dk_lookup routine doesn't really belong here (it's more a vnode routine).