From fd69795fa1990b1d8b7766fea00e774980410029 Mon Sep 17 00:00:00 2001 From: Baruch Even Date: Fri, 4 Nov 2016 17:24:34 +0200 Subject: [PATCH 1/5] Fix warning about old style array --- source/c/fuse/common.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/c/fuse/common.d b/source/c/fuse/common.d index 920af35..dcb945d 100644 --- a/source/c/fuse/common.d +++ b/source/c/fuse/common.d @@ -63,7 +63,7 @@ extern (System) { /** * For future use. */ - uint reserved[23]; + uint[23] reserved; } static assert(fuse_file_info.sizeof == 64); From e91eb886609c4bd82834a7f2b818bf92bd6e62b7 Mon Sep 17 00:00:00 2001 From: Baruch Even Date: Fri, 4 Nov 2016 17:25:47 +0200 Subject: [PATCH 2/5] Fix link to fuse.d in repository --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c279d87..00f919a 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ class MyFS : Operations } ``` -A minimal filesystem implements `Operations.getattr()`, `Operations.readdir()`, `Operations.read()`. See [dfuse/fuse.d](https://github.com/facebook/dfuse/blob/master/dfuse/fuse.d) for implementation specific details. +A minimal filesystem implements `Operations.getattr()`, `Operations.readdir()`, `Operations.read()`. See [dfuse/fuse.d](https://github.com/facebook/dfuse/blob/master/source/dfuse/fuse.d) for implementation specific details. To mount a filesystem use a Fuse object and call mount: ```D From 4dd025d53b8e7faafe296bb91c054e1e774d6592 Mon Sep 17 00:00:00 2001 From: Baruch Even Date: Fri, 4 Nov 2016 17:31:49 +0200 Subject: [PATCH 3/5] Fix a linking issue when building with dub For some reason the build with dub tries to use the osx library on Linux, reordering avoids this though probably breaks it on OSX. --- dub.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dub.json b/dub.json index 4915c90..d77c028 100644 --- a/dub.json +++ b/dub.json @@ -9,12 +9,12 @@ "configurations": [{ "name": "dfuse", "targetType": "library", - "platforms": ["osx"], - "libs": ["osxfuse_i32"] + "platforms": ["linux"], + "libs": ["fuse"] }, { "name": "dfuse", "targetType": "library", - "platforms": ["linux"], - "libs": ["fuse"] + "platforms": ["osx"], + "libs": ["osxfuse_i32"] }] } From 043526c6d393b3c2ad4ce362f606ef0e18dffa6f Mon Sep 17 00:00:00 2001 From: Baruch Even Date: Fri, 4 Nov 2016 22:28:58 +0200 Subject: [PATCH 4/5] Give different names to OSX and Linux targets According to dub issue https://github.com/dlang/dub/issues/984 this is the cause for the failure to compile and that an error should have been emitted but currently no error is given. --- dub.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dub.json b/dub.json index d77c028..4287297 100644 --- a/dub.json +++ b/dub.json @@ -7,12 +7,12 @@ "license": "BSL-1.0", "dependencies": {}, "configurations": [{ - "name": "dfuse", + "name": "dfuse-linux", "targetType": "library", "platforms": ["linux"], "libs": ["fuse"] }, { - "name": "dfuse", + "name": "dfuse-osx", "targetType": "library", "platforms": ["osx"], "libs": ["osxfuse_i32"] From e131430044ac264c0efab9b55eb474c2480096b1 Mon Sep 17 00:00:00 2001 From: Baruch Even Date: Sat, 5 Nov 2016 11:12:29 +0200 Subject: [PATCH 5/5] Implement an exit by signalling the process This will exit the fuse_main cleanly and unmount the filesystem. This only works for a foreground process currently. --- source/dfuse/fuse.d | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/dfuse/fuse.d b/source/dfuse/fuse.d index 8048b03..c891f24 100644 --- a/source/dfuse/fuse.d +++ b/source/dfuse/fuse.d @@ -17,8 +17,10 @@ import std.array; import std.conv; import std.stdio; import std.string; +import std.process; import errno = core.stdc.errno; import core.stdc.string; +import core.sys.posix.signal; import c.fuse.fuse; @@ -320,6 +322,7 @@ private: bool foreground; bool threaded; string fsname; + int pid; public: this(string fsname) @@ -381,6 +384,12 @@ public: enforce(length == cargs.length); } + this.pid = thisProcessID(); fuse_main(length, cast(char**) cargs.ptr, &fops, &ops); } + + void exit() + { + kill(this.pid, SIGINT); + } }