protected virtual void Dispose(bool disposing) { if (!disposing) { return; } using (ScopedLock.Lock(ref _openListLock)) { Abort.DoAbortUnless(_openFiles.Count == 0, ResultFs.FileNotClosed.Value, "All files must be closed before unmounting."); Abort.DoAbortUnless(_openDirectories.Count == 0, ResultFs.DirectoryNotClosed.Value, "All directories must be closed before unmounting."); if (_isPathCacheAttached) { throw new NotImplementedException(); } } _saveDataAttributeGetter?.Dispose(); _saveDataAttributeGetter = null; _mountNameGenerator?.Dispose(); _mountNameGenerator = null; _fileSystem?.Dispose(); _fileSystem = null; }
public FileSystemAccessor(string name, IFileSystem baseFileSystem, FileSystemClient fsClient, ICommonMountNameGenerator nameGenerator) { Name = name; FileSystem = baseFileSystem; FsClient = fsClient; MountNameGenerator = nameGenerator; }
public FileSystemAccessor(FileSystemClient fsClient, U8Span name, IMultiCommitTarget multiCommitTarget, IFileSystem fileSystem, ICommonMountNameGenerator mountNameGenerator, ISaveDataAttributeGetter saveAttributeGetter) { FsClient = fsClient; _fileSystem = fileSystem; _openFiles = new LinkedList <FileAccessor>(); _openDirectories = new LinkedList <DirectoryAccessor>(); _openListLock.Initialize(); _mountNameGenerator = mountNameGenerator; _saveDataAttributeGetter = saveAttributeGetter; _multiCommitTarget = multiCommitTarget; if (name.IsEmpty()) { Abort.DoAbort(ResultFs.InvalidMountName.Log()); } if (StringUtils.GetLength(name, PathTool.MountNameLengthMax + 1) > PathTool.MountNameLengthMax) { Abort.DoAbort(ResultFs.InvalidMountName.Log()); } StringUtils.Copy(_mountName.Name.Slice(0, PathTool.MountNameLengthMax), name); _mountName.Name[PathTool.MountNameLengthMax] = 0; }
public static Result Register(this FileSystemClient fs, U8Span name, IFileSystem fileSystem, ICommonMountNameGenerator mountNameGenerator) { var accessor = new FileSystemAccessor(fs, name, null, fileSystem, mountNameGenerator, null); fs.Impl.Register(accessor); return(Result.Success); }
public static Result Register(this FileSystemClient fs, U8Span name, IMultiCommitTarget multiCommitTarget, IFileSystem fileSystem, ICommonMountNameGenerator mountNameGenerator, ISaveDataAttributeGetter saveAttributeGetter, bool useDataCache, bool usePathCache) { var accessor = new FileSystemAccessor(fs, name, multiCommitTarget, fileSystem, mountNameGenerator, saveAttributeGetter); accessor.SetFileDataCacheAttachable(useDataCache); accessor.SetPathBasedFileDataCacheAttachable(usePathCache); fs.Impl.Register(accessor); return(Result.Success); }
public Result Register(U8Span mountName, IFileSystem fileSystem, ICommonMountNameGenerator nameGenerator) { var accessor = new FileSystemAccessor(mountName.ToString(), fileSystem, this, nameGenerator); Result rc = MountTable.Mount(accessor); if (rc.IsFailure()) { return(rc); } accessor.IsAccessLogEnabled = IsEnabledAccessLog(); return(Result.Success); }
public static Result Register(this FileSystemClient fs, U8Span name, IMultiCommitTarget multiCommitTarget, IFileSystem fileSystem, ICommonMountNameGenerator mountNameGenerator, bool useDataCache, bool usePathCache) { return(fs.Register(name, multiCommitTarget, fileSystem, mountNameGenerator, null, useDataCache, usePathCache)); }