squashfuse-rs

Crates.iosquashfuse-rs
lib.rssquashfuse-rs
version0.3.0
sourcesrc
created_at2024-07-25 16:46:55.836262
updated_at2024-07-26 03:43:37.807748
descriptionFUSE implementation of Squashfs written in Rust.
homepage
repositoryhttps://github.com/linux-packaging-rs/squashfuse-rs
max_upload_size
id1315264
size9,793
Ryan Brue (ryanabx)

documentation

README

squashfuse-rs

Implementation of FUSE for SquashFS in rust using the fuser and backhand crates!

Inspired by a C library called squashfuse https://github.com/vasi/squashfuse/tree/master

PRs are welcome, I don't claim to know a lot about SquashFS and FUSE, so if there is a better way of doing things, please let me know!

Example usage from appimage-type2-runtime-rs:

fn fusefs_main(offset: u64, mountpoint: &Path, archive_path: &Path) -> anyhow::Result<()> {
    let reader = BufReader::new(File::open(&archive_path)?);
    let fs = squashfuse_rs::SquashfsFilesystem::new(
        backhand::FilesystemReader::from_reader_with_offset(reader, offset)?,
    );
    let mount_options = vec![
        fuser::MountOption::FSName("squashfuse".to_string()),
        fuser::MountOption::RO,
    ];
    match fuser::mount2(fs, mountpoint, &mount_options) {
        Ok(()) => {
            println!("Mounted {:?} at {:?}", archive_path, mountpoint);
            Ok(())
        }
        Err(err) => Err(anyhow::anyhow!("Failed to mount: {}", err)),
}
Commit count: 0

cargo fmt