|
Previously, all tasks waiting on the floppy drive, would be woken
simultaneously and would compete for access to the drive, potentially
causing a dangerous race condition. Now, tasks enter a read queue, where
each task wakes the next after it is finished with the drive. This is
the basic groundwork for request queueing. Seek queues will be
implemented next along with a head scheduling algorithm.
Added a timeout for read_data(). Reading status from the FDC will return
an error if the FDC does not become available in the allotted time and
thus, will no longer potentially hang the system.
|
|
Changed the type for block addresses from size_t to uint16_t.
Added the '%c' conversion specifier to vsprintf(), so that it can now
output individual characters passed as arguments.
Added a an errno.h header containing a list of commonly used error
codes, as well as a basic strerror() routine to fetch corresponding
human-readable strings from a table.
Implemented barebones floppy driver. Currently lacking many (essential)
features, see TODO notes in floppy.c for more details.
Buffer structs now have a b_present flag to indicate whether or not the
data section is populated, as well as a b_wait element, as a queue for
any tasks waiting on the buffer. All tasks waiting on a block wait in
this queue, however, the task that originally called the driver to read,
may wait in a separate queue maintained by the driver. This system may
change in the future, and will likely depend on how head scheduling is
implemented in the driver.
The buffer_get_block() routine is now publically available in
kernel/fs.h. It can be called to retrieve a block from the buffer cache
(if readily available), or from the specified block device otherwise.
This routine returns a pointer to the buffer containing the cache.
The block_read() function now passes arguments and return values to the
floppy driver regardless of the device specified. The block_write()
function now indicates an error condition by setting b_device to zero in
the allocated buffer structure, as no devices with write functionality
currently exist. This behaviour will be updated in future, as more block
devices are added.
The mount_root() function has been modified to call buffer_get_block(),
instead of calling block_read() directly. As of now, nothing should call
block_read() or block_write() directly, as those functions are intended
for use by the buffer subsystem only.
|