From b808d33c6bf30691b8cdb6cc0fd65f49e7db29f8 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Sat, 7 Mar 2020 17:37:49 +1100 Subject: Makefile now correctly calls i386 QEMU instead of x86_64 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. --- include/kernel/fd.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 include/kernel/fd.h (limited to 'include/kernel/fd.h') diff --git a/include/kernel/fd.h b/include/kernel/fd.h new file mode 100644 index 0000000..07cf454 --- /dev/null +++ b/include/kernel/fd.h @@ -0,0 +1,12 @@ +#ifndef _FD_H +#define _FD_H + +#include +#include +#include + +void fd_init(void); + +void fd_block_read(struct buffer*); + +#endif -- cgit v1.3