mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🎨Changed IReadOnlyFilesystem so methods that only output don't get passed as ref.
This commit is contained in:
@@ -45,8 +45,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
/// </summary>
|
||||
/// <param name="path">Link path.</param>
|
||||
/// <param name="dest">Link destination.</param>
|
||||
public Errno ReadLink(string path, ref string dest)
|
||||
public Errno ReadLink(string path, out string dest)
|
||||
{
|
||||
dest = null;
|
||||
return !mounted ? Errno.AccessDenied : Errno.NotSupported;
|
||||
}
|
||||
|
||||
@@ -55,8 +56,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
/// </summary>
|
||||
/// <param name="path">Directory path.</param>
|
||||
/// <param name="contents">Directory contents.</param>
|
||||
public Errno ReadDir(string path, ref List<string> contents)
|
||||
public Errno ReadDir(string path, out List<string> contents)
|
||||
{
|
||||
contents = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
|
||||
@@ -40,8 +40,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
{
|
||||
public partial class AppleDOS
|
||||
{
|
||||
public Errno GetAttributes(string path, ref FileAttributes attributes)
|
||||
public Errno GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
@@ -51,7 +52,6 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
|
||||
if(!fileCache.ContainsKey(filename)) return Errno.NoSuchFile;
|
||||
|
||||
attributes = new FileAttributes();
|
||||
attributes = FileAttributes.Extents;
|
||||
attributes |= FileAttributes.File;
|
||||
if(lockedFiles.Contains(filename)) attributes |= FileAttributes.ReadOnly;
|
||||
@@ -103,8 +103,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public Errno Stat(string path, ref FileEntryInfo stat)
|
||||
public Errno Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
stat = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
@@ -115,12 +116,10 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
|
||||
if(!fileCache.ContainsKey(filename)) return Errno.NoSuchFile;
|
||||
|
||||
FileAttributes attrs = new FileAttributes();
|
||||
stat = new FileEntryInfo();
|
||||
|
||||
fileSizeCache.TryGetValue(filename, out int filesize);
|
||||
GetAttributes(path, ref attrs);
|
||||
|
||||
stat = new FileEntryInfo();
|
||||
GetAttributes(path, out FileAttributes attrs);
|
||||
|
||||
if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
@@ -148,8 +147,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||
public Errno MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
// TODO: Not really important.
|
||||
return !mounted ? Errno.AccessDenied : Errno.NotImplemented;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
/// Gets information about the mounted volume.
|
||||
/// </summary>
|
||||
/// <param name="stat">Information about the mounted volume.</param>
|
||||
public Errno StatFs(ref FileSystemInfo stat)
|
||||
public Errno StatFs(out FileSystemInfo stat)
|
||||
{
|
||||
stat = new FileSystemInfo
|
||||
{
|
||||
|
||||
@@ -43,8 +43,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">Path.</param>
|
||||
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param>
|
||||
public Errno ListXAttr(string path, ref List<string> xattrs)
|
||||
public Errno ListXAttr(string path, out List<string> xattrs)
|
||||
{
|
||||
xattrs = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
@@ -40,8 +40,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
// Information from Inside Macintosh Volume II
|
||||
public partial class AppleMFS
|
||||
{
|
||||
public Errno ReadDir(string path, ref List<string> contents)
|
||||
public Errno ReadDir(string path, out List<string> contents)
|
||||
{
|
||||
contents = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
// Information from Inside Macintosh Volume II
|
||||
public partial class AppleMFS
|
||||
{
|
||||
public Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||
public Errno MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = new long();
|
||||
|
||||
@@ -75,8 +75,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
return Errno.InOutError;
|
||||
}
|
||||
|
||||
public Errno GetAttributes(string path, ref FileAttributes attributes)
|
||||
public Errno GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
@@ -86,7 +87,6 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
|
||||
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
|
||||
|
||||
attributes = new FileAttributes();
|
||||
MFS_FinderFlags fdFlags = (MFS_FinderFlags)BigEndianBitConverter.ToUInt16(entry.flUsrWds, 0x08);
|
||||
|
||||
if(fdFlags.HasFlag(MFS_FinderFlags.kIsAlias)) attributes |= FileAttributes.Alias;
|
||||
@@ -142,8 +142,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public Errno Stat(string path, ref FileEntryInfo stat)
|
||||
public Errno Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
stat = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
@@ -196,8 +197,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
|
||||
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
|
||||
|
||||
FileAttributes attr = new FileAttributes();
|
||||
Errno error = GetAttributes(path, ref attr);
|
||||
Errno error = GetAttributes(path, out FileAttributes attr);
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
stat = new FileEntryInfo
|
||||
@@ -219,8 +219,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public Errno ReadLink(string path, ref string dest)
|
||||
public Errno ReadLink(string path, out string dest)
|
||||
{
|
||||
dest = null;
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public Errno StatFs(ref FileSystemInfo stat)
|
||||
public Errno StatFs(out FileSystemInfo stat)
|
||||
{
|
||||
stat = new FileSystemInfo
|
||||
{
|
||||
|
||||
@@ -40,8 +40,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
// Information from Inside Macintosh Volume II
|
||||
public partial class AppleMFS
|
||||
{
|
||||
public Errno ListXAttr(string path, ref List<string> xattrs)
|
||||
public Errno ListXAttr(string path, out List<string> xattrs)
|
||||
{
|
||||
xattrs = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
@@ -39,14 +39,15 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
{
|
||||
partial class CPM
|
||||
{
|
||||
public Errno ReadDir(string path, ref List<string> contents)
|
||||
public Errno ReadDir(string path, out List<string> contents)
|
||||
{
|
||||
contents = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
return Errno.NotSupported;
|
||||
|
||||
contents = dirList;
|
||||
contents = new List<string>(dirList);
|
||||
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
@@ -36,8 +36,9 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
{
|
||||
partial class CPM
|
||||
{
|
||||
public Errno GetAttributes(string path, ref FileAttributes attributes)
|
||||
public Errno GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
@@ -59,8 +60,9 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
}
|
||||
|
||||
// TODO: Implementing this would require storing the interleaving
|
||||
public Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||
public Errno MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
return !mounted ? Errno.AccessDenied : Errno.NotImplemented;
|
||||
}
|
||||
|
||||
@@ -90,30 +92,29 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public Errno ReadLink(string path, ref string dest)
|
||||
public Errno ReadLink(string path, out string dest)
|
||||
{
|
||||
dest = null;
|
||||
return !mounted ? Errno.AccessDenied : Errno.NotSupported;
|
||||
}
|
||||
|
||||
public Errno Stat(string path, ref FileEntryInfo stat)
|
||||
public Errno Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
stat = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if(pathElements.Length != 1) return Errno.NotSupported;
|
||||
|
||||
if(string.IsNullOrEmpty(path) || string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
if(labelCreationDate != null) stat.CreationTime = DateHandlers.CpmToDateTime(labelCreationDate);
|
||||
if(labelUpdateDate != null) stat.StatusChangeTime = DateHandlers.CpmToDateTime(labelUpdateDate);
|
||||
stat.Attributes = FileAttributes.Directory;
|
||||
stat.BlockSize = XmlFsType.ClusterSize;
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
return statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out stat)
|
||||
? Errno.NoError
|
||||
: Errno.NoSuchFile;
|
||||
|
||||
stat = new FileEntryInfo {Attributes = FileAttributes.Directory, BlockSize = XmlFsType.ClusterSize};
|
||||
if(labelCreationDate != null) stat.CreationTime = DateHandlers.CpmToDateTime(labelCreationDate);
|
||||
if(labelUpdateDate != null) stat.StatusChangeTime = DateHandlers.CpmToDateTime(labelUpdateDate);
|
||||
return Errno.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -686,8 +686,9 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
/// Gets information about the mounted volume.
|
||||
/// </summary>
|
||||
/// <param name="stat">Information about the mounted volume.</param>
|
||||
public Errno StatFs(ref FileSystemInfo stat)
|
||||
public Errno StatFs(out FileSystemInfo stat)
|
||||
{
|
||||
stat = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
stat = cpmStat;
|
||||
|
||||
@@ -70,8 +70,9 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">Path.</param>
|
||||
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param>
|
||||
public Errno ListXAttr(string path, ref List<string> xattrs)
|
||||
public Errno ListXAttr(string path, out List<string> xattrs)
|
||||
{
|
||||
xattrs = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace DiscImageChef.Filesystems
|
||||
/// <param name="path">File path.</param>
|
||||
/// <param name="fileBlock">File block.</param>
|
||||
/// <param name="deviceBlock">Device block.</param>
|
||||
Errno MapBlock(string path, long fileBlock, ref long deviceBlock);
|
||||
Errno MapBlock(string path, long fileBlock, out long deviceBlock);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the attributes of a file or directory
|
||||
@@ -77,7 +77,7 @@ namespace DiscImageChef.Filesystems
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">File path.</param>
|
||||
/// <param name="attributes">File attributes.</param>
|
||||
Errno GetAttributes(string path, ref FileAttributes attributes);
|
||||
Errno GetAttributes(string path, out FileAttributes attributes);
|
||||
|
||||
/// <summary>
|
||||
/// Lists all extended attributes, alternate data streams and forks of the given file.
|
||||
@@ -85,7 +85,7 @@ namespace DiscImageChef.Filesystems
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">Path.</param>
|
||||
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param>
|
||||
Errno ListXAttr(string path, ref List<string> xattrs);
|
||||
Errno ListXAttr(string path, out List<string> xattrs);
|
||||
|
||||
/// <summary>
|
||||
/// Reads an extended attribute, alternate data stream or fork from the given file.
|
||||
@@ -110,26 +110,26 @@ namespace DiscImageChef.Filesystems
|
||||
/// </summary>
|
||||
/// <param name="path">Directory path.</param>
|
||||
/// <param name="contents">Directory contents.</param>
|
||||
Errno ReadDir(string path, ref List<string> contents);
|
||||
Errno ReadDir(string path, out List<string> contents);
|
||||
|
||||
/// <summary>
|
||||
/// Gets information about the mounted volume.
|
||||
/// </summary>
|
||||
/// <param name="stat">Information about the mounted volume.</param>
|
||||
Errno StatFs(ref FileSystemInfo stat);
|
||||
Errno StatFs(out FileSystemInfo stat);
|
||||
|
||||
/// <summary>
|
||||
/// Gets information about a file or directory.
|
||||
/// </summary>
|
||||
/// <param name="path">File path.</param>
|
||||
/// <param name="stat">File information.</param>
|
||||
Errno Stat(string path, ref FileEntryInfo stat);
|
||||
Errno Stat(string path, out FileEntryInfo stat);
|
||||
|
||||
/// <summary>
|
||||
/// Solves a symbolic link.
|
||||
/// </summary>
|
||||
/// <param name="path">Link path.</param>
|
||||
/// <param name="dest">Link destination.</param>
|
||||
Errno ReadLink(string path, ref string dest);
|
||||
Errno ReadLink(string path, out string dest);
|
||||
}
|
||||
}
|
||||
@@ -45,8 +45,9 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// </summary>
|
||||
/// <param name="path">Link path.</param>
|
||||
/// <param name="dest">Link destination.</param>
|
||||
public Errno ReadLink(string path, ref string dest)
|
||||
public Errno ReadLink(string path, out string dest)
|
||||
{
|
||||
dest = null;
|
||||
// LisaFS does not support symbolic links (afaik)
|
||||
return Errno.NotSupported;
|
||||
}
|
||||
@@ -56,8 +57,9 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// </summary>
|
||||
/// <param name="path">Directory path.</param>
|
||||
/// <param name="contents">Directory contents.</param>
|
||||
public Errno ReadDir(string path, ref List<string> contents)
|
||||
public Errno ReadDir(string path, out List<string> contents)
|
||||
{
|
||||
contents = null;
|
||||
Errno error = LookupFileId(path, out short fileId, out bool isDir);
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
@@ -68,7 +70,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
if(error != Errno.NoError)
|
||||
return error;*/
|
||||
|
||||
ReadDir(fileId, ref contents);
|
||||
ReadDir(fileId, out contents);
|
||||
|
||||
// On debug add system files as readable files
|
||||
// Syntax similar to NTFS
|
||||
@@ -86,7 +88,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
Errno ReadDir(short dirId, ref List<string> contents)
|
||||
Errno ReadDir(short dirId, out List<string> contents)
|
||||
{
|
||||
// Do same trick as Mac OS X, replace filesystem '/' with '-',
|
||||
// as '-' is the path separator in Lisa OS
|
||||
|
||||
@@ -39,8 +39,9 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
public partial class LisaFS
|
||||
{
|
||||
public Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||
public Errno MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
// TODO: Not really important.
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
@@ -39,14 +39,15 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
public partial class LisaFS
|
||||
{
|
||||
public Errno GetAttributes(string path, ref FileAttributes attributes)
|
||||
public Errno GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
|
||||
Errno error = LookupFileId(path, out short fileId, out bool isDir);
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
if(!isDir) return GetAttributes(fileId, ref attributes);
|
||||
if(!isDir) return GetAttributes(fileId, out attributes);
|
||||
|
||||
attributes = new FileAttributes();
|
||||
attributes = FileAttributes.Directory;
|
||||
|
||||
return Errno.NoError;
|
||||
@@ -94,16 +95,18 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public Errno Stat(string path, ref FileEntryInfo stat)
|
||||
public Errno Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
stat = null;
|
||||
Errno error = LookupFileId(path, out short fileId, out bool isDir);
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
return isDir ? StatDir(fileId, out stat) : Stat(fileId, out stat);
|
||||
}
|
||||
|
||||
Errno GetAttributes(short fileId, ref FileAttributes attributes)
|
||||
Errno GetAttributes(short fileId, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
if(fileId < 4)
|
||||
@@ -123,8 +126,6 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
attributes = new FileAttributes();
|
||||
|
||||
switch(extFile.ftype)
|
||||
{
|
||||
case FileType.Spool:
|
||||
@@ -231,7 +232,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
stat = new FileEntryInfo {Attributes = new FileAttributes()};
|
||||
|
||||
error = GetAttributes(fileId, ref stat.Attributes);
|
||||
error = GetAttributes(fileId, out stat.Attributes);
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
if(fileId < 0 && fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED)
|
||||
@@ -278,7 +279,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
}
|
||||
|
||||
stat = new FileEntryInfo {Attributes = new FileAttributes()};
|
||||
error = GetAttributes(fileId, ref stat.Attributes);
|
||||
error = GetAttributes(fileId, out stat.Attributes);
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
error = ReadExtentsFile(fileId, out file);
|
||||
|
||||
@@ -340,8 +340,9 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// Gets information about the mounted volume.
|
||||
/// </summary>
|
||||
/// <param name="stat">Information about the mounted volume.</param>
|
||||
public Errno StatFs(ref FileSystemInfo stat)
|
||||
public Errno StatFs(out FileSystemInfo stat)
|
||||
{
|
||||
stat = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
stat = new FileSystemInfo
|
||||
|
||||
@@ -46,12 +46,13 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">Path.</param>
|
||||
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param>
|
||||
public Errno ListXAttr(string path, ref List<string> xattrs)
|
||||
public Errno ListXAttr(string path, out List<string> xattrs)
|
||||
{
|
||||
xattrs = null;
|
||||
Errno error = LookupFileId(path, out short fileId, out bool isDir);
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
return isDir ? Errno.InvalidArgument : ListXAttr(fileId, ref xattrs);
|
||||
return isDir ? Errno.InvalidArgument : ListXAttr(fileId, out xattrs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -75,7 +76,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="fileId">File identifier.</param>
|
||||
/// <param name="xattrs">Extended attributes.</param>
|
||||
Errno ListXAttr(short fileId, ref List<string> xattrs)
|
||||
Errno ListXAttr(short fileId, out List<string> xattrs)
|
||||
{
|
||||
xattrs = null;
|
||||
|
||||
|
||||
@@ -39,8 +39,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
|
||||
public partial class PascalPlugin
|
||||
{
|
||||
public Errno ReadDir(string path, ref List<string> contents)
|
||||
public Errno ReadDir(string path, out List<string> contents)
|
||||
{
|
||||
contents = null;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
|
||||
@@ -38,13 +38,15 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
|
||||
public partial class PascalPlugin
|
||||
{
|
||||
public Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||
public Errno MapBlock(string path, long fileBlock, out long deviceBlock)
|
||||
{
|
||||
deviceBlock = 0;
|
||||
return !mounted ? Errno.AccessDenied : Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public Errno GetAttributes(string path, ref FileAttributes attributes)
|
||||
public Errno GetAttributes(string path, out FileAttributes attributes)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
@@ -54,7 +56,6 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
attributes = new FileAttributes();
|
||||
attributes = FileAttributes.File;
|
||||
|
||||
return error;
|
||||
@@ -94,11 +95,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public Errno Stat(string path, ref FileEntryInfo stat)
|
||||
public Errno Stat(string path, out FileEntryInfo stat)
|
||||
{
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
stat = null;
|
||||
|
||||
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if(pathElements.Length != 1) return Errno.NotSupported;
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public Errno StatFs(ref FileSystemInfo stat)
|
||||
public Errno StatFs(out FileSystemInfo stat)
|
||||
{
|
||||
stat = new FileSystemInfo
|
||||
{
|
||||
|
||||
@@ -56,8 +56,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
public Guid Id => new Guid("B0AC2CB5-72AA-473A-9200-270B5A2C2D53");
|
||||
public Encoding Encoding { get; private set; }
|
||||
|
||||
public Errno ListXAttr(string path, ref List<string> xattrs)
|
||||
public Errno ListXAttr(string path, out List<string> xattrs)
|
||||
{
|
||||
xattrs = null;
|
||||
return Errno.NotSupported;
|
||||
}
|
||||
|
||||
@@ -66,8 +67,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
return Errno.NotSupported;
|
||||
}
|
||||
|
||||
public Errno ReadLink(string path, ref string dest)
|
||||
public Errno ReadLink(string path, out string dest)
|
||||
{
|
||||
dest = null;
|
||||
return Errno.NotSupported;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace DiscImageChef.Commands
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", ref rootDir);
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ namespace DiscImageChef.Commands
|
||||
? "NO NAME"
|
||||
: fs.XmlFsType.VolumeName;
|
||||
|
||||
error = fs.Stat(entry, ref stat);
|
||||
error = fs.Stat(entry, out stat);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
string outputPath;
|
||||
@@ -185,7 +185,7 @@ namespace DiscImageChef.Commands
|
||||
{
|
||||
List<string> xattrs = new List<string>();
|
||||
|
||||
error = fs.ListXAttr(entry, ref xattrs);
|
||||
error = fs.ListXAttr(entry, out xattrs);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string xattr in xattrs)
|
||||
{
|
||||
@@ -315,7 +315,7 @@ namespace DiscImageChef.Commands
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", ref rootDir);
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
{
|
||||
@@ -326,7 +326,7 @@ namespace DiscImageChef.Commands
|
||||
? "NO NAME"
|
||||
: fs.XmlFsType.VolumeName;
|
||||
|
||||
error = fs.Stat(entry, ref stat);
|
||||
error = fs.Stat(entry, out stat);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
FileStream outputFile;
|
||||
@@ -335,7 +335,7 @@ namespace DiscImageChef.Commands
|
||||
{
|
||||
List<string> xattrs = new List<string>();
|
||||
|
||||
error = fs.ListXAttr(entry, ref xattrs);
|
||||
error = fs.ListXAttr(entry, out xattrs);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string xattr in xattrs)
|
||||
{
|
||||
@@ -471,7 +471,7 @@ namespace DiscImageChef.Commands
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", ref rootDir);
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
{
|
||||
@@ -482,7 +482,7 @@ namespace DiscImageChef.Commands
|
||||
? "NO NAME"
|
||||
: fs.XmlFsType.VolumeName;
|
||||
|
||||
error = fs.Stat(entry, ref stat);
|
||||
error = fs.Stat(entry, out stat);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
FileStream outputFile;
|
||||
@@ -491,7 +491,7 @@ namespace DiscImageChef.Commands
|
||||
{
|
||||
List<string> xattrs = new List<string>();
|
||||
|
||||
error = fs.ListXAttr(entry, ref xattrs);
|
||||
error = fs.ListXAttr(entry, out xattrs);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string xattr in xattrs)
|
||||
{
|
||||
@@ -612,7 +612,7 @@ namespace DiscImageChef.Commands
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", ref rootDir);
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
{
|
||||
@@ -622,7 +622,7 @@ namespace DiscImageChef.Commands
|
||||
? "NO NAME"
|
||||
: fs.XmlFsType.VolumeName;
|
||||
|
||||
error = fs.Stat(entry, ref stat);
|
||||
error = fs.Stat(entry, out stat);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
string outputPath;
|
||||
@@ -631,7 +631,7 @@ namespace DiscImageChef.Commands
|
||||
{
|
||||
List<string> xattrs = new List<string>();
|
||||
|
||||
error = fs.ListXAttr(entry, ref xattrs);
|
||||
error = fs.ListXAttr(entry, out xattrs);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string xattr in xattrs)
|
||||
{
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace DiscImageChef.Commands
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", ref rootDir);
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
|
||||
else
|
||||
@@ -182,7 +182,7 @@ namespace DiscImageChef.Commands
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", ref rootDir);
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
|
||||
else
|
||||
@@ -220,7 +220,7 @@ namespace DiscImageChef.Commands
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", ref rootDir);
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
|
||||
else
|
||||
@@ -245,7 +245,7 @@ namespace DiscImageChef.Commands
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
List<string> rootDir = new List<string>();
|
||||
error = fs.ReadDir("/", ref rootDir);
|
||||
error = fs.ReadDir("/", out rootDir);
|
||||
if(error == Errno.NoError)
|
||||
foreach(string entry in rootDir)
|
||||
if(options.Long)
|
||||
@@ -253,13 +253,13 @@ namespace DiscImageChef.Commands
|
||||
FileEntryInfo stat = new FileEntryInfo();
|
||||
List<string> xattrs = new List<string>();
|
||||
|
||||
error = fs.Stat(entry, ref stat);
|
||||
error = fs.Stat(entry, out stat);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
DicConsole.WriteLine("{0}\t{1}\t{2} bytes\t{3}", stat.CreationTimeUtc,
|
||||
stat.Inode, stat.Length, entry);
|
||||
|
||||
error = fs.ListXAttr(entry, ref xattrs);
|
||||
error = fs.ListXAttr(entry, out xattrs);
|
||||
if(error != Errno.NoError) continue;
|
||||
|
||||
foreach(string xattr in xattrs)
|
||||
|
||||
Reference in New Issue
Block a user