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

exit and unmount ?? #6

Open
timbod7 opened this issue Oct 20, 2016 · 6 comments
Open

exit and unmount ?? #6

timbod7 opened this issue Oct 20, 2016 · 6 comments

Comments

@timbod7
Copy link

timbod7 commented Oct 20, 2016

Nice library! I'm using it in a small project.

I'd like my filesystem to unmount itself under certain circumstances - any suggestions on how this can be done with the current API?

@timbod7 timbod7 changed the title exit and unmount exit and unmount ?? Oct 20, 2016
@m15k
Copy link
Collaborator

m15k commented Oct 25, 2016

Can you give a specific example of what you are trying to do?

On Oct 20, 2016 4:41 PM, "Tim Docker" [email protected] wrote:

Nice library! I'm using it in a small project
https://github.com/timbod7/secretfs.

I'd like my filesystem to unmount itself under certain circumstances - any
suggestions on how this can be done with the current API?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#6, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPRBap1la6sNDsj20Fh444AcTybU2leks5q19_7gaJpZM4KcosR
.

@timbod7
Copy link
Author

timbod7 commented Oct 25, 2016

I'd like to set things up such that if no requests were received within a given time, the FUSE file system would unmount it self, and the process would exit.

@m15k
Copy link
Collaborator

m15k commented Oct 26, 2016

That would certainly be possible, though outside the scope of hfuse. You
are looking for something like machines or conduit. Or perhaps more simply
using bracket from Control.Exception?

On Tue, Oct 25, 2016 at 2:44 PM, Tim Docker [email protected]
wrote:

I'd like to set things up such that if no requests were received within a
given time, the FUSE file system would unmount it self, and the process
would exit.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#6 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAPRBZYtQ6qB0r_IJOk96CVrBdIoFGpQks5q3lwTgaJpZM4KcosR
.

@timbod7
Copy link
Author

timbod7 commented Oct 26, 2016

I don't understand what you are suggesting wrt to bracket, machines, or conduit. I start hfuse with a call to

fuseMain :: Exception e => FuseOperations fh -> (e -> IO Errno) -> IO ()

What should I call to shutdown the process?

@m15k
Copy link
Collaborator

m15k commented Oct 28, 2016

Haven't forgotten about you, will get a chance to look at this, this
weekend.

On Wed, Oct 26, 2016 at 3:51 PM, Tim Docker [email protected]
wrote:

I don't understand what you are suggesting wrt to bracket, machines, or
conduie. I start hfuse with a call to

fuseMain :: Exception e => FuseOperations fh -> (e -> IO Errno) -> IO ()

What should I call to shutdown the process?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#6 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAPRBcnbQkEIOEB_53LCkPmC1tOXGuV3ks5q371HgaJpZM4KcosR
.

@plredmond
Copy link

I encountered this same issue (inability to cleanly un-mount programmatically). The work-around that I came up with was to call fusermount -u on the value of the mountpoint argument.

Proc.callProcess "fusermount" ["-u", mountpoint]

This is inelegant (call to an external program) and error prone (it fails if called while fuse is busy or called from the same thread as is executing a fuse callback, such as, from within the fuseInit function). It works if you call it from another thread, such as from Control.Concurrent.forkIO. It doesn't always work on the first try, however, and so you need to take care to catch exceptions, and retry, until successful.

A programmatic solution would be desirable. Perhaps fuseMainInline or fuseRunInline can be used to have more control?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants