Пример #1
0
        public FileAccessor(FileSystemClient fsClient, ref IFile file, FileSystemAccessor parentFileSystem,
                            OpenMode mode)
        {
            _fsClient = fsClient;

            _file             = Shared.Move(ref file);
            _parentFileSystem = parentFileSystem;
            _openMode         = mode;
        }
Пример #2
0
        public Result Mount(FileSystemAccessor fileSystem)
        {
            using ScopedLock <SdkMutexType> lk = ScopedLock.Lock(ref _mutex);

            if (!CanAcceptMountName(fileSystem.GetName()))
            {
                return(ResultFs.MountNameAlreadyExists.Log());
            }

            _fileSystemList.AddLast(fileSystem);
            return(Result.Success);
        }
Пример #3
0
        public Result Find(out FileSystemAccessor accessor, U8Span name)
        {
            UnsafeHelpers.SkipParamInit(out accessor);
            using ScopedLock <SdkMutexType> lk = ScopedLock.Lock(ref _mutex);

            for (LinkedListNode <FileSystemAccessor> currentNode = _fileSystemList.First;
                 currentNode is not null;
                 currentNode = currentNode.Next)
            {
                if (!Matches(currentNode.Value, name))
                {
                    continue;
                }
                accessor = currentNode.Value;
                return(Result.Success);
            }

            return(ResultFs.NotMounted.Log());
        }
Пример #4
0
 private static bool Matches(FileSystemAccessor accessor, U8Span name)
 {
     return(StringUtils.Compare(accessor.GetName(), name, Unsafe.SizeOf <MountName>()) == 0);
 }
Пример #5
0
 public DirectoryAccessor(ref IDirectory directory, FileSystemAccessor parentFileSystem)
 {
     _directory        = Shared.Move(ref directory);
     _parentFileSystem = parentFileSystem;
 }