summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2017-05-11 00:13:20 -0400
committerKjetil Orbekk <kjetil.orbekk@gmail.com>2017-05-11 00:13:20 -0400
commit736e822f747e86f3d1bea54b8b83f5a8f0a21da8 (patch)
tree2109ece3d633692061a1959b8bf55e16cd910867
Initial commit.
-rw-r--r--.gitignore2
-rw-r--r--default.nix8
-rw-r--r--v1/Cargo.toml8
-rw-r--r--v1/src/main.rs33
4 files changed, 51 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fbab8b0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*/target/
+*/Cargo.lock \ No newline at end of file
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..65d93ef
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,8 @@
+with import <nixpkgs> {};
+
+{
+ rustenv = stdenv.mkDerivation {
+ name = "rust";
+ buildInputs = [ rustStable.rustc rustStable.cargo fuse pkgconfig ];
+ };
+}
diff --git a/v1/Cargo.toml b/v1/Cargo.toml
new file mode 100644
index 0000000..a126a80
--- /dev/null
+++ b/v1/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "v1"
+version = "0.1.0"
+authors = ["Kjetil Orbekk <kj@orbekk.com>"]
+
+[dependencies]
+fuse = "0.3"
+libc = "0.2"
diff --git a/v1/src/main.rs b/v1/src/main.rs
new file mode 100644
index 0000000..d78da04
--- /dev/null
+++ b/v1/src/main.rs
@@ -0,0 +1,33 @@
+extern crate fuse;
+extern crate libc;
+
+use fuse::{Filesystem, Request, ReplyEntry, ReplyAttr, ReplyDirectory, ReplyData};
+use libc::ENOENT;
+use std::ffi::OsStr;
+
+struct MemFs;
+
+impl Filesystem for MemFs {
+ fn lookup(&mut self, _req: &Request, _parent: u64, _name: &OsStr,
+ reply: ReplyEntry) {
+ reply.error(ENOENT);
+ }
+
+ fn getattr(&mut self, _req: &Request, _ino: u64, reply: ReplyAttr) {
+ reply.error(ENOENT);
+ }
+
+ fn read(&mut self, _req: &Request, _ino: u64, _fh: u64, _offset: u64,
+ _size: u32, reply: ReplyData) {
+ reply.error(ENOENT);
+ }
+ fn readdir (&mut self, _req: &Request, ino: u64, _fh: u64, offset: u64,
+ reply: ReplyDirectory) {
+ reply.error(ENOENT);
+ }
+}
+
+fn main() {
+ let mountpoint = std::env::args_os().nth(1).unwrap();
+ fuse::mount(MemFs, &mountpoint, &[]).unwrap();
+}