コード例 #1
0
        public int read(string path, byte *buf, IntPtr size, ulong offset, fuse_file_info *fi)
        {
            for (int n = 0; n < size.ToInt32(); n++)
            {
                buf[n] = (byte)'a';
            }

            return((int)size);
        }
コード例 #2
0
 private unsafe int Chown(path *path, uint uid, uint gid, fuse_file_info *fi)
 {
     try
     {
         return(_fileSystem.Chown(ToSpan(path), uid, gid, ToFileInfo(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }
コード例 #3
0
 private unsafe int Create(path *path, mode_t mode, fuse_file_info *fi)
 {
     try
     {
         return(_fileSystem.Create(ToSpan(path), mode, ref ToFileInfoRef(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }
コード例 #4
0
 private unsafe ref FuseFileInfo ToFileInfoRef(fuse_file_info *fi)
 {
     if (fi == null)
     {
         throw new InvalidOperationException($"unexpected: {nameof(fi)} is null");
     }
     else
     {
         return(ref MemoryMarshal.GetReference <FuseFileInfo>(new Span <FuseFileInfo>(fi, 1)));
     }
 }
コード例 #5
0
 private unsafe int Fsyncdir(path *path, int datasync, fuse_file_info *fi)
 {
     try
     {
         return(_fileSystem.FSyncDir(ToSpan(path), datasync != 0, ref ToFileInfoRef(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }
コード例 #6
0
 private unsafe int Releasedir(path *path, fuse_file_info *fi)
 {
     try
     {
         return(_fileSystem.ReleaseDir(ToSpan(path), ref ToFileInfoRef(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }
コード例 #7
0
 private unsafe int Chmod(path *path, mode_t mode, fuse_file_info *fi)
 {
     try
     {
         return(_fileSystem.ChMod(ToSpan(path), mode, ToFileInfo(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }
コード例 #8
0
 private unsafe int Truncate(path *path, ulong length, fuse_file_info *fi)
 {
     try
     {
         return(_fileSystem.Truncate(ToSpan(path), length, ToFileInfo(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }
コード例 #9
0
 private unsafe FuseFileInfoRef ToFileInfo(fuse_file_info *fi)
 {
     if (fi == null)
     {
         return(new FuseFileInfoRef(new Span <FuseFileInfo>()));
     }
     else
     {
         return(new FuseFileInfoRef(new Span <FuseFileInfo>(fi, 1)));
     }
 }
コード例 #10
0
 private unsafe int Flush(path *path, fuse_file_info *fi)
 {
     try
     {
         return(_fileSystem.Flush(ToSpan(path), ref ToFileInfoRef(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }
コード例 #11
0
 private unsafe ref FuseFileInfo ToFileInfoRef(fuse_file_info *fi)
 {
     if (fi == null)
     {
         throw new InvalidOperationException($"unexpected: {nameof(fi)} is null");
     }
     else
     {
         return(ref System.Runtime.CompilerServices.Unsafe.AsRef <FuseFileInfo>(fi));
         // return ref MemoryMarshal.GetReference<FuseFileInfo>(new Span<FuseFileInfo>(fi, 1));
     }
 }
コード例 #12
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);
     }
 }
コード例 #13
0
 private unsafe int Open(path *path, fuse_file_info *fi)
 {
     try
     {
         return(_fileSystem.Open(ToSpan(path), ref ToFileInfoRef(fi)));
     }
     catch (Exception ex)
     {
         Console.WriteLine($"OPEN gets error: {ex.Message}");
         return(-EIO);
     }
 }
コード例 #14
0
 private unsafe int Create(path *path, mode_t mode, fuse_file_info *fi)
 {
     try
     {
         return(_fileSystem.Create(ToSpan(path), mode, ref ToFileInfoRef(fi)));
     }
     catch (Exception ex)
     {
         Console.WriteLine($"CREATE gets error: {ex.Message}");
         return(-EIO);
     }
 }
コード例 #15
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);
     }
 }
コード例 #16
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);
     }
 }
コード例 #17
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);
     }
 }
コード例 #18
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);
     }
 }
コード例 #19
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);
     }
 }
コード例 #20
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);
     }
 }
コード例 #21
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);
            }
        }
コード例 #22
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);
                }

                var fiF = new FuseFileInfo();
                return(_fileSystem.ReadDir(ToSpan(path), offset, (ReadDirFlags)flags, ToDirectoryContent(buf, fillDelegate), ref fiF));
            }
            catch (Exception ex)
            {
                Console.WriteLine($"READDIR gets error: {ex.Message}");
                return(-EIO);
            }
        }
コード例 #23
0
 public Result opendir(string path, fuse_file_info *fi)
 {
     Logger.WriteLine("hello_opendir: '{0}'", path);
     return(Result.OK);
 }
コード例 #24
0
 private unsafe int Fallocate(path *path, int mode, ulong offset, ulong length, fuse_file_info *fi)
 {
     try
     {
         return(_fileSystem.FAllocate(ToSpan(path), mode, offset, (long)length, ref ToFileInfoRef(fi)));
     }
     catch
     {
         return(-EIO);
     }
 }