Date: Sun, 8 Jul 2007 08:01:53 GMT From: Brian Chu <chub@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 123095 for review Message-ID: <200707080801.l6881rI8048534@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=123095 Change 123095 by chub@chub-msdosfs on 2007/07/08 08:01:09 Changed bootsector declarations so that individual entities in the BPB and Extended bootsector can actually be addressed. Updated msdosfs vfs code to account for this change. Affected files ... .. //depot/projects/soc2007/chub-msdosfs2/sys/fs/msdosfs/bootsect.h#3 edit .. //depot/projects/soc2007/chub-msdosfs2/sys/fs/msdosfs/bpb.h#2 edit .. //depot/projects/soc2007/chub-msdosfs2/sys/fs/msdosfs/msdosfs_vfsops.c#2 edit Differences ... ==== //depot/projects/soc2007/chub-msdosfs2/sys/fs/msdosfs/bootsect.h#3 (text+ko) ==== @@ -1,6 +1,9 @@ /* $FreeBSD: src/sys/fs/msdosfs/bootsect.h,v 1.13 2005/09/29 14:09:46 peadar Exp $ */ /* $NetBSD: bootsect.h,v 1.9 1997/11/17 15:36:17 ws Exp $ */ +#ifndef _FS_MSDOSFS_BOOTSECT_H +#define _FS_MSDOSFS_BOOTSECT_H + /*- * Written by Paul Popelka (paulp@uts.amdahl.com) * @@ -17,6 +20,8 @@ * October 1992 */ +#include <fs/msdosfs/bpb.h> + /* * Format of a boot sector. This is the first sector on a DOS floppy disk * or the fist sector of a partition on a hard disk. But, it is not the @@ -25,7 +30,8 @@ struct bootsector33 { u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ int8_t bsOemName[8]; /* OEM name and version */ - int8_t bsBPB[19]; /* BIOS parameter block */ + // int8_t bsBPB[19]; /* BIOS parameter block */ + struct bpb33 bsBPB; /* BIOS parameter block */ int8_t bsDriveNumber; /* drive number (0x80) */ int8_t bsBootCode[479]; /* pad so struct is 512b */ u_int8_t bsBootSectSig0; @@ -34,10 +40,20 @@ #define BOOTSIG1 0xaa }; +#define EXBOOTSIG 0x29 struct extboot { int8_t exDriveNumber; /* drive number (0x80) */ int8_t exReserved1; /* reserved */ int8_t exBootSignature; /* ext. boot signature (0x29) */ + u_int32_t exVolumeID; /* volume ID number */ + int8_t exVolumeLabel[11]; /* volume label */ + int8_t exFileSysType[8]; /* fs type (FAT12 or FAT16) */ +}; + +struct byte_extboot { + int8_t exDriveNumber; /* drive number (0x80) */ + int8_t exReserved1; /* reserved */ + int8_t exBootSignature; /* ext. boot signature (0x29) */ #define EXBOOTSIG 0x29 int8_t exVolumeID[4]; /* volume ID number */ int8_t exVolumeLabel[11]; /* volume label */ @@ -47,8 +63,8 @@ struct bootsector50 { u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ int8_t bsOemName[8]; /* OEM name and version */ - int8_t bsBPB[25]; /* BIOS parameter block */ - int8_t bsExt[26]; /* Bootsector Extension */ + struct bpb50 bsBPB; /* BIOS parameter block */ + struct extboot bsExt; /* Bootsector Extension */ int8_t bsBootCode[448]; /* pad so structure is 512b */ u_int8_t bsBootSectSig0; u_int8_t bsBootSectSig1; @@ -59,8 +75,8 @@ struct bootsector710 { u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */ int8_t bsOEMName[8]; /* OEM name and version */ - int8_t bsBPB[53]; /* BIOS parameter block */ - int8_t bsExt[26]; /* Bootsector Extension */ + struct bpb710 bsBPB; /* BIOS parameter block */ + struct extboot bsExt; /* Bootsector Extension */ int8_t bsBootCode[420]; /* pad so structure is 512b */ u_int8_t bsBootSectSig0; u_int8_t bsBootSectSig1; @@ -73,3 +89,6 @@ struct bootsector50 bs50; struct bootsector710 bs710; }; + +#endif +// _FS_MSDOSFS_BOOTSECT_H ==== //depot/projects/soc2007/chub-msdosfs2/sys/fs/msdosfs/bpb.h#2 (text+ko) ==== @@ -1,6 +1,9 @@ /* $FreeBSD: src/sys/fs/msdosfs/bpb.h,v 1.15 2007/01/05 05:28:57 rodrigc Exp $ */ /* $NetBSD: bpb.h,v 1.7 1997/11/17 15:36:24 ws Exp $ */ +#ifndef _FS_MSDOSFS_BPB_H +#define _FS_MSDOSFS_BPB_H + /*- * Written by Paul Popelka (paulp@uts.amdahl.com) * @@ -78,7 +81,7 @@ u_int32_t bpbRootClust; /* start cluster for root directory */ u_int16_t bpbFSInfo; /* filesystem info structure sector */ u_int16_t bpbBackup; /* backup boot sector */ - /* There is a 12 byte filler here, but we ignore it */ + u_int8_t bpbReserved[12]; /* 12 byte filler here */ }; /* @@ -153,7 +156,7 @@ u_int8_t bpbRootClust[4]; /* start cluster for root directory */ u_int8_t bpbFSInfo[2]; /* filesystem info structure sector */ u_int8_t bpbBackup[2]; /* backup boot sector */ - /* There is a 12 byte filler here, but we ignore it */ + u_int8_t bpbReserved[12]; /* 12 byte filler here */ }; /* @@ -170,3 +173,6 @@ u_int8_t fsifill3[508]; u_int8_t fsisig4[4]; }; + +#endif +// _FS_MSDOSFS_BPB_H ==== //depot/projects/soc2007/chub-msdosfs2/sys/fs/msdosfs/msdosfs_vfsops.c#2 (text+ko) ==== @@ -430,9 +430,9 @@ goto error_exit; bp->b_flags |= B_AGE; bsp = (union bootsector *)bp->b_data; - b33 = (struct byte_bpb33 *)bsp->bs33.bsBPB; - b50 = (struct byte_bpb50 *)bsp->bs50.bsBPB; - b710 = (struct byte_bpb710 *)bsp->bs710.bsBPB; + b33 = (struct byte_bpb33 *)&bsp->bs33.bsBPB; + b50 = (struct byte_bpb50 *)&bsp->bs50.bsBPB; + b710 = (struct byte_bpb710 *)&bsp->bs710.bsBPB; #ifndef MSDOSFS_NOCHECKSIG if (bsp->bs50.bsBootSectSig0 != BOOTSIG0 @@ -487,7 +487,6 @@ /* XXX - We should probably check more values here */ if (!pmp->pm_BytesPerSec || !SecPerClust - || !pmp->pm_Heads #ifdef PC98 || !pmp->pm_SecPerTrack || pmp->pm_SecPerTrack > 255) { #else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707080801.l6881rI8048534>