Added ATA and PCIBus again. Some VFS changes.

This commit is contained in:
Scalpel_cp 2008-08-12 21:16:06 +00:00
parent d521a396d2
commit bc3fe9243b
2 changed files with 13 additions and 10 deletions

View file

@ -24,14 +24,14 @@ namespace Cosmos.Hardware {
Kernel.CPU.CreateIDT(true); Kernel.CPU.CreateIDT(true);
Console.WriteLine(" Init PCIBus"); Console.WriteLine(" Init PCIBus");
//PCIBus.Init(); PCIBus.Init();
// Old // Old
Console.WriteLine(" Init Keyboard"); Console.WriteLine(" Init Keyboard");
Keyboard.Initialize(); Keyboard.Initialize();
// New // New
Console.WriteLine(" Init ATA"); Console.WriteLine(" Init ATA");
//Storage.ATA.ATA.Initialize(); Storage.ATA.ATA.Initialize();
//Device.Add(new PC.Bus.CPU.Keyboard()); //Device.Add(new PC.Bus.CPU.Keyboard());
} }

View file

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; //using System.Linq;
using Cosmos.Sys.FileSystem; using Cosmos.Sys.FileSystem;
using Cosmos.Sys.FileSystem.Ext2; using Cosmos.Sys.FileSystem.Ext2;
using Cosmos.Hardware; using Cosmos.Hardware;
@ -14,7 +14,6 @@ namespace Cosmos.Sys {
private static void DetectFilesystem(BlockDevice aDevice) { private static void DetectFilesystem(BlockDevice aDevice) {
#region Ext2 #region Ext2
if (Ext2.BlockDeviceContainsExt2(aDevice)) { if (Ext2.BlockDeviceContainsExt2(aDevice)) {
aDevice.Used = true; aDevice.Used = true;
var xFS = new Ext2(aDevice); var xFS = new Ext2(aDevice);
@ -47,6 +46,8 @@ namespace Cosmos.Sys {
"Registered Filesystems", "Registered Filesystems",
(uint)mFilesystems.Count, (uint)mFilesystems.Count,
32); 32);
if (mFilesystems.Count == 0)
Console.WriteLine("WARNING: No filesystems found in VFS init!");
} }
//Path examples: //Path examples:
@ -65,7 +66,6 @@ namespace Cosmos.Sys {
public static bool ContainsVolumeSeparator(this string aPath) public static bool ContainsVolumeSeparator(this string aPath)
{ {
return (aPath[1] == Path.VolumeSeparatorChar); return (aPath[1] == Path.VolumeSeparatorChar);
//return aPath.Contains(Path.VolumeSeparatorChar);
} }
public static bool IsAbsolutePath(this string aPath) public static bool IsAbsolutePath(this string aPath)
@ -199,8 +199,8 @@ namespace Cosmos.Sys {
private static FilesystemEntry[] GetVolumes() private static FilesystemEntry[] GetVolumes()
{ {
// if (aFilesystems == null) //if (aFilesystems == null)
// throw new ArgumentNullException("mFilesystems has not been initialized"); // throw new ArgumentNullException("mFilesystems has not been initialized");
//Get volumes //Get volumes
var xResult = new FilesystemEntry[mFilesystems.Count]; var xResult = new FilesystemEntry[mFilesystems.Count];
@ -238,7 +238,10 @@ namespace Cosmos.Sys {
/// <returns>A filesystem</returns> /// <returns>A filesystem</returns>
private static Filesystem GetFileSystemFromPath(string aPath, int aOffset) private static Filesystem GetFileSystemFromPath(string aPath, int aOffset)
{ {
return mFilesystems[ParseStringToInt(aPath, aOffset)]; if (mFilesystems.Count == 0)
throw new Exception("No filesystems found");
else
return mFilesystems[ParseStringToInt(aPath, aOffset)];
} }
private static int ParseStringToInt(string aString, private static int ParseStringToInt(string aString,
@ -316,7 +319,7 @@ namespace Cosmos.Sys {
} }
catch (Exception e) catch (Exception e)
{ {
Cosmos.Hardware.DebugUtil.SendMessage("FileExists", e.Message); Cosmos.Hardware.DebugUtil.SendMessage("FileExists", "Error!: " + e.Message);
return false; return false;
} }
} }
@ -544,7 +547,7 @@ namespace Cosmos.Sys {
public static string[] GetLogicalDrives() public static string[] GetLogicalDrives()
{ {
List<string> xDrives = new List<string>(); List<string> xDrives = new List<string>();
foreach (FilesystemEntry entry in GetDirectoryListing("/")) foreach (FilesystemEntry entry in GetVolumes())
xDrives.Add(entry.Name + Path.VolumeSeparatorChar + Path.DirectorySeparatorChar); xDrives.Add(entry.Name + Path.VolumeSeparatorChar + Path.DirectorySeparatorChar);
return xDrives.ToArray(); return xDrives.ToArray();