| Age | Commit message (Collapse) | Author |
|
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.
|
|
after hd_init() failed (on a system without a disk), would hang. Now,
hd_read_block() will fail if no hard disk is present on the system (as
indicated by the nblocks count being equal to zero). The same fix also
applies to the hd_write_block() function.
The hd_init() function now returns a status indicating either successful
drive detection and initialization, or failure. This return status won't
likely be needed due to the above bug-fix, but may prove useful in the
future.
Added framework for a block buffer subsystem. This subsystem uses
pre-allocated memory to cache blocks that are requested from the block
device subsystem. Cached blocks are stored on a linked list sorted in
order of usage frequency.
Modified the block read/write functions so that they no longer accept a
length parameter. The block I/O functions will only read or write a
single block at a time. If multiple blocks are required, multiple calls
will have to be made. This is to reduce complexity of block device
drivers and make integration with the new buffer subsystem easier.
Removed all calls to the ATA hard-disk driver. For now, it seems that
floppy media will be best as it allows for real-world hardware testing.
Furthermore, large portions of the hard-disk driver will need to be
re-written anyway once the block buffer subsystem is complete as it only
supports PIO transfers, whilst a buffer system will require DMA
transfers. As the hard-disk was previously the only supported block
device, the block device read/write functions will now always fail,
returning -1.
|
|
to make management/maintenance easier.
Defined the structures super_block and m_inode in kernel/fs.h for super
blocks and inodes respectively.
Added the new header file sys/stat.h which contains basic definitions
for inode types and permissions. These definitions will be required by
any functions handling m_inode structures.
Moved the sys_read and sys_write system calls to the filesystem's main
source file at kernel/fs/fs.c.
Added the file kernel/fs/mount.c which will contain the super-blocks
table as well as the function mount_root() which will attempt to mount
the root filesystem during boot. Eventually, this file will be expanded
to include a general-purpose mount function to mount any filesystem as
well as the system call handler for sys_mount.
Seperated block I/O functions into their own subsystem under
kernel/fs/block.c which currently supports two functions; block_read()
and block_write() to read and write blocks from block devices.
Currently, no device can be specified since the primary ATA master drive
is the only possible target. This will change in the future however.
Modified the hard disk driver's read and write functions to use
filesystem blocks rather than sectors as the units of transfer. This is
intended to keep the block I/O subsystem simple by ensuring a uniform
transfer unit is used across all block devices and drivers.
The hard disk driver is no longer initialized during the main boot
procedure. Instead, a call is made to the new function fs_init() which
will setup filesystem tables and structures, call hd_init() to
initialize the disk and finally, attempt to load the super-block for the
root filesystem.
The hard disk driver now stores the disk's size and sanity checks
addresses and sizes in read and write calls against this value.
|