clean up and standardize types across the codebase, unify atomic operations, improve UTF-8 handling throughout the system, remove obsolete input and named queue interfaces, redesign process preparation and creation, tighten IPC and service boundaries, improve error handling and reliability, minor documentation cleanup, fix doom surfaces, fix panic in ini parsing.

This commit is contained in:
maksw committed 2026-10-12 18:17:43 +02:00
1 parent 899225f551
commit c0ad63c27f
226 files changed
+6562 -4147

No files matched your search

+18 -17
View File
@@ -1,5 +1,6 @@
// FAT allocation, cache, and metadata core shared by the filesystem operation translation units.
#include <stdbool.h>
#include "fat_internal.h"
// FAT sector cache (fixes #1 and #5)
@@ -169,7 +170,7 @@ uint32_t FatEocMark(FAT_VOL* v) {
return v && v->Variant == FatVariant16 ? FAT16_EOC_MARK : FAT32_EOC_MARK;
}
int FatIsDataCluster(FAT_VOL* v, uint32_t cluster) {
bool FatIsDataCluster(FAT_VOL* v, uint32_t cluster) {
return v && cluster >= 2u && cluster < FatEocThreshold(v);
}
@@ -185,49 +186,49 @@ void FatSetDirentFirstCluster(FAT_VOL* v, DIRENT* d, uint32_t cluster) {
d->FirstClusterHi = (v && v->Variant == FatVariant32) ? (uint16_t)(cluster >> 16) : 0u;
}
int FatIsFixedRoot(FAT_VOL* v, uint32_t dirCluster) {
bool FatIsFixedRoot(FAT_VOL* v, uint32_t dirCluster) {
return v && v->Variant == FatVariant16 && dirCluster == FAT_FIXED_ROOT_CLUSTER;
}
uint64_t FatClusterToLba(FAT_VOL* v, uint32_t cluster);
uint32_t FatEntry(FAT_VOL* v, uint32_t cluster);
int FatDirectoryFirstSegment(FAT_VOL* v, uint32_t dirCluster,
bool FatDirectoryFirstSegment(FAT_VOL* v, uint32_t dirCluster,
uint32_t* cursor, uint64_t* lba,
uint32_t* sectors) {
if (!v || !cursor || !lba || !sectors) return 0;
if (!v || !cursor || !lba || !sectors) return false;
if (FatIsFixedRoot(v, dirCluster)) {
if (!v->RootDirSectors) return 0;
if (!v->RootDirSectors) return false;
*cursor = 0;
*lba = v->RootDirStart;
*sectors = 1;
return 1;
return true;
}
if (!FatIsDataCluster(v, dirCluster)) return 0;
if (!FatIsDataCluster(v, dirCluster)) return false;
*cursor = dirCluster;
*lba = FatClusterToLba(v, dirCluster);
*sectors = v->SectorsPerCluster;
return 1;
return true;
}
int FatDirectoryNextSegment(FAT_VOL* v, uint32_t dirCluster,
bool FatDirectoryNextSegment(FAT_VOL* v, uint32_t dirCluster,
uint32_t* cursor, uint64_t* lba,
uint32_t* sectors) {
if (!v || !cursor || !lba || !sectors) return 0;
if (!v || !cursor || !lba || !sectors) return false;
if (FatIsFixedRoot(v, dirCluster)) {
uint32_t next = *cursor + 1u;
if (next >= v->RootDirSectors) return 0;
if (next >= v->RootDirSectors) return false;
*cursor = next;
*lba = v->RootDirStart + next;
*sectors = 1;
return 1;
return true;
}
uint32_t next = FatEntry(v, *cursor);
if (!FatIsDataCluster(v, next)) return 0;
if (!FatIsDataCluster(v, next)) return false;
*cursor = next;
*lba = FatClusterToLba(v, next);
*sectors = v->SectorsPerCluster;
return 1;
return true;
}
// Implements the cluster To Lba operation.
@@ -314,7 +315,7 @@ KSTATUS FatWriteEntry(FAT_VOL* v, uint32_t cluster, uint32_t value) {
}
// Cluster allocation (fix #3: next-free hint + two-phase wrap-around scan).
uint32_t FatAllocClusterEx(FAT_VOL* v, int zeroCluster) {
uint32_t FatAllocClusterEx(FAT_VOL* v, bool zeroCluster) {
if (v->TotalClusters == 0) return 0;
uint32_t total = v->TotalClusters;
@@ -353,7 +354,7 @@ uint32_t FatAllocCluster(FAT_VOL* v) {
return FatAllocClusterEx(v, 1);
}
uint32_t FatAppendClusterEx(FAT_VOL* v, uint32_t lastCluster, int zeroCluster) {
uint32_t FatAppendClusterEx(FAT_VOL* v, uint32_t lastCluster, bool zeroCluster) {
uint32_t newCluster = FatAllocClusterEx(v, zeroCluster);
if (!newCluster) return 0;
if (!KSUCCESS(FatWriteEntry(v, lastCluster, newCluster))) return 0;
@@ -390,7 +391,7 @@ void FatFreeClusterChain(FAT_VOL* v, uint32_t start) {
// FAT timestamp and DIRENT metadata helpers.
// Implements the fat Is Leap Year operation.
static int FatIsLeapYear(uint32_t year) {
static bool FatIsLeapYear(uint32_t year) {
return ((year % 4u) == 0u && (year % 100u) != 0u) || ((year % 400u) == 0u);
}