[Geekos-devel] new block device API
Status: Pre-Alpha
Brought to you by:
daveho
From: David H. <da...@cs...> - 2002-03-03 21:21:47
|
I commited some code to define an interface for block devices: include/sys/geekos/blockdev.h kern/blockdev.c Basically, each request to read or write a block is represented by a block_device_request object, which specifies the block number, memory buffer, etc. A condition variable (protected by the mutex in the block device object) is used to signal the completion of the request. I also wrote a ramdisk driver as an example of how the interface works: include/sys/geekos/ramdisk.h drivers/ramdisk.c It's not a very good model for real block devices, since it's completely synchronous. A real block device driver would be asynchronous, since things like disks are slow, the the requests take a lot of time to complete. I haven't actually tested any of the code, so there may be bugs. The next thing I plan to work on is a file cache for filesystems to use. It would handle the tasks of calling the underlying block device driver to schedule I/O and caching the buffers in memory. The pages of a file cache would be used by read() and write() system calls, and also the VM system (for memory-mapped file I/O.) -Dave |