Skip to content

Commit 7117d04

Browse files
committed
trickfs: add trickmnt
adds a binary target called `trickmnt` to quickly mount a trickfs locally.
1 parent 3a06b49 commit 7117d04

File tree

7 files changed

+78
-13
lines changed

7 files changed

+78
-13
lines changed

Cargo.lock

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
[workspace]
22
resolver = "2"
3-
members = ["core", "nomt", "fuzz", "torture", "examples/*", "trickfs"]
3+
members = [
4+
"core",
5+
"nomt",
6+
"fuzz",
7+
"torture",
8+
"examples/*",
9+
"trickfs",
10+
"trickfs/trickmnt",
11+
]
412
exclude = ["benchtop"]
513

614
[workspace.package]

trickfs/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ edition.workspace = true
88
license.workspace = true
99

1010
[dependencies]
11-
env_logger = "0.11.6"
1211
fuser = { version = "0.15.1", features = ["abi-7-23"] }
1312
libc = "0.2.169"
1413
log = "0.4.22"
1514
tempfile = "3.15.0"
15+
16+
[dev-dependencies]
17+
env_logger = "0.11.6"

trickfs/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
A FUSE filesystem useful for failure injection.
44

5+
# Using trickfs.
6+
7+
Typically you would not need to run trickfs directly, because it should be used as a dependency
8+
in other projects. However, if you want to test the filesystem, you can do so by running the
9+
following command:
10+
11+
```sh
12+
cargo run --release --bin trickmnt
13+
```
14+
515
# Building
616

717
Building the project requires fuse3 and fuse to be available. On Ubuntu, you can install them with

trickfs/src/main.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

trickfs/trickmnt/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "trickmnt"
3+
version = "0.1.0"
4+
authors.workspace = true
5+
homepage.workspace = true
6+
repository.workspace = true
7+
edition.workspace = true
8+
license.workspace = true
9+
10+
[dependencies]
11+
trickfs = { path = ".." }
12+
clap = { version = "4.3.5", features = ["derive"] }
13+
env_logger = "0.11.6"
14+
log = "0.4.22"
15+
anyhow = "1.0.95"

trickfs/trickmnt/src/main.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
use clap::Parser;
2+
3+
#[derive(Parser, Debug)]
4+
#[command(author, version, about, long_about = None)]
5+
struct Args {
6+
/// Path to the directory where trickfs will be mounted
7+
#[arg(short, long, default_value = "/tmp/trick")]
8+
mountpoint: String,
9+
}
10+
11+
fn waitline() {
12+
log::info!("press return to stop...");
13+
let _ = std::io::stdin().read_line(&mut String::new());
14+
}
15+
16+
fn main() -> anyhow::Result<()> {
17+
env_logger::builder()
18+
.filter_level(log::LevelFilter::Info)
19+
.init();
20+
21+
let args = Args::parse();
22+
23+
let handle = trickfs::spawn_trick(args.mountpoint).unwrap();
24+
waitline();
25+
drop(handle);
26+
27+
Ok(())
28+
}

0 commit comments

Comments
 (0)