FAT work.

This commit is contained in:
Matthijs ter Woord 2015-07-01 20:28:44 +02:00
parent 8eaee43bc0
commit 41b07afd7d
2 changed files with 24 additions and 13 deletions

View file

@ -6,7 +6,7 @@
<ProjectGuid>{40c3f1e6-2880-4af4-91fd-dfd41484719d}</ProjectGuid>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<Name>SentinelKernelBoot</Name>
<BinFormat>Bin</BinFormat>
<BinFormat>Elf</BinFormat>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
@ -14,23 +14,23 @@
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Profile>Bochs</Profile>
<Profile>VMware</Profile>
<!-- Looks like this was a mispelled attribute. Replaced by DebugEnabled below.
<DebugEnable>true</DebugEnable>
-->
<DebugEnabled>True</DebugEnabled>
<DebugMode>Source</DebugMode>
<TraceMode>User</TraceMode>
<EnableGDB>False</EnableGDB>
<StartCosmosGDB>false</StartCosmosGDB>
<VMWareEdition>Player</VMWareEdition>
<EnableGDB>True</EnableGDB>
<StartCosmosGDB>False</StartCosmosGDB>
<VMWareEdition>Workstation</VMWareEdition>
<OutputPath>bin\Debug\</OutputPath>
<Name>SentinelKernelBoot</Name>
<Description>Use Bochs emulator to deploy and debug.</Description>
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
<Deployment>ISO</Deployment>
<Launch>Bochs</Launch>
<Launch>VMware</Launch>
<VisualStudioDebugPort>Pipe: Cosmos\Serial</VisualStudioDebugPort>
<StackCorruptionDetectionEnabled>True</StackCorruptionDetectionEnabled>
<StackCorruptionDetectionEnabled>False</StackCorruptionDetectionEnabled>
<VMware_Name>SentinelKernelBoot</VMware_Name>
<VMware_Description>Use VMware Player or Workstation to deploy and debug.</VMware_Description>
<VMware_Deployment>ISO</VMware_Deployment>
@ -41,7 +41,7 @@
<VMware_VisualStudioDebugPort>Pipe: Cosmos\Serial</VMware_VisualStudioDebugPort>
<VMware_VMwareEdition>Workstation</VMware_VMwareEdition>
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
<VMware_EnableGDB>False</VMware_EnableGDB>
<VMware_EnableGDB>True</VMware_EnableGDB>
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
<EnableBochsDebug>True</EnableBochsDebug>
<Bochs_Name>SentinelKernelBoot</Bochs_Name>

View file

@ -5,12 +5,13 @@ using Cosmos.System;
using System;
using System.Collections.Generic;
using System.IO;
using SentinelKernel.System.FileSystem.FAT;
using Console = global::System.Console;
namespace SentinelKernel.System.FileSystem.VFS
{
[Serializable]
public struct KVP<TKey, TValue>
public class KVP<TKey, TValue>
{
private readonly TKey key;
private readonly TValue value;
@ -45,6 +46,7 @@ namespace SentinelKernel.System.FileSystem.VFS
if (BlockDevice.Devices[i] is Partition)
{
mPartitions.Add((Partition)BlockDevice.Devices[i]);
break;
}
}
@ -68,16 +70,25 @@ namespace SentinelKernel.System.FileSystem.VFS
for (int i = 0; i < mPartitions.Count; i++)
{
string xRootPath = string.Concat(i, VolumeSeparatorChar, DirectorySeparatorChar);
FatFileSystem xFileSystem = null;
switch (FileSystem.GetFileSystemType(mPartitions[i]))
{
case FileSystemType.FAT:
mFileSystems.Add(new KVP<string, FileSystem>(xRootPath, new FAT.FatFileSystem(mPartitions[i])));
xFileSystem = new FAT.FatFileSystem(mPartitions[i]);
mFileSystems.Add(new KVP<string, FileSystem>(xRootPath, xFileSystem));
break;
default:
Console.WriteLine("Unknown filesystem type!");
return;
}
if (mFileSystems[i].Key == xRootPath)
Console.Write("i = ");
Console.WriteLine(i.ToString());
Console.Write("mFileSystems.Count = ");
Console.WriteLine(mFileSystems.Count);
if (xFileSystem!=null)
{
var xFatFS = mFileSystems[i].Value as FAT.FatFileSystem;
var xFatFS = (FAT.FatFileSystem)xFileSystem;
Console.WriteLine("-------File System--------");
Console.WriteLine("Bytes per Cluster: " + xFatFS.BytesPerCluster);
Console.WriteLine("Bytes per Sector: " + xFatFS.BytesPerSector);