cberner / fuser

Filesystem in Userspace (FUSE) for Rust
MIT License
835 stars 114 forks source link

Add file handle for get_attr requests. #279

Closed IamTheCarl closed 7 months ago

IamTheCarl commented 7 months ago

This PR adds the file handle parameter to the getattr request. This feature is necessary when implementing filesystem APIs that generate file contents on request, like /proc. The correct length of the file must be returned by getattr for that specific instance of the generated file, otherwise most programs will not read the file correctly. A file handle is needed to know which instance we are getting attributes for.

The parameter is available in ABI 7-9 and above, and has been feature gated as such. When the feature is not enabled, the getattr method on Filesystems will always be passed None for the file descriptor.

IamTheCarl commented 7 months ago

Thank you!