|
XenevaOS
|
#include <Fs/srvfs.h>#include <Fs/vfs.h>#include <Ipc/auipc.h>#include <Fs/Dev/devhw.h>#include <Cred/group.h>#include <Mm/kmalloc.h>#include <Drivers/uart.h>#include <Hal/AA64/aa64lowlevel.h>#include <Hal/AA64/sched.h>#include <Serv/sysserv.h>#include <process.h>#include <auipc.h>#include <fssrv.h>#include <string.h>#include <_null.h>
Classes | |
| struct | Op |
| struct | Hist |
Macros | |
| #define | SRV_TIMEOUT_MS 3000 |
| #define | MAX_HIST 8 |
| #define | MAX_OPS 16 |
| #define | HIST_STALE_US (15ULL * 1000 * 1000) |
Enumerations | |
| enum | { OP_FREE = 0 , OP_WAIT , OP_DONE } |
Functions | |
| uint64_t | AuGetCurrentUS () |
| void | AuSrvfsNoteOpenMode (int mode) |
| AuSrvfsNoteOpenMode – OpenFile tells the proxy the mode of the open it is about to do. | |
| void | AuSrvfsSyscallEnterSlow (AA64Thread *thr) |
| void | AuSrvfsSyscallExitSlow (AA64Thread *thr) |
| int | AuSrvfsRemove (const char *path) |
| AuSrvfsRemove – remove a /srv file for the RemoveFile syscall; 0 on success. | |
| bool | AuSrvfsOwns (AuVFSNode *fsys) |
| AuSrvfsOwns – true if fsys is the /srv proxy. | |
| void | AuSrvfsInitialize (void) |
| AuSrvfsInitialize – mount the /srv proxy file system. | |
Variables | |
| int | g_srvfs_active |
| syscall bracket hooks: restartable operations replay per-syscall history | |
| #define HIST_STALE_US (15ULL * 1000 * 1000) |
| #define MAX_HIST 8 |
| #define MAX_OPS 16 |
| #define SRV_TIMEOUT_MS 3000 |
srvfs.c – /srv, a file system served by a user-space process.
The kernel keeps no file data and no directory: every open/read/write on a /srv path becomes a request to the IPC endpoint "fs" (BaseHdr/fssrv.h), stamped with the caller's uid. The server (Process/fssrv) owns the namespace.
The hard part is waiting. A syscall that sleeps does not return up the C stack: the thread resumes after the svc instruction. So a proxy operation that has to wait for the server does this instead:
Positions are restored on replay so side effects of an earlier pass are not applied twice. The history is dropped when the syscall finally returns (the dispatcher calls AuSrvfsSyscallExit). A request the server does not answer in SRV_TIMEOUT_MS fails with an error, so a dead or stuck server never hangs a client. Reads and writes move at most one page per operation.
|
extern |
| void AuSrvfsInitialize | ( | void | ) |
AuSrvfsInitialize – mount the /srv proxy file system.
| void AuSrvfsNoteOpenMode | ( | int | mode | ) |
AuSrvfsNoteOpenMode – OpenFile tells the proxy the mode of the open it is about to do.
| int AuSrvfsRemove | ( | const char * | path | ) |
AuSrvfsRemove – remove a /srv file for the RemoveFile syscall; 0 on success.
| void AuSrvfsSyscallEnterSlow | ( | AA64Thread * | thr | ) |
| void AuSrvfsSyscallExitSlow | ( | AA64Thread * | thr | ) |
| int g_srvfs_active |
syscall bracket hooks: restartable operations replay per-syscall history