ahci: add block operations

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-13 00:02:22 -04:00
commit fc0720b118
5 changed files with 60 additions and 9 deletions

View file

@ -4,7 +4,6 @@
#include <kernel/spinlock.h>
#include <kernel/slab.h>
#include <kernel/block.h>
#include <fs/inode.h>
#include <lib/rwlock.h>
@ -54,6 +53,8 @@
#define FS_RDONLY 0x00000001
struct block_device;
struct fs_driver {
char name[FILE_NAME_MAX_LEN + 1];
int (*init)(int flags, struct block_device *to_mount, fs_t **out);

View file

@ -2,6 +2,7 @@
#ifndef _BLOCK_H_
#define _BLOCK_H_
#include <fs/vfs.h>
#include <kernel/device.h>
struct block_device;
@ -11,11 +12,19 @@ struct block_ops {
};
struct block_device {
char *name;
dev_t dev;
size_t size;
size_t block_size;
char name[256];
dev_t dev;
size_t size;
size_t block_size;
struct block_ops ops;
void *priv;
size_t lba_start;
};
struct disk {
struct block_device *dev;
char model[FILE_NAME_MAX_LEN + 1];
list_t part_table;
};
ssize_t block_read(struct block_device *dev, char *buf, size_t offset, size_t n_blocks);