mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Remove MapBlock method from IReadOnlyFilesystem
This commit is contained in:
Submodule Aaru.CommonTypes updated: c723c09aaa...83d7e34f1b
@@ -226,15 +226,6 @@ public sealed partial class AppleDOS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
|
||||
// TODO: Not really important.
|
||||
return !_mounted ? ErrorNumber.AccessDenied : ErrorNumber.NotImplemented;
|
||||
}
|
||||
|
||||
ErrorNumber CacheFile(string path)
|
||||
{
|
||||
string[] pathElements = path.Split(new[]
|
||||
|
||||
@@ -40,56 +40,6 @@ namespace Aaru.Filesystems;
|
||||
// Information from Inside Macintosh Volume II
|
||||
public sealed partial class AppleMFS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = new long();
|
||||
|
||||
if(!_mounted)
|
||||
return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1)
|
||||
return ErrorNumber.NotSupported;
|
||||
|
||||
path = pathElements[0];
|
||||
|
||||
if(!_filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
|
||||
return ErrorNumber.NoSuchFile;
|
||||
|
||||
if(!_idToEntry.TryGetValue(fileId, out FileEntry entry))
|
||||
return ErrorNumber.NoSuchFile;
|
||||
|
||||
if(fileBlock > entry.flPyLen / _volMdb.drAlBlkSiz)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
|
||||
uint nextBlock = entry.flStBlk;
|
||||
long relBlock = 0;
|
||||
|
||||
while(true)
|
||||
{
|
||||
if(relBlock == fileBlock)
|
||||
{
|
||||
deviceBlock = ((nextBlock - 2) * _sectorsPerBlock) + _volMdb.drAlBlSt + (long)_partitionStart;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(_blockMap[nextBlock] == BMAP_FREE ||
|
||||
_blockMap[nextBlock] == BMAP_LAST)
|
||||
break;
|
||||
|
||||
nextBlock = _blockMap[nextBlock];
|
||||
relBlock++;
|
||||
}
|
||||
|
||||
return ErrorNumber.InOutError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
|
||||
@@ -69,15 +69,6 @@ public sealed partial class CPM
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
// TODO: Implementing this would require storing the interleaving
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
|
||||
return !_mounted ? ErrorNumber.AccessDenied : ErrorNumber.NotImplemented;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber OpenFile(string path, out IFileNode node)
|
||||
{
|
||||
|
||||
@@ -40,33 +40,6 @@ namespace Aaru.Filesystems;
|
||||
|
||||
public sealed partial class FAT
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
|
||||
if(!_mounted)
|
||||
return ErrorNumber.AccessDenied;
|
||||
|
||||
ErrorNumber err = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(err != ErrorNumber.NoError)
|
||||
return err;
|
||||
|
||||
if(stat.Attributes.HasFlag(FileAttributes.Directory) &&
|
||||
!_debug)
|
||||
return ErrorNumber.IsDirectory;
|
||||
|
||||
uint[] clusters = GetClusters((uint)stat.Inode);
|
||||
|
||||
if(fileBlock >= clusters.Length)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
|
||||
deviceBlock = (long)(_firstClusterSector + (clusters[fileBlock] * _sectorsPerCluster));
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
|
||||
@@ -40,33 +40,6 @@ namespace Aaru.Filesystems;
|
||||
|
||||
public sealed partial class XboxFatPlugin
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
|
||||
if(!_mounted)
|
||||
return ErrorNumber.AccessDenied;
|
||||
|
||||
ErrorNumber err = Stat(path, out FileEntryInfo stat);
|
||||
|
||||
if(err != ErrorNumber.NoError)
|
||||
return err;
|
||||
|
||||
if(stat.Attributes.HasFlag(FileAttributes.Directory) &&
|
||||
!_debug)
|
||||
return ErrorNumber.IsDirectory;
|
||||
|
||||
uint[] clusters = GetClusters((uint)stat.Inode);
|
||||
|
||||
if(fileBlock >= clusters.Length)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
|
||||
deviceBlock = (long)(_firstClusterSector + ((clusters[fileBlock] - 1) * _sectorsPerCluster));
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
|
||||
@@ -44,32 +44,6 @@ namespace Aaru.Filesystems;
|
||||
|
||||
public sealed partial class ISO9660
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
|
||||
if(!_mounted)
|
||||
return ErrorNumber.AccessDenied;
|
||||
|
||||
ErrorNumber err = GetFileEntry(path, out DecodedDirectoryEntry entry);
|
||||
|
||||
if(err != ErrorNumber.NoError)
|
||||
return err;
|
||||
|
||||
if(entry.Flags.HasFlag(FileFlags.Directory) &&
|
||||
!_debug)
|
||||
return ErrorNumber.IsDirectory;
|
||||
|
||||
// TODO: Multi-extents
|
||||
if(entry.Extents.Count > 1)
|
||||
return ErrorNumber.NotImplemented;
|
||||
|
||||
deviceBlock = entry.Extents[0].extent + fileBlock;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
|
||||
@@ -36,15 +36,6 @@ namespace Aaru.Filesystems;
|
||||
|
||||
public sealed partial class LisaFS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
|
||||
// TODO: Not really important.
|
||||
return ErrorNumber.NotImplemented;
|
||||
}
|
||||
|
||||
/// <summary>Searches the disk for an extents file (or gets it from cache)</summary>
|
||||
/// <returns>Error.</returns>
|
||||
/// <param name="fileId">File identifier.</param>
|
||||
|
||||
@@ -38,28 +38,6 @@ namespace Aaru.Filesystems;
|
||||
|
||||
public sealed partial class OperaFS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
|
||||
if(!_mounted)
|
||||
return ErrorNumber.AccessDenied;
|
||||
|
||||
ErrorNumber err = GetFileEntry(path, out DirectoryEntryWithPointers entry);
|
||||
|
||||
if(err != ErrorNumber.NoError)
|
||||
return err;
|
||||
|
||||
if((entry.Entry.flags & FLAGS_MASK) == (uint)FileFlags.Directory &&
|
||||
!_debug)
|
||||
return ErrorNumber.IsDirectory;
|
||||
|
||||
deviceBlock = entry.Pointers[0] + fileBlock;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
|
||||
@@ -38,14 +38,6 @@ namespace Aaru.Filesystems;
|
||||
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
|
||||
public sealed partial class PascalPlugin
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
|
||||
return !_mounted ? ErrorNumber.AccessDenied : ErrorNumber.NotImplemented;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user