tmds / Tmds.Fuse

Write a Linux file system in .NET
GNU Lesser General Public License v2.1
33 stars 8 forks source link

Issue with FSync #28

Open seertenedos opened 4 years ago

seertenedos commented 4 years ago

For the FSync call i am doing some basic logging and am just trying to test MMap on the drive from dotnet core.

protected override int FSync(string path, ref FuseFileInfo fi)
{
      Log.Trace($"Entered FSync path:{path}, fi) FileHandle:{fi.fh}");
this 

the above code fails with null reference exception on the fi.fh but it is a struct and can't be null. Exception details below Exception thrown: 'System.NullReferenceException' in Tmds.Fuse.dll An exception of type 'System.NullReferenceException' occurred in Tmds.Fuse.dll but was not handled in user code: 'Object reference not set to an instance of an object.' Stack trace:

at Tmds.Fuse.FuseFileInfo.get_fh() at MultiDrive.DriveFactories.Fuse3Drive.FuseWrapping.FuseFileSystemStringLogging.FSync(String path, FuseFileInfo& fi) in O:\git\StorjDrive\StorjDrive\Fuse3Drive\FuseWrapping\FuseFileSystemStringLogging.cs:line 387 at Tmds.Fuse.FuseFileSystemStringBase.FSync(ReadOnlySpan`1 path, FuseFileInfo& fi) at Tmds.Fuse.FuseMount.Fsync(path path, fuse_file_info fi)

seertenedos commented 4 years ago

also in VS2019 debugger next to the fi local variable it says "Unable to read memory"

seertenedos commented 4 years ago

also your signature looks like it mismatches with fuse doco i think. fuse (https://libfuse.github.io/doxygen/structfuse__operations.html#a92bdd6f43ba390a54ac360541c56b528) says

int(* fuse_operations::fsync)(const char *, int, struct fuse_file_info *)

where are you lib says

unsafe delegate int fsync_delegate(path* path, fuse_file_info* fi);

yours is missing a second argument of int so only ends up with 2 arguments not 3

seertenedos commented 4 years ago

on my fork the last checkin (https://github.com/seertenedos/Tmds.Fuse/commit/0a3dce1bcbaed0826635693a25177d1b242e57f6) applies the change and it seems to work. sorry my git skill are not good over forks as i could not workout how to create a pull request with just that commit cherry picked