Merge pull request #734 from valentinbreiz/patch-1

mSize in GetVolumes fix.
This commit is contained in:
fanoI 2017-09-05 20:23:01 +02:00 committed by GitHub
commit ff2a75685c
4 changed files with 11 additions and 6 deletions

View file

@ -355,10 +355,11 @@ namespace Cosmos.System.FileSystem
for (int i = 0; i < mPartitions.Count; i++)
{
string xRootPath = string.Concat(i, VolumeSeparatorChar, DirectorySeparatorChar);
var xSize = (long)(mPartitions[i].BlockCount * mPartitions[i].BlockSize / 1024 / 1024);
switch (FileSystem.GetFileSystemType(mPartitions[i]))
{
case FileSystemType.FAT:
mFileSystems.Add(new FatFileSystem(mPartitions[i], xRootPath));
mFileSystems.Add(new FatFileSystem(mPartitions[i], xRootPath, xSize));
break;
default:
global::System.Console.WriteLine("Unknown filesystem type!");

View file

@ -359,8 +359,8 @@ namespace Cosmos.System.FileSystem.FAT
/// <param name="aDevice">The partition.</param>
/// <param name="aRootPath">The root path.</param>
/// <exception cref="Exception">FAT signature not found.</exception>
public FatFileSystem(Partition aDevice, string aRootPath)
: base(aDevice, aRootPath)
public FatFileSystem(Partition aDevice, string aRootPath, long aSize)
: base(aDevice, aRootPath, aSize)
{
if (aDevice == null)
{
@ -603,7 +603,7 @@ namespace Cosmos.System.FileSystem.FAT
{
Global.mFileSystemDebugger.SendInternal("-- FatFileSystem.GetRootDirectory --");
var xRootEntry = new FatDirectoryEntry(this, null, mRootPath, mRootPath, RootCluster);
var xRootEntry = new FatDirectoryEntry(this, null, mRootPath, mSize, mRootPath, RootCluster);
return xRootEntry;
}

View file

@ -42,9 +42,10 @@ namespace Cosmos.System.FileSystem.FAT.Listing
FatFileSystem aFileSystem,
FatDirectoryEntry aParent,
string aFullPath,
long aSize,
string aName,
uint aFirstCluster)
: base(aFileSystem, aParent, aFullPath, aName, 0, DirectoryEntryTypeEnum.Directory)
: base(aFileSystem, aParent, aFullPath, aName, aSize, DirectoryEntryTypeEnum.Directory)
{
if (aFirstCluster < aFileSystem.RootCluster)
{

View file

@ -9,10 +9,11 @@ namespace Cosmos.System.FileSystem
{
public abstract class FileSystem
{
protected FileSystem(Partition aDevice, string aRootPath)
protected FileSystem(Partition aDevice, string aRootPath, long aSize)
{
mDevice = aDevice;
mRootPath = aRootPath;
mSize = aSize;
}
public static FileSystemType GetFileSystemType(Partition aDevice)
@ -42,5 +43,7 @@ namespace Cosmos.System.FileSystem
protected Partition mDevice { get; }
public string mRootPath { get; }
public long mSize { get; }
}
}