mirror of
https://github.com/kenshineto/kern.git
synced 2025-04-21 12:47:25 +00:00
adde disk read/write functions
This commit is contained in:
parent
0eee1ffd3d
commit
dfc326fa48
2 changed files with 42 additions and 0 deletions
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue