Skip to content

Commit

Permalink
vfs: relay mmap() to appropriate file system driver
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelcodes committed Nov 30, 2024
1 parent 6890731 commit 7673683
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion fs/vfs/src/dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ void vfsDispatchReaddir(SyscallHeader *hdr) {
}
}

void vfsDispatchMmap(SyscallHeader *hdr) {
MmapCommand *cmd = (MmapCommand *) hdr;
char type[32];
if(resolve(cmd->path, type, cmd->device, cmd->path)) {
int sd = findFSServer(type);
if(sd <= 0) luxLogf(KPRINT_LEVEL_WARNING, "no file system driver loaded for '%s'\n", type);
else luxSend(sd, cmd);
} else {
luxLogf(KPRINT_LEVEL_WARNING, "could not resolve path '%s'\n", cmd->path);
}
}

void (*vfsDispatchTable[])(SyscallHeader *) = {
vfsDispatchStat, // 0 - stat()
NULL, // 1 - flush()
Expand All @@ -132,6 +144,6 @@ void (*vfsDispatchTable[])(SyscallHeader *) = {

NULL, NULL, NULL, // 15, 16, 17 - irrelevant to vfs

NULL, // 18 - mmap()
vfsDispatchMmap, // 18 - mmap()
NULL, // 19 - msync()
};

0 comments on commit 7673683

Please sign in to comment.