[Oberon] PO2013 - Last sector allocated

Paul Reed paulreed at paddedcell.com
Fri Jun 26 10:06:48 CEST 2020


Hi Tomas,

> Could this hint where the sector lies?
...     FileDir.Enumerate("", LastSec); Texts.WriteInt(W, lsec, 6);

No.

This will only tell you where the first sector of each file is.

Please study FileDir.Mod, in particular FileDir.Init to see how the 
system builds a list of allocated sectors at startup, if you really want 
to do it this way.

I have already suggested an easier way is to use the hint in 
Kernel.AllocSector: allocate the next free sector after the hint, then 
free it, and keep incrementing the hint until the sector allocated is 
before the hint (ie it's wrapped).  See Kernel.AllocSector and 
Kernel.FreeSector.  This has the advantage of being purely in memory, it 
doesn't hit the disk at all.

Cheers,
Paul


More information about the Oberon mailing list