From b62e3ce8c641e60a88bcbe34003c62baaa65fc20 Mon Sep 17 00:00:00 2001 From: aaron Date: Sat, 7 Apr 2018 22:21:03 +0000 Subject: [PATCH] git-svn-id: https://spexeah.com:8443/svn/Asuro@392 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c --- src/driver/storage/storagemanagement.pas | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/driver/storage/storagemanagement.pas b/src/driver/storage/storagemanagement.pas index 6c078dc2..0ae2389b 100644 --- a/src/driver/storage/storagemanagement.pas +++ b/src/driver/storage/storagemanagement.pas @@ -38,11 +38,38 @@ const var + storageDevices : array[0..255] of TStorage_Device; +procedure init(); procedure register_device(device : TStorage_Device); function get_all_devices() : APStorage_Device; function read(device : uint16; address : uint32; byteCount : uint32) : PuInt32; procedure write(device : uint16; address : uint32; byteCount : uint32; data : PuInt32); implementation + +procedure list_drives_command(params : PParamList); +var + i : uint8; +begin + for i:=0 to 255 do begin + if storageDevices[i].controller = nil then break; + console.writeint(i); + console.writestring(') Device_Type: '); + case storageDevices[i].controller of + ControllerIDE:console.writestring('IDE '); + ControllerUSB:console.writestring('USB '); + ControllerAHCI:console.writestring('AHCI '); + ControllerNET:console.writestring('NET '); + end; + console.writestring('Capacity: '); + console.writeint(((sectors * 512) / 1000) / 1000); + console.writestringln('MB'); + end; +end; + +procedure init(); +begin + terminal.registerCommand('disks', @list_drives_command, 'List storage devices'); +end; end. \ No newline at end of file