"designing generic storage device driver interface"
Posted: Sun Dec 25, 2005 7:42 pm
This was brought up in another thread but I got interested making one, but how, any suggestions?
The Place to Start for Operating System Developers
http://f.osdev.org/
I'd first decide whether storage device drivers can operate on whole blocks only (e.g. read 3 sectors starting at sector 4) or if they should support smaller transfers (e.g. read 3 bytes starting at byte 4). Then, if they operate on whole blocks only decide if the size of the block can be different for each device (e.g. 512 bytes for hard drives and 2048 bytes for CD-ROM), or if blocks are fixed size (e.g. 4096 bytes regardless of what sort of device it is).GLneo wrote:This was brought up in another thread but I got interested making one, but how, any suggestions?
IMHO UDI is like a jockey sitting ontop of a horse's corpse, wipping away trying to go faster while maggots are cleaning the bones.Solar wrote:You might want to check out http://www.projectudi.org. They did just the thing.
Considering the amount of questions brendan came with, i'd be tempted to take the day off to think about it all. First of all, try to get a clean cut between what's being handled and what's not. Block caching, for instance, is not device-specific: if a caching policy is good for e.g. ATA disks, it is probably equally good for SCSI disks. Similarily, E2FS and NTFS will equally don't want to bother with caching: all they need is the ability to say "i need the disk to be sync'd before further operation go on" or "here is a barrier: write these stuff first before anything newer is written". Journalled FS is also likely to need unbuffered writes at some times (for the journal), so i'd dare to say caching should probably be a 'companion' service that you can use between FS and block device, but not a part of either FS or block device.Brendan wrote:
I'd first decide whether storage device drivers can operate on whole blocks only (e.g. read 3 sectors starting at sector 4) or if they should support smaller transfers (e.g. read 3 bytes starting at byte 4). Then, if they operate on whole blocks only decide if the size of the block can be different for each device (e.g. 512 bytes for hard drives and 2048 bytes for CD-ROM), or if blocks are fixed size (e.g. 4096 bytes regardless of what sort of device it is).
you'll certainly need a comfortable way to access all the information about a given device - not only the block devices, but also USB devices, human-interacting devices, display devices, etc. Thinking of how you could perform queries on those information, how they could be reported, etc. should imho receive great care if you want to avoid the nightmare of /proc (which is a stockpile of info for the programmer, but a horror to interface with at kernel level, imvho)Once this is done I'd write a list of operations it needs to support. For example: read data, write data, open device, close device, seek, flush, format device, get block size, get device information
Once again, this can be hopefully enough designed as a 'companion' for the core driver.Then decide how removeable media will be handled - if the device driver knows a CD was ejected, does it send a "media changed" notification to it's client, or does it return a "media changed" error the next time the client tries to read or write?
WOW!!!IMHO UDI is like a jockey sitting ontop of a horse's corpse, wipping away trying to go faster while maggots are cleaning the bones.
AFAIK each different UNIX clone uses it's own unique driver system with it's own unique drivers. This is actually quite silly when the systems are so similar - UDI could have been a good thing for these UNIX clones.GLneo wrote:WOW!!!IMHO UDI is like a jockey sitting ontop of a horse's corpse, wipping away trying to go faster while maggots are cleaning the bones.
do all unix clones use the same system???