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

fuseSynchronizeFile should take fh as a parameter #11

Open
matil019 opened this issue Apr 19, 2020 · 3 comments · May be fixed by #12
Open

fuseSynchronizeFile should take fh as a parameter #11

matil019 opened this issue Apr 19, 2020 · 3 comments · May be fixed by #12

Comments

@matil019
Copy link

Nice to meet you.

I'm studying this package by writing an "identity" filesystem whose callbacks just calls corresponding system calls.

I've stumbled upon implementing fuseSynchronizeFile, whose type is FuseOperations fh -> FilePath -> SyncType -> IO Errno. I believe it is supposed to implement fsync(2), which takes a file descriptor. However I can't implement it because it doesn't take fh as a parameter like fuseRead and fuseWrite do.

I think fuseSynchronizeFile should have a type FuseOperations fh -> FilePath -> fh -> SyncType -> IO Errno. I'm ready to write a PR.

@m15k
Copy link
Collaborator

m15k commented Apr 21, 2020 via email

@matil019
Copy link
Author

Thank you.

It turned out that the callbacks for directories (fuseOpenDirectory, fuseReadDirectory, fuseReleaseDirectory and fuseSynchronizeDirectory) also need handles. I'm going to add another type variable to FuseOperations for directory handles.

So it would look like:

data FuseOperations fh dh = FuseOperations
  { ...
  , fuseSynchronizeFile :: FilePath -> fh -> SyncType -> IO Errno
  , fuseOpenDirectory :: FilePath -> IO (Either Errno dh)
  , fuseReadDirectory :: FilePath -> dh -> IO (Either Errno [(FilePath, FileStat)])
  , etc...
  }

Added dh. In my use case, dh would correspond to DIR *.

@matil019 matil019 linked a pull request Apr 23, 2020 that will close this issue
@plredmond
Copy link

I'm also writing a passthru implementation and came to the same conclusion. Thanks for doing PR #12 @matil019!

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

Successfully merging a pull request may close this issue.

3 participants