FreeBSD Bugzilla – Attachment 5433 Details for
Bug 12992
sector size independent patch for msdosfs(640MB MO,etc)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 5.30 KB, created by
chi
on 1999-08-05 23:50:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
chi
Created:
1999-08-05 23:50:00 UTC
Size:
5.30 KB
patch
obsolete
>diff -ru /sys/msdosfs/msdosfs_fat.c msdosfs_fat.c >--- /sys/msdosfs/msdosfs_fat.c Thu Apr 16 02:46:42 1998 >+++ msdosfs_fat.c Wed Jul 28 17:14:11 1999 >@@ -113,7 +113,7 @@ > bn += pmp->pm_fatblk + pmp->pm_curfat * pmp->pm_FATsecs; > > if (bnp) >- *bnp = bn; >+ *bnp = bn * pmp->pm_SecBlkRatio; > if (sizep) > *sizep = size; > if (bop) >@@ -182,7 +182,8 @@ > return (E2BIG); > } > if (bnp) >- *bnp = pmp->pm_rootdirblk + de_cn2bn(pmp, findcn); >+ *bnp = (pmp->pm_rootdirblk + de_cn2bn(pmp, >+ findcn)) * pmp->pm_SecBlkRatio; > if (cnp) > *cnp = MSDOSFSROOT; > if (sp) >@@ -364,7 +365,8 @@ > + ffs(pmp->pm_inusemap[cn / N_INUSEBITS] > ^ (u_int)-1) - 1; > } >- if (bread(pmp->pm_devvp, pmp->pm_fsinfo, 1024, NOCRED, &bpn) != 0) { >+ if (bread(pmp->pm_devvp, pmp->pm_fsinfo * pmp->pm_SecBlkRatio, >+ fsi_size(pmp->pm_SecBlkRatio), NOCRED, &bpn) != 0) { > /* > * Ignore the error, but turn off FSInfo update for the future. > */ >@@ -394,7 +396,7 @@ > * bwrite()'s and really slow things down. > */ > for (i = 1; i < pmp->pm_FATs; i++) { >- fatbn += pmp->pm_FATsecs; >+ fatbn += (pmp->pm_FATsecs * pmp->pm_SecBlkRatio); > /* getblk() never fails */ > bpn = getblk(pmp->pm_devvp, fatbn, bp->b_bcount, 0, 0); > bcopy(bp->b_data, bpn->b_data, bp->b_bcount); >diff -ru /sys/msdosfs/msdosfs_vfsops.c msdosfs_vfsops.c >--- /sys/msdosfs/msdosfs_vfsops.c Wed Apr 21 07:43:34 1999 >+++ msdosfs_vfsops.c Wed Jul 28 17:14:12 1999 >@@ -69,6 +69,17 @@ > #include <msdosfs/msdosfsmount.h> > #include <msdosfs/fat.h> > >+#ifdef PC98 >+/* >+ * XXX - The boot signature formatted by NEC PC-98 DOS looks like a >+ * garbage or a random value :-{ >+ * If you want to use that broken-signatured media, define the >+ * following symbol even though PC/AT. >+ * (ex. mount PC-98 DOS formatted FD on PC/AT) >+ */ >+#define MSDOSFS_NOCHECKSIG >+#endif >+ > MALLOC_DEFINE(M_MSDOSFSMNT, "MSDOSFS mount", "MSDOSFS mount structure"); > static MALLOC_DEFINE(M_MSDOSFSFAT, "MSDOSFS FAT", "MSDOSFS file allocation table"); > >@@ -428,12 +439,10 @@ > /* > * Read the boot sector of the filesystem, and then check the > * boot signature. If not a dos boot sector then error out. >+ * >+ * NOTE: 2048 is a maximum sector size in current... > */ >-#ifdef PC98 >- error = bread(devvp, 0, 1024, NOCRED, &bp); >-#else >- error = bread(devvp, 0, 512, NOCRED, &bp); >-#endif >+ error = bread(devvp, 0, 2048, NOCRED, &bp); > if (error) > goto error_exit; > bp->b_flags |= B_AGE; >@@ -445,22 +454,13 @@ > #ifndef __FreeBSD__ > if (!(argp->flags & MSDOSFSMNT_GEMDOSFS)) { > #endif >-#ifdef PC98 >- if ((bsp->bs50.bsBootSectSig0 != BOOTSIG0 >- || bsp->bs50.bsBootSectSig1 != BOOTSIG1) >- && (bsp->bs50.bsBootSectSig0 != 0 /* PC98 DOS 3.3x */ >- || bsp->bs50.bsBootSectSig1 != 0) >- && (bsp->bs50.bsBootSectSig0 != 0x90 /* PC98 DOS 5.0 */ >- || bsp->bs50.bsBootSectSig1 != 0x3d) >- && (bsp->bs50.bsBootSectSig0 != 0x46 /* PC98 DOS 3.3B */ >- || bsp->bs50.bsBootSectSig1 != 0xfa)) { >-#else >+#ifndef MSDOSFS_NOCHECKSIG > if (bsp->bs50.bsBootSectSig0 != BOOTSIG0 > || bsp->bs50.bsBootSectSig1 != BOOTSIG1) { >-#endif > error = EINVAL; > goto error_exit; > } >+#endif > #ifndef __FreeBSD__ > } > #endif >@@ -485,6 +485,9 @@ > pmp->pm_Heads = getushort(b50->bpbHeads); > pmp->pm_Media = b50->bpbMedia; > >+ /* calculate the ratio of sector size to DEV_BSIZE */ >+ pmp->pm_SecBlkRatio = pmp->pm_BytesPerSec / DEV_BSIZE; >+ > #ifndef __FreeBSD__ > if (!(argp->flags & MSDOSFSMNT_GEMDOSFS)) { > #endif >@@ -676,7 +679,9 @@ > if (pmp->pm_fsinfo) { > struct fsinfo *fp; > >- if ((error = bread(devvp, pmp->pm_fsinfo, 1024, NOCRED, &bp)) != 0) >+ if ((error = bread(devvp, pmp->pm_fsinfo * pmp->pm_SecBlkRatio, >+ fsi_size(pmp->pm_SecBlkRatio), >+ NOCRED, &bp)) != 0) > goto error_exit; > fp = (struct fsinfo *)bp->b_data; > if (!bcmp(fp->fsisig1, "RRaA", 4) >diff -ru /sys/msdosfs/msdosfsmount.h msdosfsmount.h >--- /sys/msdosfs/msdosfsmount.h Tue Feb 24 01:44:37 1998 >+++ msdosfsmount.h Wed Jul 28 17:14:12 1999 >@@ -68,6 +68,7 @@ > mode_t pm_mask; /* mask to and with file protection bits */ > struct vnode *pm_devvp; /* vnode for block device mntd */ > struct bpb50 pm_bpb; /* BIOS parameter blk for this fs */ >+ int pm_SecBlkRatio; /* How many DEV_BSIZE blocks fit inside a physical sector */ > u_long pm_FATsecs; /* actual number of fat sectors */ > u_long pm_fatblk; /* block # of first FAT */ > u_long pm_rootdirblk; /* block # (cluster # for FAT32) of root directory number */ >@@ -174,13 +175,15 @@ > * Map a cluster number into a filesystem relative block number. > */ > #define cntobn(pmp, cn) \ >- (de_cn2bn((pmp), (cn)-CLUST_FIRST) + (pmp)->pm_firstcluster) >+ ((de_cn2bn((pmp), (cn)-CLUST_FIRST) + (pmp)->pm_firstcluster) \ >+ * (pmp)->pm_SecBlkRatio) > > /* > * Calculate block number for directory entry in root dir, offset dirofs > */ > #define roottobn(pmp, dirofs) \ >- (de_blk((pmp), (dirofs)) + (pmp)->pm_rootdirblk) >+ ((de_blk((pmp), (dirofs)) + (pmp)->pm_rootdirblk) \ >+ * (pmp)->pm_SecBlkRatio) > > /* > * Calculate block number for directory entry at cluster dirclu, offset >@@ -190,6 +193,12 @@ > ((dirclu) == MSDOSFSROOT \ > ? roottobn((pmp), (dirofs)) \ > : cntobn((pmp), (dirclu))) >+ >+/* >+ * Calculate fsinfo block size >+ */ >+#define fsi_size(sbr) \ >+ (1024 << ((sbr) >> 2)) > > int msdosfs_init __P((struct vfsconf *vfsp)); > int msdosfs_mountroot __P((void));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 12992
: 5433