feat(storage): full file protocol over per-client shared region (badged clients, owned handles, clamped lengths, ReadOnly on unwritable disk); init loads via libkos::fs; drop boot shared buffer

This commit is contained in:
2026-10-27 12:42:37 +01:00
parent 694c675a40
commit 909b3f0503
19 changed files with 827 additions and 506 deletions

View File

@@ -358,13 +358,17 @@ impl<B: BlockDevice> FileSystem for Fat16<B> {
break;
};
let sector = base + sector_in_cluster as u32;
self.device
.read_sector(SectorId::new(sector), &mut sector_buf);
if !self.device.read_sector(SectorId::new(sector), &mut sector_buf) {
break;
}
let chunk = (SECTOR_SIZE - byte_in_sector).min(buf.len() - written);
sector_buf[byte_in_sector..byte_in_sector + chunk]
.copy_from_slice(&buf[written..written + chunk]);
self.device.write_sector(SectorId::new(sector), &sector_buf);
// Bytes count as written only once they reached the disk.
if !self.device.write_sector(SectorId::new(sector), &sector_buf) {
break;
}
written += chunk;
pos += chunk;
@@ -479,6 +483,10 @@ impl<B: BlockDevice> FileSystem for Fat16<B> {
fn mkdir(&mut self, _path: &[u8]) -> bool {
false
}
fn writable(&self) -> bool {
self.device.writable()
}
}
fn to_fat_name(name: &[u8]) -> [u8; 11] {