Example #1
0
        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();
            }
        }
Example #2
0
 public void NotifyCloseFile(FileAccessor file)
 {
     using ScopedLock <SdkMutexType> lk = ScopedLock.Lock(ref _openListLock);
     Remove(_openFiles, file);
 }
Example #3
0
 internal FileHandle(Impl.FileAccessor file)
 {
     File = file;
 }