🎨Changed IReadOnlyFilesystem so methods that only output don't get passed as ref.

This commit is contained in:
2017-12-26 08:17:28 +00:00
parent 18f9a349c9
commit 56198b1ee6
24 changed files with 113 additions and 95 deletions

View File

@@ -45,8 +45,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
/// </summary> /// </summary>
/// <param name="path">Link path.</param> /// <param name="path">Link path.</param>
/// <param name="dest">Link destination.</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; return !mounted ? Errno.AccessDenied : Errno.NotSupported;
} }
@@ -55,8 +56,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
/// </summary> /// </summary>
/// <param name="path">Directory path.</param> /// <param name="path">Directory path.</param>
/// <param name="contents">Directory contents.</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(!mounted) return Errno.AccessDenied;
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)

View File

@@ -40,8 +40,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
{ {
public partial class 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; if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
@@ -51,7 +52,6 @@ namespace DiscImageChef.Filesystems.AppleDOS
if(!fileCache.ContainsKey(filename)) return Errno.NoSuchFile; if(!fileCache.ContainsKey(filename)) return Errno.NoSuchFile;
attributes = new FileAttributes();
attributes = FileAttributes.Extents; attributes = FileAttributes.Extents;
attributes |= FileAttributes.File; attributes |= FileAttributes.File;
if(lockedFiles.Contains(filename)) attributes |= FileAttributes.ReadOnly; if(lockedFiles.Contains(filename)) attributes |= FileAttributes.ReadOnly;
@@ -103,8 +103,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
return Errno.NoError; 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; if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
@@ -115,12 +116,10 @@ namespace DiscImageChef.Filesystems.AppleDOS
if(!fileCache.ContainsKey(filename)) return Errno.NoSuchFile; if(!fileCache.ContainsKey(filename)) return Errno.NoSuchFile;
FileAttributes attrs = new FileAttributes(); stat = new FileEntryInfo();
fileSizeCache.TryGetValue(filename, out int filesize); fileSizeCache.TryGetValue(filename, out int filesize);
GetAttributes(path, ref attrs); GetAttributes(path, out FileAttributes attrs);
stat = new FileEntryInfo();
if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
@@ -148,8 +147,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
return Errno.NoError; 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. // TODO: Not really important.
return !mounted ? Errno.AccessDenied : Errno.NotImplemented; return !mounted ? Errno.AccessDenied : Errno.NotImplemented;
} }

View File

@@ -135,7 +135,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
/// Gets information about the mounted volume. /// Gets information about the mounted volume.
/// </summary> /// </summary>
/// <param name="stat">Information about the mounted volume.</param> /// <param name="stat">Information about the mounted volume.</param>
public Errno StatFs(ref FileSystemInfo stat) public Errno StatFs(out FileSystemInfo stat)
{ {
stat = new FileSystemInfo stat = new FileSystemInfo
{ {

View File

@@ -43,8 +43,9 @@ namespace DiscImageChef.Filesystems.AppleDOS
/// <returns>Error number.</returns> /// <returns>Error number.</returns>
/// <param name="path">Path.</param> /// <param name="path">Path.</param>
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</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; if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);

View File

@@ -40,8 +40,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
// Information from Inside Macintosh Volume II // Information from Inside Macintosh Volume II
public partial class AppleMFS 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(!mounted) return Errno.AccessDenied;
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)

View File

@@ -40,7 +40,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
// Information from Inside Macintosh Volume II // Information from Inside Macintosh Volume II
public partial class AppleMFS 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(); deviceBlock = new long();
@@ -75,8 +75,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
return Errno.InOutError; 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; if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); 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; if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
attributes = new FileAttributes();
MFS_FinderFlags fdFlags = (MFS_FinderFlags)BigEndianBitConverter.ToUInt16(entry.flUsrWds, 0x08); MFS_FinderFlags fdFlags = (MFS_FinderFlags)BigEndianBitConverter.ToUInt16(entry.flUsrWds, 0x08);
if(fdFlags.HasFlag(MFS_FinderFlags.kIsAlias)) attributes |= FileAttributes.Alias; if(fdFlags.HasFlag(MFS_FinderFlags.kIsAlias)) attributes |= FileAttributes.Alias;
@@ -142,8 +142,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
return Errno.NoError; 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; if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); 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; if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
FileAttributes attr = new FileAttributes(); Errno error = GetAttributes(path, out FileAttributes attr);
Errno error = GetAttributes(path, ref attr);
if(error != Errno.NoError) return error; if(error != Errno.NoError) return error;
stat = new FileEntryInfo stat = new FileEntryInfo
@@ -219,8 +219,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
return Errno.NoError; return Errno.NoError;
} }
public Errno ReadLink(string path, ref string dest) public Errno ReadLink(string path, out string dest)
{ {
dest = null;
return Errno.NotImplemented; return Errno.NotImplemented;
} }

View File

@@ -165,7 +165,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
return Errno.NoError; return Errno.NoError;
} }
public Errno StatFs(ref FileSystemInfo stat) public Errno StatFs(out FileSystemInfo stat)
{ {
stat = new FileSystemInfo stat = new FileSystemInfo
{ {

View File

@@ -40,8 +40,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
// Information from Inside Macintosh Volume II // Information from Inside Macintosh Volume II
public partial class AppleMFS 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; if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);

View File

@@ -39,14 +39,15 @@ namespace DiscImageChef.Filesystems.CPM
{ {
partial class 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(!mounted) return Errno.AccessDenied;
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
return Errno.NotSupported; return Errno.NotSupported;
contents = dirList; contents = new List<string>(dirList);
return Errno.NoError; return Errno.NoError;
} }

View File

@@ -36,8 +36,9 @@ namespace DiscImageChef.Filesystems.CPM
{ {
partial class 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; if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
@@ -59,8 +60,9 @@ namespace DiscImageChef.Filesystems.CPM
} }
// TODO: Implementing this would require storing the interleaving // 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; return !mounted ? Errno.AccessDenied : Errno.NotImplemented;
} }
@@ -90,30 +92,29 @@ namespace DiscImageChef.Filesystems.CPM
return Errno.NoError; 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; 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; if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported; if(pathElements.Length != 1) return Errno.NotSupported;
if(string.IsNullOrEmpty(path) || string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) == 0) if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
{ return statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out stat)
if(labelCreationDate != null) stat.CreationTime = DateHandlers.CpmToDateTime(labelCreationDate); ? Errno.NoError
if(labelUpdateDate != null) stat.StatusChangeTime = DateHandlers.CpmToDateTime(labelUpdateDate); : Errno.NoSuchFile;
stat.Attributes = FileAttributes.Directory;
stat.BlockSize = XmlFsType.ClusterSize;
return Errno.NoError;
}
return statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out stat) stat = new FileEntryInfo {Attributes = FileAttributes.Directory, BlockSize = XmlFsType.ClusterSize};
? Errno.NoError if(labelCreationDate != null) stat.CreationTime = DateHandlers.CpmToDateTime(labelCreationDate);
: Errno.NoSuchFile; if(labelUpdateDate != null) stat.StatusChangeTime = DateHandlers.CpmToDateTime(labelUpdateDate);
return Errno.NoError;
} }
} }
} }

View File

@@ -686,8 +686,9 @@ namespace DiscImageChef.Filesystems.CPM
/// Gets information about the mounted volume. /// Gets information about the mounted volume.
/// </summary> /// </summary>
/// <param name="stat">Information about the mounted volume.</param> /// <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; if(!mounted) return Errno.AccessDenied;
stat = cpmStat; stat = cpmStat;

View File

@@ -70,8 +70,9 @@ namespace DiscImageChef.Filesystems.CPM
/// <returns>Error number.</returns> /// <returns>Error number.</returns>
/// <param name="path">Path.</param> /// <param name="path">Path.</param>
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</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; if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);

View File

@@ -69,7 +69,7 @@ namespace DiscImageChef.Filesystems
/// <param name="path">File path.</param> /// <param name="path">File path.</param>
/// <param name="fileBlock">File block.</param> /// <param name="fileBlock">File block.</param>
/// <param name="deviceBlock">Device 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> /// <summary>
/// Gets the attributes of a file or directory /// Gets the attributes of a file or directory
@@ -77,7 +77,7 @@ namespace DiscImageChef.Filesystems
/// <returns>Error number.</returns> /// <returns>Error number.</returns>
/// <param name="path">File path.</param> /// <param name="path">File path.</param>
/// <param name="attributes">File attributes.</param> /// <param name="attributes">File attributes.</param>
Errno GetAttributes(string path, ref FileAttributes attributes); Errno GetAttributes(string path, out FileAttributes attributes);
/// <summary> /// <summary>
/// Lists all extended attributes, alternate data streams and forks of the given file. /// Lists all extended attributes, alternate data streams and forks of the given file.
@@ -85,7 +85,7 @@ namespace DiscImageChef.Filesystems
/// <returns>Error number.</returns> /// <returns>Error number.</returns>
/// <param name="path">Path.</param> /// <param name="path">Path.</param>
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</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> /// <summary>
/// Reads an extended attribute, alternate data stream or fork from the given file. /// Reads an extended attribute, alternate data stream or fork from the given file.
@@ -110,26 +110,26 @@ namespace DiscImageChef.Filesystems
/// </summary> /// </summary>
/// <param name="path">Directory path.</param> /// <param name="path">Directory path.</param>
/// <param name="contents">Directory contents.</param> /// <param name="contents">Directory contents.</param>
Errno ReadDir(string path, ref List<string> contents); Errno ReadDir(string path, out List<string> contents);
/// <summary> /// <summary>
/// Gets information about the mounted volume. /// Gets information about the mounted volume.
/// </summary> /// </summary>
/// <param name="stat">Information about the mounted volume.</param> /// <param name="stat">Information about the mounted volume.</param>
Errno StatFs(ref FileSystemInfo stat); Errno StatFs(out FileSystemInfo stat);
/// <summary> /// <summary>
/// Gets information about a file or directory. /// Gets information about a file or directory.
/// </summary> /// </summary>
/// <param name="path">File path.</param> /// <param name="path">File path.</param>
/// <param name="stat">File information.</param> /// <param name="stat">File information.</param>
Errno Stat(string path, ref FileEntryInfo stat); Errno Stat(string path, out FileEntryInfo stat);
/// <summary> /// <summary>
/// Solves a symbolic link. /// Solves a symbolic link.
/// </summary> /// </summary>
/// <param name="path">Link path.</param> /// <param name="path">Link path.</param>
/// <param name="dest">Link destination.</param> /// <param name="dest">Link destination.</param>
Errno ReadLink(string path, ref string dest); Errno ReadLink(string path, out string dest);
} }
} }

View File

@@ -45,8 +45,9 @@ namespace DiscImageChef.Filesystems.LisaFS
/// </summary> /// </summary>
/// <param name="path">Link path.</param> /// <param name="path">Link path.</param>
/// <param name="dest">Link destination.</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) // LisaFS does not support symbolic links (afaik)
return Errno.NotSupported; return Errno.NotSupported;
} }
@@ -56,8 +57,9 @@ namespace DiscImageChef.Filesystems.LisaFS
/// </summary> /// </summary>
/// <param name="path">Directory path.</param> /// <param name="path">Directory path.</param>
/// <param name="contents">Directory contents.</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); Errno error = LookupFileId(path, out short fileId, out bool isDir);
if(error != Errno.NoError) return error; if(error != Errno.NoError) return error;
@@ -68,7 +70,7 @@ namespace DiscImageChef.Filesystems.LisaFS
if(error != Errno.NoError) if(error != Errno.NoError)
return error;*/ return error;*/
ReadDir(fileId, ref contents); ReadDir(fileId, out contents);
// On debug add system files as readable files // On debug add system files as readable files
// Syntax similar to NTFS // Syntax similar to NTFS
@@ -86,7 +88,7 @@ namespace DiscImageChef.Filesystems.LisaFS
return Errno.NoError; 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 '-', // Do same trick as Mac OS X, replace filesystem '/' with '-',
// as '-' is the path separator in Lisa OS // as '-' is the path separator in Lisa OS

View File

@@ -39,8 +39,9 @@ namespace DiscImageChef.Filesystems.LisaFS
{ {
public partial class 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. // TODO: Not really important.
return Errno.NotImplemented; return Errno.NotImplemented;
} }

View File

@@ -39,14 +39,15 @@ namespace DiscImageChef.Filesystems.LisaFS
{ {
public partial class 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); Errno error = LookupFileId(path, out short fileId, out bool isDir);
if(error != Errno.NoError) return error; 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; attributes = FileAttributes.Directory;
return Errno.NoError; return Errno.NoError;
@@ -94,16 +95,18 @@ namespace DiscImageChef.Filesystems.LisaFS
return Errno.NoError; 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); Errno error = LookupFileId(path, out short fileId, out bool isDir);
if(error != Errno.NoError) return error; if(error != Errno.NoError) return error;
return isDir ? StatDir(fileId, out stat) : Stat(fileId, out stat); 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(!mounted) return Errno.AccessDenied;
if(fileId < 4) if(fileId < 4)
@@ -123,8 +126,6 @@ namespace DiscImageChef.Filesystems.LisaFS
if(error != Errno.NoError) return error; if(error != Errno.NoError) return error;
attributes = new FileAttributes();
switch(extFile.ftype) switch(extFile.ftype)
{ {
case FileType.Spool: case FileType.Spool:
@@ -231,7 +232,7 @@ namespace DiscImageChef.Filesystems.LisaFS
{ {
stat = new FileEntryInfo {Attributes = new FileAttributes()}; 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(error != Errno.NoError) return error;
if(fileId < 0 && fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) 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()}; 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(error != Errno.NoError) return error;
error = ReadExtentsFile(fileId, out file); error = ReadExtentsFile(fileId, out file);

View File

@@ -340,8 +340,9 @@ namespace DiscImageChef.Filesystems.LisaFS
/// Gets information about the mounted volume. /// Gets information about the mounted volume.
/// </summary> /// </summary>
/// <param name="stat">Information about the mounted volume.</param> /// <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; if(!mounted) return Errno.AccessDenied;
stat = new FileSystemInfo stat = new FileSystemInfo

View File

@@ -46,12 +46,13 @@ namespace DiscImageChef.Filesystems.LisaFS
/// <returns>Error number.</returns> /// <returns>Error number.</returns>
/// <param name="path">Path.</param> /// <param name="path">Path.</param>
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</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); Errno error = LookupFileId(path, out short fileId, out bool isDir);
if(error != Errno.NoError) return error; if(error != Errno.NoError) return error;
return isDir ? Errno.InvalidArgument : ListXAttr(fileId, ref xattrs); return isDir ? Errno.InvalidArgument : ListXAttr(fileId, out xattrs);
} }
/// <summary> /// <summary>
@@ -75,7 +76,7 @@ namespace DiscImageChef.Filesystems.LisaFS
/// <returns>Error number.</returns> /// <returns>Error number.</returns>
/// <param name="fileId">File identifier.</param> /// <param name="fileId">File identifier.</param>
/// <param name="xattrs">Extended attributes.</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; xattrs = null;

View File

@@ -39,8 +39,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure // Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
public partial class PascalPlugin 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(!mounted) return Errno.AccessDenied;
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0) if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)

View File

@@ -38,13 +38,15 @@ namespace DiscImageChef.Filesystems.UCSDPascal
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure // Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
public partial class PascalPlugin 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; 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; if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
@@ -54,7 +56,6 @@ namespace DiscImageChef.Filesystems.UCSDPascal
if(error != Errno.NoError) return error; if(error != Errno.NoError) return error;
attributes = new FileAttributes();
attributes = FileAttributes.File; attributes = FileAttributes.File;
return error; return error;
@@ -94,11 +95,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal
return Errno.NoError; return Errno.NoError;
} }
public Errno Stat(string path, ref FileEntryInfo stat) public Errno Stat(string path, out FileEntryInfo stat)
{ {
if(!mounted) return Errno.AccessDenied; stat = null;
if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported; if(pathElements.Length != 1) return Errno.NotSupported;

View File

@@ -121,7 +121,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
return Errno.NoError; return Errno.NoError;
} }
public Errno StatFs(ref FileSystemInfo stat) public Errno StatFs(out FileSystemInfo stat)
{ {
stat = new FileSystemInfo stat = new FileSystemInfo
{ {

View File

@@ -56,8 +56,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal
public Guid Id => new Guid("B0AC2CB5-72AA-473A-9200-270B5A2C2D53"); public Guid Id => new Guid("B0AC2CB5-72AA-473A-9200-270B5A2C2D53");
public Encoding Encoding { get; private set; } 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; return Errno.NotSupported;
} }
@@ -66,8 +67,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal
return Errno.NotSupported; return Errno.NotSupported;
} }
public Errno ReadLink(string path, ref string dest) public Errno ReadLink(string path, out string dest)
{ {
dest = null;
return Errno.NotSupported; return Errno.NotSupported;
} }
} }

View File

@@ -165,7 +165,7 @@ namespace DiscImageChef.Commands
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
List<string> rootDir = new List<string>(); List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir); error = fs.ReadDir("/", out rootDir);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string entry in rootDir) foreach(string entry in rootDir)
{ {
@@ -176,7 +176,7 @@ namespace DiscImageChef.Commands
? "NO NAME" ? "NO NAME"
: fs.XmlFsType.VolumeName; : fs.XmlFsType.VolumeName;
error = fs.Stat(entry, ref stat); error = fs.Stat(entry, out stat);
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
string outputPath; string outputPath;
@@ -185,7 +185,7 @@ namespace DiscImageChef.Commands
{ {
List<string> xattrs = new List<string>(); List<string> xattrs = new List<string>();
error = fs.ListXAttr(entry, ref xattrs); error = fs.ListXAttr(entry, out xattrs);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string xattr in xattrs) foreach(string xattr in xattrs)
{ {
@@ -315,7 +315,7 @@ namespace DiscImageChef.Commands
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
List<string> rootDir = new List<string>(); List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir); error = fs.ReadDir("/", out rootDir);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string entry in rootDir) foreach(string entry in rootDir)
{ {
@@ -326,7 +326,7 @@ namespace DiscImageChef.Commands
? "NO NAME" ? "NO NAME"
: fs.XmlFsType.VolumeName; : fs.XmlFsType.VolumeName;
error = fs.Stat(entry, ref stat); error = fs.Stat(entry, out stat);
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
FileStream outputFile; FileStream outputFile;
@@ -335,7 +335,7 @@ namespace DiscImageChef.Commands
{ {
List<string> xattrs = new List<string>(); List<string> xattrs = new List<string>();
error = fs.ListXAttr(entry, ref xattrs); error = fs.ListXAttr(entry, out xattrs);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string xattr in xattrs) foreach(string xattr in xattrs)
{ {
@@ -471,7 +471,7 @@ namespace DiscImageChef.Commands
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
List<string> rootDir = new List<string>(); List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir); error = fs.ReadDir("/", out rootDir);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string entry in rootDir) foreach(string entry in rootDir)
{ {
@@ -482,7 +482,7 @@ namespace DiscImageChef.Commands
? "NO NAME" ? "NO NAME"
: fs.XmlFsType.VolumeName; : fs.XmlFsType.VolumeName;
error = fs.Stat(entry, ref stat); error = fs.Stat(entry, out stat);
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
FileStream outputFile; FileStream outputFile;
@@ -491,7 +491,7 @@ namespace DiscImageChef.Commands
{ {
List<string> xattrs = new List<string>(); List<string> xattrs = new List<string>();
error = fs.ListXAttr(entry, ref xattrs); error = fs.ListXAttr(entry, out xattrs);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string xattr in xattrs) foreach(string xattr in xattrs)
{ {
@@ -612,7 +612,7 @@ namespace DiscImageChef.Commands
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
List<string> rootDir = new List<string>(); List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir); error = fs.ReadDir("/", out rootDir);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string entry in rootDir) foreach(string entry in rootDir)
{ {
@@ -622,7 +622,7 @@ namespace DiscImageChef.Commands
? "NO NAME" ? "NO NAME"
: fs.XmlFsType.VolumeName; : fs.XmlFsType.VolumeName;
error = fs.Stat(entry, ref stat); error = fs.Stat(entry, out stat);
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
string outputPath; string outputPath;
@@ -631,7 +631,7 @@ namespace DiscImageChef.Commands
{ {
List<string> xattrs = new List<string>(); List<string> xattrs = new List<string>();
error = fs.ListXAttr(entry, ref xattrs); error = fs.ListXAttr(entry, out xattrs);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string xattr in xattrs) foreach(string xattr in xattrs)
{ {

View File

@@ -154,7 +154,7 @@ namespace DiscImageChef.Commands
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
List<string> rootDir = new List<string>(); List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir); error = fs.ReadDir("/", out rootDir);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
else else
@@ -182,7 +182,7 @@ namespace DiscImageChef.Commands
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
List<string> rootDir = new List<string>(); List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir); error = fs.ReadDir("/", out rootDir);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
else else
@@ -220,7 +220,7 @@ namespace DiscImageChef.Commands
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
List<string> rootDir = new List<string>(); List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir); error = fs.ReadDir("/", out rootDir);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
else else
@@ -245,7 +245,7 @@ namespace DiscImageChef.Commands
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
List<string> rootDir = new List<string>(); List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir); error = fs.ReadDir("/", out rootDir);
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string entry in rootDir) foreach(string entry in rootDir)
if(options.Long) if(options.Long)
@@ -253,13 +253,13 @@ namespace DiscImageChef.Commands
FileEntryInfo stat = new FileEntryInfo(); FileEntryInfo stat = new FileEntryInfo();
List<string> xattrs = new List<string>(); List<string> xattrs = new List<string>();
error = fs.Stat(entry, ref stat); error = fs.Stat(entry, out stat);
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
DicConsole.WriteLine("{0}\t{1}\t{2} bytes\t{3}", stat.CreationTimeUtc, DicConsole.WriteLine("{0}\t{1}\t{2} bytes\t{3}", stat.CreationTimeUtc,
stat.Inode, stat.Length, entry); stat.Inode, stat.Length, entry);
error = fs.ListXAttr(entry, ref xattrs); error = fs.ListXAttr(entry, out xattrs);
if(error != Errno.NoError) continue; if(error != Errno.NoError) continue;
foreach(string xattr in xattrs) foreach(string xattr in xattrs)