I am trying to implement a FUSE filesystem, and after reading around. I think I have found out how to implement it. I would state out what my idea is of the implementation. Please let me know if it is right or wrong.
One implements the operations that is required to be implemented by the filesystem using whatever functions one sees fit (say xmp_getattributes
for getattr
function) and then maps those functions to the corresponding functions in a struct of type fuse_operations
static struct fuse_operations xmp_oper =
{
.getattr = xmp_getattributes,
//more declarations...
};
Now, if I have used a class ExFuse
to implement a FUSE filesystem and I have a method ExFuse::getAttributes
which does the job of getattr
in the implementation. Then, my declaration would change as
static struct fuse_operations xmp_oper =
{
.getattr = ExFuse::getAttributes,
//more declarations...
};
Am I correct? Also, is there any other way of implementing FUSE in C++ which is better than the static struct
declaration?