When mounting an MSDOS fileysystem, do not require that bytes 252 and

253 of the superblock be zero.  Searching the net failed to find any
justification for checking these bytes; all available references say
that they are part of the boot code and not BOOTSIG2 and BOOTSIG3.

Modify the MSDOS 7.1 bootsector definition to have 420 bytes of boot
code and no BOOTSIG[23], rather than 418 bytes of boot code, to follow
available references and apparent Windows practice.  A test build
showed that these defines are not used other than in the check removed
by this commit.

Patch tested on netbsd-3, and enabled mounting of a 4 GB CF formatted
under Windows XP and then in a digital camera.  The CF was previously
unmountable.

Concept approved on tech-kern by christos@ and martin@.
This commit is contained in:
gdt 2006-08-14 14:06:26 +00:00
parent 5ed2f11fe6
commit 7db024f8e7
2 changed files with 10 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootsect.h,v 1.3 2005/12/03 17:34:43 christos Exp $ */
/* $NetBSD: bootsect.h,v 1.4 2006/08/14 14:06:26 gdt Exp $ */
/*
* Written by Paul Popelka (paulp@uts.amdahl.com)
@ -62,15 +62,11 @@ struct bootsector710 {
int8_t bsOEMName[8]; /* OEM name and version */
int8_t bsBPB[53]; /* BIOS parameter block */
int8_t bsExt[26]; /* Bootsector Extension */
int8_t bsBootCode[418]; /* pad so structure is 512b */
u_int8_t bsBootSectSig2; /* 2 & 3 are only defined for FAT32? */
u_int8_t bsBootSectSig3;
int8_t bsBootCode[420]; /* pad so structure is 512b */
u_int8_t bsBootSectSig0;
u_int8_t bsBootSectSig1;
#define BOOTSIG0 0x55
#define BOOTSIG1 0xaa
#define BOOTSIG2 0
#define BOOTSIG3 0
};
#ifdef atari
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vfsops.c,v 1.33 2006/07/23 22:06:10 ad Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.34 2006/08/14 14:06:26 gdt Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.33 2006/07/23 22:06:10 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.34 2006/08/14 14:06:26 gdt Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -517,9 +517,12 @@ msdosfs_mountfs(devvp, mp, l, argp)
}
if (pmp->pm_RootDirEnts == 0) {
if (bsp->bs710.bsBootSectSig2 != BOOTSIG2
|| bsp->bs710.bsBootSectSig3 != BOOTSIG3
|| pmp->pm_Sectors
/*
* Some say that bsBootSectSig[23] must be zero, but
* Windows does not require this and some digital cameras
* do not set these to zero. Therefore, do not insist.
*/
if (pmp->pm_Sectors
|| pmp->pm_FATsecs
|| getushort(b710->bpbFSVers)) {
error = EINVAL;