iovec: initial implementation

This commit is contained in:
Matheus
2024-09-20 12:51:36 -03:00
parent 9015014804
commit dce1edad26
5 changed files with 281 additions and 14 deletions
+2
View File
@@ -74,12 +74,14 @@ static void bytestolba(blockdesc_t *desc, uintmax_t offset, size_t size, uintmax
#define MAP_FLAGS (ARCH_MMU_FLAGS_READ | ARCH_MMU_FLAGS_WRITE | ARCH_MMU_FLAGS_NOEXEC)
// this is only really called by the page cache VOP_GETPAGE and VOP_PUTPAGE functions, so we can make a few assumptions
static int rwblock(int minor, void *buffer, size_t size, uintmax_t offset, int flags, bool write, size_t *done) {
blockdesc_t *desc = getdesc(minor);
if (desc == NULL)
return ENODEV;
__assert((size % desc->blocksize) == 0);
__assert((size % PAGE_SIZE) == 0);
uintmax_t bytetop = desc->blockcapacity * desc->blocksize;
// offset past end