public Result OpenFile(out FileAccessor file, U8Span path, OpenMode mode) { UnsafeHelpers.SkipParamInit(out file); Result rc = CheckPath(new U8Span(_mountName.Name), path); if (rc.IsFailure()) { return(rc); } IFile iFile = null; try { rc = _fileSystem.OpenFile(out iFile, path, mode); if (rc.IsFailure()) { return(rc); } var fileAccessor = new FileAccessor(FsClient, ref iFile, this, mode); using (ScopedLock.Lock(ref _openListLock)) { _openFiles.AddLast(fileAccessor); } if (_isPathCacheAttached) { if (mode.HasFlag(OpenMode.AllowAppend)) { throw new NotImplementedException(); } else { throw new NotImplementedException(); } } file = Shared.Move(ref fileAccessor); return(Result.Success); } finally { iFile?.Dispose(); } }
public void NotifyCloseFile(FileAccessor file) { using ScopedLock <SdkMutexType> lk = ScopedLock.Lock(ref _openListLock); Remove(_openFiles, file); }
internal FileHandle(Impl.FileAccessor file) { File = file; }