Code cleanup.

This commit is contained in:
José Pedro 2018-12-01 22:55:14 +00:00
parent 53ddb83209
commit 945a1cce72
No known key found for this signature in database
GPG key ID: B8247B9301707B83
4 changed files with 35 additions and 61 deletions

View file

@ -1,8 +0,0 @@
[*.cs]
indent_size=4
[Global.cs]
indent_size = 2
[BlockDevice/Ata.cs]
indent_size = 2

View file

@ -1,36 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cosmos.Debug.Kernel;
using Cosmos.Debug.Kernel;
namespace Cosmos.HAL.BlockDevice {
public abstract class Ata : BlockDevice
{
internal static Debugger AtaDebugger = new Debugger("HAL", "Ata");
protected Ata() {
mBlockSize = 512;
}
// In future may need to add a None for PCI ATA controllers.
// Or maybe they all have Primary and Secondary on them as well.
public enum ControllerIdEnum { Primary, Secondary }
protected ControllerIdEnum mControllerID;
public ControllerIdEnum ControllerID {
get { return mControllerID; }
}
public enum BusPositionEnum { Master, Slave }
protected BusPositionEnum mBusPosition;
public BusPositionEnum BusPosition {
get { return mBusPosition; }
}
public override string ToString()
namespace Cosmos.HAL.BlockDevice
{
public abstract class Ata : BlockDevice
{
return "Ata (Abstract)";
internal static Debugger AtaDebugger = new Debugger("HAL", "Ata");
protected Ata()
{
mBlockSize = 512;
}
// In future may need to add a None for PCI ATA controllers.
// Or maybe they all have Primary and Secondary on them as well.
public enum ControllerIdEnum { Primary, Secondary }
protected ControllerIdEnum mControllerID;
public ControllerIdEnum ControllerID => mControllerID;
public enum BusPositionEnum { Master, Slave }
protected BusPositionEnum mBusPosition;
public BusPositionEnum BusPosition => mBusPosition;
public override string ToString()
{
return "Ata (Abstract)";
}
}
}
}

View file

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cosmos.Debug.Kernel;
namespace Cosmos.HAL.BlockDevice
{
@ -23,21 +20,15 @@ namespace Cosmos.HAL.BlockDevice
}
protected UInt64 mBlockCount = 0;
public UInt64 BlockCount
{
get { return mBlockCount; }
}
public UInt64 BlockCount => mBlockCount;
protected UInt64 mBlockSize = 0;
public UInt64 BlockSize
{
get { return mBlockSize; }
}
protected UInt64 mBlockSize = 0;
public UInt64 BlockSize => mBlockSize;
// Only allow reading and writing whole blocks because many of the hardware
// command work that way and we dont want to add complexity at the BlockDevice level.
// public abstract void ReadBlock(UInt64 aBlockNo, UInt32 aBlockCount, byte[] aData);
public abstract void ReadBlock(UInt64 aBlockNo, UInt64 aBlockCount, byte[] aData);
// Only allow reading and writing whole blocks because many of the hardware
// command work that way and we dont want to add complexity at the BlockDevice level.
// public abstract void ReadBlock(UInt64 aBlockNo, UInt32 aBlockCount, byte[] aData);
public abstract void ReadBlock(UInt64 aBlockNo, UInt64 aBlockCount, byte[] aData);
public abstract void WriteBlock(UInt64 aBlockNo, UInt64 aBlockCount, byte[] aData);
protected void CheckDataSize(byte[] aData, UInt64 aBlockCount)

View file

@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cosmos.HAL.BlockDevice
{
public class Partition : BlockDevice
{
BlockDevice mHost;
UInt64 mStartingSector;
private readonly BlockDevice mHost;
private readonly UInt64 mStartingSector;
public Partition(BlockDevice aHost, UInt64 aStartingSector, UInt64 aSectorCount)
{