[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] FreeMiNT and cluster size
Hello.
I have a single FAT16 partition (sizes in bytes):
- sector size: 512
- cluster size: 16384 (32 sectors)
It works fine with EmuTOS alone, but I can't use it with FreeMiNT's
NEWFATFS.
EmuTOS provides an AHDI cookie to a PUN_INFO structure:
http://toshyp.atari.org/en/00300b.html#PUN_INFO
The field P_max_sector is defined as "the largest occurring block size
for BIOS sectors".
On my setup EmuTOS returns 512 in this field, and I believe this is correct.
Then in FreeMiNT's sys/block_IO.c, function init_block_IO(), we can see:
if (pun)
cache.max_size = pun->max_sect_siz * 2L;
So in my case I will get cache.max_size == 1024.
Just after that, we can see:
cache.max_size = MAX (cache.max_size, MIN_BLOCK);
where MIN_BLOCK == 8192
Finally I have cache.max_size == 8192.
But later, in sys/fatfs.c, function val_bpb(), there is:
// max = cache.max_size (8192)
// xbpb->clsizb (16384)
if (xbpb->clsizb > max)
{
FAT_ALERT (("FATFS [%c]: unitsize (%li) too small (clsizb =
%li)!", 'A'+drv, max, xbpb->clsizb));
FAT_ALERT (("FATFS [%c]: medium access denied", 'A'+drv));
Fatally, this fails for me with "FATFS [C]: unitsize (8192) too small
(clsizb = 16384)!" and I can't use my partition.
The cache.max_size setting seems good to me, with a sensible minimum value.
But the fatfs test comparing a cluster size with a maximum sector size
looks totally bogus. Am I wrong ?
So currently FreeMiNT can't use partitions with clusters >= 8 KB unless
there are partitions with logical sectors with 4 KB or more, that's weird...
--
Vincent Rivière