ghostfs
ghostfs copied to clipboard
How to implement symlinks in ghostfs?
@raphaelsc I already had implemented symlinks on my ghost-based filesystem called lionfs. I used fake files, which are created as nodeids in FUSE but they are not deleted (behind FUSE). However "fakefiles" is a good way, because readlink() need to return a file name (path) for any syscall made in a symlink. Other suggestions?
On Thu, Feb 18, 2016 at 5:22 PM, Ricardo Biehl Pasquali < [email protected]> wrote:
I already had implemented symlinks on my ghost-based filesystem called lionfs. I used fake files, which are created as nodeids in FUSE but they are not deleted (behind FUSE). However "fakefiles" is a good way, because readlink() need to return a file name (path) for any syscall made in a symlink. Other suggestions?
Take a look at blockv: https://github.com/raphaelsc/blockv
You have to store target of a file created with symlink() in a hash map. In C++, it means unordered_map, look: http://www.cplusplus.com/reference/unordered_map/unordered_map/
This hash map will be used by readlink() to get the target of a symlink. Also make sure that getattr() returns S_IFLNK as st_mode for a symlink. You also have to make sure that the target file "exists" by faking it. The latter is the second step of the implementation. No need to worry about it at the moment.
Again, look at blockv code for help. Blockv properly implements symlink support.
— Reply to this email directly or view it on GitHub https://github.com/raphaelsc/ghostfs/issues/6.
Raphael S. Carvalho