Hi!
28-Фев-2004 23:32 [EMAIL PROTECTED] (Eric Auer) wrote to [EMAIL PROTECTED]:
I redirect this to group, because think this topic is important.
EA> Hi, you will never write a combined FAT16/FAT32 boot sector,
But I think about combined FAT12/FAT16.
EA> so please do not check whether the FAT16 fat is > 511 sectors...
Why?
EA> And remember: There are SEPARATE field in the boot sector for
EA> FAT1x fat size and fAT32 fat size anyway.
I think about this and reject this idea. But now I revise it:
xFATsectors is not exists in FAT1x BPB, so, looks, like checking
FATsectors==0 is enough to differ FAT1x and FAT32. Of course, later should
be diagnosed (and warned) another things: bootSignature2==2Eh,
rootEntries==0, etc. So, this gives next code:
______________O\_/_________________________________\_/O______________
/* Last valid cluster number */
#define FAT12_LAST 0x0FF5 /* 4085u */
#define FAT16_LAST 0xFFF5 /* 65525u */
/* Min sectors per FAT */
#define FAT16_MIN ((unsigned)(((FAT12_LAST+1ul) * 2u + SEC_SIZE-1) / SEC_SIZE))
#define FAT32_MIN ((unsigned)(((FAT16_LAST+1ul) * 4u + SEC_SIZE-1) / SEC_SIZE))
[...]
fs = FAT32;
if (curboot._.bs.bpb.FATsectors) {
fs = FAT16;
if (curboot._.bs.bpb.FATsectors < FAT16_MIN)
fs = FAT12;
}
_____________________________________________________________________
O/~\ /~\O
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel