The device module is a bit mixed up at the moment, because it conflates two abstractions that should be separated:
A driver abstraction which represents the entry points (probe,read,write) for a class of devices (ata,atapi,scsi), each of which may have multiple integer units. This should be a structure defining pointers to functions that operate on unit numbers.
A unit abstraction which is an abstract handle for a specific driver and unit number, and any other details specific to that unit. (e.g. the window associated with a console) This should be an opaque handle that enables reads and writes without exposing the underlying object structure.
The
device
module is a bit mixed up at the moment, because it conflates two abstractions that should be separated:A
driver
abstraction which represents the entry points (probe,read,write) for a class of devices (ata,atapi,scsi), each of which may have multiple integer units. This should be a structure defining pointers to functions that operate on unit numbers.A
unit
abstraction which is an abstract handle for a specific driver and unit number, and any other details specific to that unit. (e.g. the window associated with a console) This should be an opaque handle that enables reads and writes without exposing the underlying object structure.