dthain / basekernel

A simple OS kernel for research, teaching, and fun.
GNU General Public License v2.0
805 stars 109 forks source link

Separate Devices From Drivers #213

Closed dthain closed 5 years ago

dthain commented 5 years ago

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.