1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

Additional information on the memory properties of struct disk

instances: the memory holding a struct disk should be pre-zeroed so
as to initialize any storage framework private data in the structures
properly.  In addition, the memory must be writable so that the
private data may be updated.

Pointed out by:	phk
This commit is contained in:
Robert Watson 2003-09-26 22:08:23 +00:00
parent ef43d3b590
commit 5e50629b39
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120497

View File

@ -46,6 +46,7 @@ components, including
.Xr GEOM 4 , .Xr GEOM 4 ,
and and
.Xr devfs 5 . .Xr devfs 5 .
.Pp
Each disk device is described by a Each disk device is described by a
.Vt "struct disk" .Vt "struct disk"
structure, which contains a variety of parameters for the disk device, structure, which contains a variety of parameters for the disk device,
@ -53,11 +54,17 @@ function pointers for various methods that may be performed on the device,
as well as private data storage for the device driver. as well as private data storage for the device driver.
In addition, some fields are reserved for use by GEOM in managing access In addition, some fields are reserved for use by GEOM in managing access
to the device and its statistics. to the device and its statistics.
Fields in the structure will generally be assumed not to change once the Because of storage driver framework private data stored in
structure is submitted to .Vt "struct disk" ,
instances of the structure should be allocated out of writable, pre-zero'd
memory.
.Pp
Public fields in the structure will generally be assumed not to change once
the structure is submitted to
.Fn disk_create , .Fn disk_create ,
and so no explicit locking is employed; drivers that change the values of and so no explicit locking is employed; drivers that change the values of
any of these fields do so at their own risk. any of these fields do so at their own risk.
.Pp
Memory associated with the Memory associated with the
.Vt "struct disk" .Vt "struct disk"
is owned by the device driver, but should not be released until after is owned by the device driver, but should not be released until after