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

fuse_file_info, File Handle, and open() #6

Open
Trendyne opened this issue May 7, 2021 · 1 comment
Open

fuse_file_info, File Handle, and open() #6

Trendyne opened this issue May 7, 2021 · 1 comment

Comments

@Trendyne
Copy link

Trendyne commented May 7, 2021

libfuse provides a fh field in the fuse_file_info struct which is passed to most functions
https://libfuse.github.io/doxygen/structfuse__file__info.html#a45314d0b92a8d4c9de33d996aa59ada8

File handle id. May be filled in by filesystem in create, open, and opendir(). Available in most other file operations on the same file handle.

These are needed if you want to keep data consistent across chunked read()s or write()s where the data might be non-static for the path.
Adding overloads that provide at least the fh and an open() method in the Operations interface, as well as a close() for cleanup, would allow a wider range of applications than just static content per path.

@CyberShadow
Copy link
Member

Yeah, I think the high-level D wrapper ought to be rewritten to take advantage of that.

For now I would suggest just using the D bindings to the C API. It is better documented (just see the C API docs), and the D wrapper doesn't add all that much value.

Here are some examples of using the C API in D programs I wrote:
https://github.com/CyberShadow/ripfs/blob/466dae1fb7ab16ad4dc4948a091fd4551499f5af/ripfs.d#L437-L575
https://github.com/CyberShadow/thincow/blob/b86c4b5aa8e4e38bde2b87a690bda828cc667a1a/source/thincow/fuse.d#L93-L411

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

2 participants