Skip to content

Add utility filesystems#184

Merged
sminez merged 7 commits into
developfrom
9p-util-filesystems
May 7, 2026
Merged

Add utility filesystems#184
sminez merged 7 commits into
developfrom
9p-util-filesystems

Conversation

@sminez
Copy link
Copy Markdown
Owner

@sminez sminez commented May 5, 2026

This is a little rough round the edges to start, but I'm adding some utility file systems and proxies that can be used to build larger systems. The RamFs and LocalProxyFs filesystems are concrete, while the HookFs and ReadOnlyFs filesystems wrap another filesystem implementation in order to provide new functionality.

The local_proxy.rs and ramfs.rs examples show how these things look in use:

use ninep::{
    sync::server::Server,
    util::{hook::HookFs, ram::RamFs},
};
use std::env::{args, current_dir};

fn main() {
    let chatty = args().nth(1).as_deref() == Some("--chatty");
    let fs = HookFs::new(RamFs::new(env!("USER"), "group"), move |op| {
        if chatty {
            println!("{op:?}");
        }

        Ok(())
    });

    let s = Server::new(fs);
    let socket_path = current_dir().unwrap().join("ramfs");

    println!("starting ram-fs file server at {}", socket_path.display());
    if s.serve_socket_with_custom_path(socket_path).join().is_err() {
        eprintln!("server thread died");
    }
}

@sminez sminez force-pushed the 9p-util-filesystems branch 4 times, most recently from 0d092ba to c37bafe Compare May 6, 2026 16:20
@sminez sminez force-pushed the 9p-util-filesystems branch from 3697e06 to ff0daf4 Compare May 7, 2026 13:03
@sminez sminez merged commit 4dff4b8 into develop May 7, 2026
10 checks passed
@sminez sminez deleted the 9p-util-filesystems branch May 7, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant