adde disk read/write functions

This commit is contained in:
Murphy 2025-04-04 12:12:22 -04:00
parent 0eee1ffd3d
commit dfc326fa48
Signed by: freya
GPG key ID: 9FBC6FFD6D2DBF17
2 changed files with 42 additions and 0 deletions
kernel
fs
include/comus

View file

@ -57,3 +57,23 @@ struct file *fs_find_file_rel(struct file *rel, char *rel_path)
panic("fs_find_file_rel NOT YET IMPLEMENTED");
}
int disk_read(struct disk *disk, size_t offset, size_t len, uint8_t *buffer)
{
(void) disk;
(void) offset;
(void) len;
(void) buffer;
panic("disk_read NOT YET IMPLEMENTED");
}
int disk_write(struct disk *disk, size_t offset, size_t len, uint8_t *buffer)
{
(void) disk;
(void) offset;
(void) len;
(void) buffer;
panic("disk_write NOT YET IMPLEMENTED");
}

View file

@ -28,6 +28,28 @@ struct disk {
/// we then need drivers for ide and/or sata, ide is easier
};
/**
* read data from a disk into a buffer
*
* @param disk - the disk to read from
* @param offset - the offset into the disk to read
* @param len - the length of the data to read into `buffer`
* @param buffer - the buffer to save data into
* @returns bytes read on success, negative fs error code in failure
*/
int disk_read(struct disk *disk, size_t offset, size_t len, uint8_t *buffer);
/**
* write data from a disk into a buffer
*
* @param disk - the disk to write from
* @param offset - the offset into the disk to write
* @param len - the length of the data to write into `buffer`
* @param buffer - the buffer to read from
* @returns bytes written on success, negative fs error code in failure
*/
int disk_write(struct disk *disk, size_t offset, size_t len, uint8_t *buffer);
enum file_type {
// regular file
F_REG = 0,