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

View file

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