Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trickfs: add trickmnt #766

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[workspace]
resolver = "2"
members = ["core", "nomt", "fuzz", "torture", "examples/*", "trickfs"]
members = [
"core",
"nomt",
"fuzz",
"torture",
"examples/*",
"trickfs",
"trickfs/trickmnt",
]
exclude = ["benchtop"]

[workspace.package]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ NOMT: Project Root.
|--<a href="./nomt">nomt</a>: Implementation of the NOMT database.
|──<a href="./torture">torture</a>: Extensive testing suite for NOMT.
|--<a href="./trickfs">trickfs</a>: A FUSE filesystem aiding deeper testing. Experimental.
│ ├──<a href="./trickfs/trickmnt">trickmnt</a>: A tool that allows mounting trickfs.
</pre>

## Architecture
Expand Down
4 changes: 3 additions & 1 deletion trickfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ edition.workspace = true
license.workspace = true

[dependencies]
env_logger = "0.11.6"
fuser = { version = "0.15.1", features = ["abi-7-23"] }
libc = "0.2.169"
log = "0.4.22"
tempfile = "3.15.0"

[dev-dependencies]
env_logger = "0.11.6"
10 changes: 10 additions & 0 deletions trickfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

A FUSE filesystem useful for failure injection.

# Using trickfs.

Typically you would not need to run trickfs directly, because it should be used as a dependency
in other projects. However, if you want to test the filesystem, you can do so by running the
following command:

```sh
cargo run --release --bin trickmnt
```

# Building

Building the project requires fuse3 and fuse to be available. On Ubuntu, you can install them with
Expand Down
9 changes: 0 additions & 9 deletions trickfs/src/main.rs

This file was deleted.

15 changes: 15 additions & 0 deletions trickfs/trickmnt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "trickmnt"
version = "0.1.0"
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
trickfs = { path = ".." }
clap = { version = "4.3.5", features = ["derive"] }
env_logger = "0.11.6"
log = "0.4.22"
anyhow = "1.0.95"
28 changes: 28 additions & 0 deletions trickfs/trickmnt/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use clap::Parser;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
/// Path to the directory where trickfs will be mounted
#[arg(short, long, default_value = "/tmp/trick")]
mountpoint: String,
}

fn waitline() {
log::info!("press return to stop...");
let _ = std::io::stdin().read_line(&mut String::new());
}

fn main() -> anyhow::Result<()> {
env_logger::builder()
.filter_level(log::LevelFilter::Info)
.init();

let args = Args::parse();

let handle = trickfs::spawn_trick(args.mountpoint).unwrap();
waitline();
drop(handle);

Ok(())
}