[parted-devel] table.c's fat_table_set_eof
Otavio Salvador
otavio at debian.org
Fri Feb 16 16:25:51 CET 2007
Jim Meyering <jim at meyering.net> writes:
> Looking at the switch in fat_table_set_eof,
> I see this:
>
> int
> fat_table_set_eof (FatTable* ft, FatCluster cluster)
> {
>
> switch (ft->fat_type) {
> case FAT_TYPE_FAT16:
> return fat_table_set (ft, cluster, 0xfff8);
>
> case FAT_TYPE_FAT32:
> return fat_table_set (ft, cluster, 0x0fffffff);
> }
> return 0;
> }
>
> but doc/FAT says this:
>
> * end of file (0xff0 for FAT12, 0xfff0 for FAT16, 0x0ffffff0 for FAT32).
>
> Is this an inconsistency?
> If so, any idea which is right?
I think so. There're more of them:
Check:
#v+
static int
_test_code_eof (const FatTable* ft, FatCluster code)
{
switch (ft->fat_type) {
case FAT_TYPE_FAT16:
if (code >= 0xfff7) return 1;
break;
case FAT_TYPE_FAT32:
if (code >= 0x0ffffff7) return 1;
break;
}
return 0;
}
#-
This is also wrong since it would never return the _eof case since we
tag them differently (even doing it wrong as you spot above)
Those two cases might be fixed then.
--
O T A V I O S A L V A D O R
---------------------------------------------
E-mail: otavio at debian.org UIN: 5906116
GNU/Linux User: 239058 GPG ID: 49A5F855
Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
you the whole house."
More information about the parted-devel
mailing list