Deal correctly with boundary between 12 bit and 16 bit cluster numbers

This commit is contained in:
ws 1996-02-11 22:48:14 +00:00
parent 9401e46ed0
commit f331e77b53
2 changed files with 15 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fat.h,v 1.9 1996/01/19 14:28:05 leo Exp $ */
/* $NetBSD: fat.h,v 1.10 1996/02/11 22:48:14 ws Exp $ */
/*-
* Copyright (C) 1994 Wolfgang Solfrank.
@ -67,8 +67,9 @@
* MSDOSFS:
* Return true if filesystem uses 12 bit fats. Microsoft Programmer's
* Reference says if the maximum cluster number in a filesystem is greater
* than 4086 then we've got a 16 bit fat filesystem. While mounting, the
* result of this test is stored in pm_fatentrysize.
* than 4078 ((CLUST_RSRVS - CLUST_FIRST) & FAT12_MASK) then we've got a
* 16 bit fat filesystem. While mounting, the result of this test is stored
* in pm_fatentrysize.
* GEMDOS-flavour (atari):
* If the filesystem is on floppy we've got a 12 bit fat filesystem, otherwise
* 16 bit. We check the d_type field in the disklabel struct while mounting

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vfsops.c,v 1.39 1996/02/09 19:13:50 christos Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.40 1996/02/11 22:48:16 ws Exp $ */
/*-
* Copyright (C) 1994, 1995 Wolfgang Solfrank.
@ -418,21 +418,24 @@ msdosfs_mountfs(devvp, mp, p, argp)
&& ((pmp->pm_Heads == 1) || (pmp->pm_Heads == 2))))
)
pmp->pm_fatentrysize = 12;
else pmp->pm_fatentrysize = 16;
}
else {
if (pmp->pm_maxcluster <= 4086)
else
pmp->pm_fatentrysize = 16;
} else {
if (pmp->pm_maxcluster
<= ((CLUST_RSRVS - CLUST_FIRST) & FAT12_MASK))
/*
* This will usually be a floppy disk. This size makes
* sure that one fat entry will not be split across
* multiple blocks.
*/
pmp->pm_fatentrysize = 12;
else pmp->pm_fatentrysize = 16;
else
pmp->pm_fatentrysize = 16;
}
if(FAT12(pmp))
if (FAT12(pmp))
pmp->pm_fatblocksize = 3 * pmp->pm_BytesPerSec;
else pmp->pm_fatblocksize = MAXBSIZE;
else
pmp->pm_fatblocksize = MAXBSIZE;
pmp->pm_fatblocksec = pmp->pm_fatblocksize / pmp->pm_BytesPerSec;
pmp->pm_bnshift = ffs(pmp->pm_BytesPerSec) - 1;