FUSE calls getattr on special paths on Mac

445 Views Asked by At

I'm writing my own toy file system with FUSE (OSXFUSE on Mac OS X and libfuse on Linux). Each time I mount the file system, FUSE calls getattr on some special paths, as the log shows:

[debug] trfs_getattr: called on path=/
[debug] trfs_getattr: called on path=/._.
[error] get_entry_attr: no entry at path /._.
[debug] trfs_getattr: called on path=/.hidden
[error] get_entry_attr: no entry at path /.hidden
[debug] trfs_getattr: called on path=/._.
[error] get_entry_attr: no entry at path /._.
[debug] trfs_getattr: called on path=/._.
[error] get_entry_attr: no entry at path /._.
[debug] trfs_getattr: called on path=/._.
[error] get_entry_attr: no entry at path /._.
[debug] trfs_getattr: called on path=/.hidden
[error] get_entry_attr: no entry at path /.hidden

Function trfs_getattr() is my own implementation of the getattr() callback in struct fuse_operations.

Function get_entry_attr() is used for getting the attributes of a file, and it reports error because it cannot locate the corresponding file at that path.

It seems like FUSE automatically tries to call getattr() on some special hidden files/directories, and this happens only on Mac OS X. The log output is normal on Linux.

Questions * What are those special files? * Why FUSE calls getattr() on those paths first? * How to prevent this on Mac OS X?

2

There are 2 best solutions below

0
On

It's not Fuse, it FS itself. It uses get_attr to check files existents at path.

0
On

Those ._* files are not created by fuse or your filesystem directly, it's a Mac OS X feature, see: https://apple.stackexchange.com/questions/14980/why-are-dot-underscore-files-created-and-how-can-i-avoid-them