[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Protection woes ...



Hi all,
          my head hurts! As some may know, I've being trying to add some
form of protection to Minixfs. This is a way of setting up a partition so
regular TOS will not write to it (e.g. gives an error of some sort). 
          This problem has a long history and has been an unmitigated pain
in the arse since the very first version. The problem is to produce something
which TOS wont write to but not so bad that the hard disk software refuses
access to the partition. I wont bore you with all the details but here's the
latest fun.
          The best method I've used is to make the partition look tiny from
the BPB/TOS point of view and to squeeze the root directory in the free
sector just after the super block. This pseudo root directory is then filled
with volume names. Any attempt by TOS to access this results in an error
because the root directory is full. This method seems to work fine with just
about every piece of hard disk software I've seen/used/been told about.
          The problem with this method though is that if you have a sector
size bigger than 512 bytes the pseudo root directory gets shifted onto vital
data in the filesystem. So for pl7 I tried editing the sector size to 512
bytes and using this same method. AHDI likes this, ICD regards the partition
as invalid (if bigger than about 32Mb) and wont recognise it.
          So I think, keep the sector size the same but shove the pseudo root
directory at the *end* of the disk. This shortens the filesystem by one logical
sector, but never mind. So I twiddle at first with the number of reserved
sectors in sector zero to get it to work. After a while I find ICD likes this
but AHDI doesn't because it seems to want the first data cluster to be on the
disk. No problem, I shorten the filesystem by one more sector. AHDI and ICD
are now both happy. The BPB signals the root directory is in the right place
and alls well.
          So far so good. I fill in the root directory with vol names and to
my surprise they aren't visible to TOS without MiNT/Minixfs. After some head
scratching I find out that TOS itself messes up the root directory calculation
and looks for the root several sectors earlier on!!! So I try a different line,
twiddle with FAT size: same result.
          This isn't fair!!!
          So that's that idea gone away. I've had another idea which should
finally work. Minix has a feature which allows certain blocks to be marked
as bad and ignored by Minix/fsck. So I'll add this feature to Minixfs and
stuff the pseudo root directory in a pile of blocks marked as bad. However
this means I'll have to modify fsck (shouldn't be too hard) and the defragger
(which is a bit trickier) and I'll have to dust off my copy of Minix to see
how bad blocks are handled.
          If anyone has any better ideas, please tell me!
Steve.
__END