示例#1
0
 private unsafe int Read(path *path, void *buffer, UIntPtr size, ulong off, fuse_file_info *fi)
 {
     try
     {
         // TODO: handle size > int.MaxValue
         return(_fileSystem.Read(ToSpan(path), off, new Span <byte>(buffer, (int)size), ref ToFileInfoRef(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }
示例#2
0
 private unsafe int Release(path *path, fuse_file_info *fi)
 {
     try
     {
         _fileSystem.Release(ToSpan(path), ref ToFileInfoRef(fi));
         return(0);
     }
     catch
     {
         return(-EIO);
     }
 }
示例#3
0
 private unsafe int Release(path *path, fuse_file_info *fi)
 {
     try
     {
         _fileSystem.Release(ToSpan(path), ref ToFileInfoRef(fi));
         return(0);
     }
     catch (Exception ex)
     {
         Console.WriteLine($"RELEASE gets error: {ex.Message} {ex.StackTrace}");
         return(-EIO);
     }
 }
示例#4
0
 private unsafe int Read(path *path, void *buffer, UIntPtr size, ulong off, fuse_file_info *fi)
 {
     try
     {
         // TODO: handle size > int.MaxValue
         return(_fileSystem.Read(ToSpan(path), off, new Span <byte>(buffer, (int)size), ref ToFileInfoRef(fi)));
     }
     catch (Exception ex)
     {
         Console.WriteLine($"READ gets error: {ex.Message} {ex.StackTrace}");
         return(-EIO);
     }
 }
示例#5
0
 private unsafe int Statfs(path *path, statvfs *vfs)
 {
     try
     {
         Span <statvfs> span = new Span <statvfs>(vfs, 1);
         span.Clear();
         return(_fileSystem.StatFS(ToSpan(path), ref MemoryMarshal.GetReference(span)));
     }
     catch
     {
         return(-EIO);
     }
 }
示例#6
0
 private unsafe int Getattr(path *path, stat *stat, fuse_file_info *fi)
 {
     try
     {
         Span <stat> span = new Span <stat>(stat, 1);
         span.Clear();
         return(_fileSystem.GetAttr(ToSpan(path), ref MemoryMarshal.GetReference(span), ToFileInfo(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }
示例#7
0
 private unsafe int Getattr(path *path, stat *stat, fuse_file_info *fi)
 {
     try
     {
         Span <stat> span = new Span <stat>(stat, 1);
         span.Clear();
         return(_fileSystem.GetAttr(ToSpan(path), ref MemoryMarshal.GetReference(span), ToFileInfo(fi)));
     }
     catch (Exception ex)
     {
         Console.WriteLine($"GETATTR gets error: {ex.Message}");
         return(-EIO);
     }
 }
示例#8
0
 private unsafe int Utimens(path *path, timespec *tv, fuse_file_info *fi)
 {
     try
     {
         Span <timespec> specs = new Span <timespec>(tv, 2);
         return(_fileSystem.UpdateTimestamps(ToSpan(path),
                                             ref MemoryMarshal.GetReference(specs),
                                             ref MemoryMarshal.GetReference(specs.Slice(1)),
                                             ToFileInfo(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }
示例#9
0
 private unsafe int Opendir(path *path, fuse_file_info *fi)
 {
     try
     {
         //Console.WriteLine("OPENDIR TOP - Fusemount");
         var fiF = new FuseFileInfo();
         return(_fileSystem.OpenDir(ToSpan(path), ref fiF));
         //return _fileSystem.OpenDir(ToSpan(path), ref ToFileInfoRef(fi));
     }
     catch (Exception ex)
     {
         Console.WriteLine($"OPENDIR gets error: {ex.Message}");
         return(-EIO);
     }
 }
示例#10
0
        private unsafe int Readdir(path *path, void *buf, fuse_fill_dir *filler, ulong offset, fuse_file_info *fi, int flags)
        {
            try
            {
                fuse_fill_dir_Delegate fillDelegate;
                ManagedFiller          previousFiller = _previousFiller;
                if (previousFiller != null && previousFiller.Filler == filler)
                {
                    fillDelegate = previousFiller.Delegate;
                }
                else
                {
                    fillDelegate    = Marshal.GetDelegateForFunctionPointer <fuse_fill_dir_Delegate>(new IntPtr(filler));
                    _previousFiller = new ManagedFiller(filler, fillDelegate);
                }

                return(_fileSystem.ReadDir(ToSpan(path), offset, (ReadDirFlags)flags, ToDirectoryContent(buf, fillDelegate), ref ToFileInfoRef(fi)));
            }
            catch
            {
                return(-EIO);
            }
        }
示例#11
0
        private unsafe ReadOnlySpan <byte> ToSpan(path *path)
        {
            var span = new ReadOnlySpan <byte>(path, int.MaxValue);

            return(span.Slice(0, span.IndexOf((byte)0)));
        }