The disk storage API permits kernel device drivers providing access to disk-like storage devices to advertise the device to other kernel components, including GEOM(4) and devfs(5).
Each disk device is described by a
.Vt "struct disk" structure, which contains a variety of parameters for the disk device, function pointers for various methods that may be performed on the device, as well as private data storage for the device driver. In addition, some fields are reserved for use by GEOM in managing access to the device and its statistics.
GEOM has the ownership of
.Vt "struct disk" , and drivers must allocate storage for it with the disk_alloc function, fill in the fields and call disk_create when the device is ready to service requests. After calling disk_destroy, the device driver is not allowed to access the contents of
.Vt "struct disk" anymore.
The disk_create function takes a second parameter, version, which must always be passed DISK_VERSION. If GEOM detects that the driver is compiled against an unsupported version, it will ignore the device and print a warning on the console.
The following fields identify the disk device described by the structure instance, and must be filled in prior to submitting the structure to disk_create and may not be subsequently changed: