My file IO system
Posted: Mon Nov 25, 2013 4:54 am
I am currently working on implementing decent file IO in my OS.
This is the plan:
At the lowest level are the drivers for different storage device interfaces e.g. ATAPIO (all I've got ATM). These drivers provide basic functionality such as reading and writing sectors. These drivers will (later) handle queueing requests. At this point in time I intend to make all disk IO synchronous for simplicity (probably until I get multitasking and DMA going).
The next level up is a storage device abstraction. A storage device is represented by a structure consisting of necessary information about a particular storage device (type, filesystem, label, size, a cache pointer which will be used by the filesystem drivers for caching certain stuff like the FAT or root dir, and more to be added). The storage device abstraction provides functionality similar to the drivers - reading and writing sectors (through the drivers), and will also be capable of providing information about a storage device.
A device manager will keep track of all the storage devices (as well as other devices), and provide functionality such as getting a storage device from a storage device label.
Above this is the filesystem drivers e.g. FAT16 (All I've got ATM). These will manipulate the filesystem to read, write, create, delete and rename files on a storage device.
Above the filesystem is the file IO interface. This will provide the file abstraction, with functionality such as reading, writing, renaming, creating and deleting files, streamlining the process across different filesystems and devices.
Does this seem like a reasonable way to go about file IO? Are there any major complications that I have overlooked? Any comments or suggestions are welcome.
This is the plan:
At the lowest level are the drivers for different storage device interfaces e.g. ATAPIO (all I've got ATM). These drivers provide basic functionality such as reading and writing sectors. These drivers will (later) handle queueing requests. At this point in time I intend to make all disk IO synchronous for simplicity (probably until I get multitasking and DMA going).
The next level up is a storage device abstraction. A storage device is represented by a structure consisting of necessary information about a particular storage device (type, filesystem, label, size, a cache pointer which will be used by the filesystem drivers for caching certain stuff like the FAT or root dir, and more to be added). The storage device abstraction provides functionality similar to the drivers - reading and writing sectors (through the drivers), and will also be capable of providing information about a storage device.
A device manager will keep track of all the storage devices (as well as other devices), and provide functionality such as getting a storage device from a storage device label.
Above this is the filesystem drivers e.g. FAT16 (All I've got ATM). These will manipulate the filesystem to read, write, create, delete and rename files on a storage device.
Above the filesystem is the file IO interface. This will provide the file abstraction, with functionality such as reading, writing, renaming, creating and deleting files, streamlining the process across different filesystems and devices.
Does this seem like a reasonable way to go about file IO? Are there any major complications that I have overlooked? Any comments or suggestions are welcome.