Crates.io | frogger |
lib.rs | frogger |
version | 0.1.2 |
source | src |
created_at | 2024-12-09 23:55:25.274456 |
updated_at | 2024-12-10 00:18:46.416812 |
description | 🐸 Simple file system implementation using the 9P protocol |
homepage | |
repository | https://github.com/doriancodes/frogger |
max_upload_size | |
id | 1477909 |
size | 100,956 |
Simple file system implementation using the 9P protocol
The P9 protocol for file systems requires a unique feature called bind
, which allows for flexible control over the namespace
(file hierarchy). The bind operation maps a file, directory, or another namespace tree into a new location in the namespace.
It supports three binding modes: Before, After, and Replace. Each mode provides different behaviors for resolving file
lookups when multiple resources are mapped to the same namespace.
frg bind src mountpoint
This mode replaces whatever was previously mounted at the mountpoint with the src. Only the new src is visible at the specified mountpoint.
src
completely overrides any existing content at the mountpoint
. frg bind /test/config /etc
After this, processes see /test/config
contents instead of the original /etc
.
/bin
to a custom toolchain directory for development: frg bind /custom/tools/bin /bin
frg bind -b src mountpoint
In this mode the src
is placed before the existing contents of the mountpoint. When a lookup occurs,
a Plan9 file system searches src
first, and if the file isn't found there, it searches the original mountpoint
.
src
at a higher priority, leaving the existing content accessible as a fallback. frg bind -b /custom/bin /bin
In this case, /custom/bin/ls
will be used instead of /bin/ls
if both exist.frg bind -a src mountpoint
This mode appends the src
to the mountpoint
's search path. Plan 9 resolves lookups by searching the original
mountpoint
first, and if the file isn't found there, it checks the src
.
src
as a fallback while maintaining the existing content's priority. frg bind -a /extra/fonts /fonts
Here, /fonts
will use default system fonts first and fall back to /extra/fonts
if needed. frg bind -a /additional/config /etc
This ensures /etc
retains its default behavior but gains the additional configuration files if the defaults don’t exist.Using frg bind -b
and frg bind -a
, you can create union directories where files from multiple sources appear merged.
For example:
frg bind -b /local/bin /bin
frg bind -a /backup/bin /bin
This setup prioritizes /local/bin
, followed by /bin
, and finally /backup/bin
.
For isolating environments, such as creating chroot-like environments or managing per-process views of namespaces.