refactor: namespace restructure of entire codebase
continuous-integration/drone/push Build is passing

Reorganize all source files into a hierarchical namespace structure
with dot-separated unit names matching directory paths.

Major changes:
- src/prog/ -> src/app/ (app.*.pas)
- src/fault/ -> src/arch/x86/fault/ (arch.x86.fault.*.pas)
- src/isr/ -> src/arch/x86/isr/ (arch.x86.isr.*.pas)
- src/include/ -> src/core/ (core.*.pas) + src/arch/x86/
- src/driver/ subtree reorganized with driver.* namespace prefixes
- src/driver/storage/con/ -> src/driver/storage/ctl/ (Windows reserved name fix)
- src/driver/storage/ split into con(ctl)/fs/vol/ subdirectories
- src/driver/net/ flattened from l1-l5 layers to driver.net.*.pas
- kernel.pas -> asuro.pas, faults.pas -> arch.x86.faults.pas
- stdio.pas/syslog.pas -> io/io.stdio.pas, io/io.syslog.pas
- processmanager.pas -> proc/proc.mgr.pas
- lmemorymanager.pas -> memory/memory.heap.pas
- Build scripts moved to toolchain/
- Added compat/ shims for lmemorymanager and types
- Added doc/namespace.md tracking the refactor

197 files changed, 6292 insertions(+), 5526 deletions(-)
This commit is contained in:
t3hn3rd committed 2026-03-08 01:28:31 +00:00
1 parent e922f086c2
commit 6fa008ed79
197 files changed
+6291 -5525

No files matched your search

@@ -0,0 +1,124 @@
// Copyright 2021 Aaron Hance
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{
Drivers->Storage->ASFS - Asuro Filesystem Driver.
@author(Aaron Hance <[email protected]>)
}
unit driver.storage.fs.asfs;
interface
uses
io.syslog,
core.ds.lists,
memory.heap,
driver.timer.rtc,
driver.intf.serial,
storagemanagement,
driver.storage.mgr,
core.strings,
io.stdio,
debug.tracer,
core.util, arch.x86.util;
type
TFilesystemRecord = bitpacked record
magicNumber : uint32;
sectorSize : uint16;
sectorsPerTable : uint8;
totalSectors : uint32;
volumeLabel : array[0..15] of uint8;
endOfData : uint32;
end;
PFilesystemRecord = ^TFilesystemRecord;
//File or folder entry for file table
TFileEntry = bitpacked record
filename : array[0..15] of uint8;
lastWriteDate : array[0..3] of uint8; // year (2000 + x), month, day, hour
lastReadDate : array[0..3] of uint8;
attributes : uint8; // 0 null entry, 1 file, 2 folder, 3 this folder, 4 parent folder, 5 table continuation, 6 volume root
extension : array[0..6] of uint8;
location : uint32; // location on disk
numSectors : uint32; // size in sectors
end;
PFileEntry = ^TFileEntry;
var
filesystem : TFilesystemRecord;
//nullsectors : array[0..1024] of TFileEntry; //cache some null entry pointers for effeciency sake
procedure init;
procedure create_volume(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
procedure detect_volumes(disk : PStorage_Device);
implementation
procedure init() begin
push_trace('driver.storage.fs.asfs.init()');
filesystem.sName:= 'driver.storage.fs.asfs';
//filesystem.readDirCallback:= @readDirectoryGen;
//filesystem.createDirCallback:= @writeDirectoryGen;
filesystem.createcallback:= @create_volume;
filesystem.detectcallback:= @detect_volumes;
//filesystem.writecallback:= @writeFile;
storagemanagement.register_filesystem(@filesystem);
end;
procedure create_volume(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32)
var
filesystemRecord : PFilesystemRecord;
fileEntry : PFileEntry;
buffer : puint32;
thisArray : byteArray8 = ('.',' ',' ',' ',' ',' ',' ',' ');
parentArray : byteArray8 = ('.','.',' ',' ',' ',' ',' ',' ');
begin
buffer := puint32(kalloc(disk^.sectorSize))
memset(uint32(buffer), 0, disk^.sectorSize);
PFilesystemRecord := PFilesystemRecord(buffer);
filesystemRecord^.magicNumber := $A2F2;
filesystemRecord^.sectorSize := disk^.sectorsize;
filesystemRecord^.sectorsPerTable := 8;
filesystemRecord^.totalSectors := sectors;
filesystemRecord^.endOfData := filesystemRecord.sectorsPerTable;
//filesystemRecord.volumeLabel := config^
driver.storage.mgr.storage_write(disk, start, 1, buffer);
memset(uint32(buffer), 0, disk^.sectorSize);
fileEntry := PFileEntry(buffer)[0];
fileEntry^.filename := thisArray;
fileEntry^.attributes := 6;
fileEntry^.location := 1;
fileEntry := PFileEntry(buffer)[1];
fileEntry^.filename := parentArray;
fileEntry^.attributes := 0;
fileEntry^.location := 1;
driver.storage.mgr.storage_write(disk, start + 1, 1, buffer);
end;
procedure detect_volumes(disk : PStorage_Device) begin
end;
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,120 @@
{
Driver->Storage->FilesystemManager - Filesystem driver registry and routing.
Filesystem drivers (FAT32, FlatFS, etc.) register themselves here.
When VolumeManager discovers a volume, FilesystemManager probes it
against all registered filesystem drivers to detect the filesystem type.
@author(Aaron Hance <[email protected]>)
}
unit driver.storage.fs.mgr;
interface
uses
core.ds.lists,
memory.heap,
driver.storage.types,
core.strings,
debug.tracer,
core.util, arch.x86.util;
var
filesystems : PLinkedListBase;
procedure init();
procedure register_filesystem(filesystem : PFilesystem);
function get_filesystem_count() : uint32;
function get_filesystem(index : uint32) : PFilesystem;
function find_filesystem_by_name(name : pchar) : PFilesystem;
function find_filesystem_by_id(system_id : uint8) : PFilesystem;
procedure probe_volume(volume : PStorage_Volume);
implementation
procedure init();
begin
push_trace('driver.storage.fs.mgr.init');
filesystems := LL_New(sizeof(TFilesystem));
end;
procedure register_filesystem(filesystem : PFilesystem);
var
elm : void;
begin
push_trace('driver.storage.fs.mgr.register_filesystem');
elm := LL_Add(filesystems);
memcpy(uint32(filesystem), uint32(elm), sizeof(TFilesystem));
end;
function get_filesystem_count() : uint32;
begin
get_filesystem_count := LL_Size(filesystems);
end;
function get_filesystem(index : uint32) : PFilesystem;
begin
if index < LL_Size(filesystems) then
get_filesystem := PFilesystem(LL_Get(filesystems, index))
else
get_filesystem := nil;
end;
function find_filesystem_by_name(name : pchar) : PFilesystem;
var
i : uint32;
fs : PFilesystem;
begin
push_trace('driver.storage.fs.mgr.find_filesystem_by_name');
find_filesystem_by_name := nil;
for i := 0 to LL_Size(filesystems) - 1 do begin
fs := PFilesystem(LL_Get(filesystems, i));
if stringEquals(fs^.sName, name) then begin
find_filesystem_by_name := fs;
exit;
end;
end;
end;
function find_filesystem_by_id(system_id : uint8) : PFilesystem;
var
i : uint32;
fs : PFilesystem;
begin
push_trace('driver.storage.fs.mgr.find_filesystem_by_id');
find_filesystem_by_id := nil;
for i := 0 to LL_Size(filesystems) - 1 do begin
fs := PFilesystem(LL_Get(filesystems, i));
if fs^.system_id = system_id then begin
find_filesystem_by_id := fs;
exit;
end;
end;
end;
procedure probe_volume(volume : PStorage_Volume);
var
i : uint32;
fs : PFilesystem;
begin
push_trace('driver.storage.fs.mgr.probe_volume.enter');
{ Try each registered filesystem's identify callback against this volume }
for i := 0 to LL_Size(filesystems) - 1 do begin
fs := PFilesystem(LL_Get(filesystems, i));
if fs^.identifyCallback <> nil then begin
push_trace('driver.storage.fs.mgr.probe_volume.tryFS');
if fs^.identifyCallback(volume) then begin
volume^.filesystem := fs;
push_trace('driver.storage.fs.mgr.probe_volume.found');
exit;
end;
end;
end;
push_trace('driver.storage.fs.mgr.probe_volume.exit');
end;
end.