public FileAccessor(FileSystemClient fsClient, ref IFile file, FileSystemAccessor parentFileSystem, OpenMode mode) { _fsClient = fsClient; _file = Shared.Move(ref file); _parentFileSystem = parentFileSystem; _openMode = mode; }
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); }
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()); }
private static bool Matches(FileSystemAccessor accessor, U8Span name) { return(StringUtils.Compare(accessor.GetName(), name, Unsafe.SizeOf <MountName>()) == 0); }
public DirectoryAccessor(ref IDirectory directory, FileSystemAccessor parentFileSystem) { _directory = Shared.Move(ref directory); _parentFileSystem = parentFileSystem; }