I believe I've found a fairly neat abstraction in KFS: https://github.com/roblabla42/KFS/blob/master/libuser/src/syscalls.rs#L114