|
Lines 69-74
Link Here
|
| 69 |
#include <msdosfs/msdosfsmount.h> |
69 |
#include <msdosfs/msdosfsmount.h> |
| 70 |
#include <msdosfs/fat.h> |
70 |
#include <msdosfs/fat.h> |
| 71 |
|
71 |
|
|
|
72 |
#ifdef PC98 |
| 73 |
/* |
| 74 |
* XXX - The boot signature formatted by NEC PC-98 DOS looks like a |
| 75 |
* garbage or a random value :-{ |
| 76 |
* If you want to use that broken-signatured media, define the |
| 77 |
* following symbol even though PC/AT. |
| 78 |
* (ex. mount PC-98 DOS formatted FD on PC/AT) |
| 79 |
*/ |
| 80 |
#define MSDOSFS_NOCHECKSIG |
| 81 |
#endif |
| 82 |
|
| 72 |
MALLOC_DEFINE(M_MSDOSFSMNT, "MSDOSFS mount", "MSDOSFS mount structure"); |
83 |
MALLOC_DEFINE(M_MSDOSFSMNT, "MSDOSFS mount", "MSDOSFS mount structure"); |
| 73 |
static MALLOC_DEFINE(M_MSDOSFSFAT, "MSDOSFS FAT", "MSDOSFS file allocation table"); |
84 |
static MALLOC_DEFINE(M_MSDOSFSFAT, "MSDOSFS FAT", "MSDOSFS file allocation table"); |
| 74 |
|
85 |
|
|
Lines 428-439
Link Here
|
| 428 |
/* |
439 |
/* |
| 429 |
* Read the boot sector of the filesystem, and then check the |
440 |
* Read the boot sector of the filesystem, and then check the |
| 430 |
* boot signature. If not a dos boot sector then error out. |
441 |
* boot signature. If not a dos boot sector then error out. |
|
|
442 |
* |
| 443 |
* NOTE: 2048 is a maximum sector size in current... |
| 431 |
*/ |
444 |
*/ |
| 432 |
#ifdef PC98 |
445 |
error = bread(devvp, 0, 2048, NOCRED, &bp); |
| 433 |
error = bread(devvp, 0, 1024, NOCRED, &bp); |
|
|
| 434 |
#else |
| 435 |
error = bread(devvp, 0, 512, NOCRED, &bp); |
| 436 |
#endif |
| 437 |
if (error) |
446 |
if (error) |
| 438 |
goto error_exit; |
447 |
goto error_exit; |
| 439 |
bp->b_flags |= B_AGE; |
448 |
bp->b_flags |= B_AGE; |
|
Lines 445-466
Link Here
|
| 445 |
#ifndef __FreeBSD__ |
454 |
#ifndef __FreeBSD__ |
| 446 |
if (!(argp->flags & MSDOSFSMNT_GEMDOSFS)) { |
455 |
if (!(argp->flags & MSDOSFSMNT_GEMDOSFS)) { |
| 447 |
#endif |
456 |
#endif |
| 448 |
#ifdef PC98 |
457 |
#ifndef MSDOSFS_NOCHECKSIG |
| 449 |
if ((bsp->bs50.bsBootSectSig0 != BOOTSIG0 |
|
|
| 450 |
|| bsp->bs50.bsBootSectSig1 != BOOTSIG1) |
| 451 |
&& (bsp->bs50.bsBootSectSig0 != 0 /* PC98 DOS 3.3x */ |
| 452 |
|| bsp->bs50.bsBootSectSig1 != 0) |
| 453 |
&& (bsp->bs50.bsBootSectSig0 != 0x90 /* PC98 DOS 5.0 */ |
| 454 |
|| bsp->bs50.bsBootSectSig1 != 0x3d) |
| 455 |
&& (bsp->bs50.bsBootSectSig0 != 0x46 /* PC98 DOS 3.3B */ |
| 456 |
|| bsp->bs50.bsBootSectSig1 != 0xfa)) { |
| 457 |
#else |
| 458 |
if (bsp->bs50.bsBootSectSig0 != BOOTSIG0 |
458 |
if (bsp->bs50.bsBootSectSig0 != BOOTSIG0 |
| 459 |
|| bsp->bs50.bsBootSectSig1 != BOOTSIG1) { |
459 |
|| bsp->bs50.bsBootSectSig1 != BOOTSIG1) { |
| 460 |
#endif |
|
|
| 461 |
error = EINVAL; |
460 |
error = EINVAL; |
| 462 |
goto error_exit; |
461 |
goto error_exit; |
| 463 |
} |
462 |
} |
|
|
463 |
#endif |
| 464 |
#ifndef __FreeBSD__ |
464 |
#ifndef __FreeBSD__ |
| 465 |
} |
465 |
} |
| 466 |
#endif |
466 |
#endif |
|
Lines 485-490
Link Here
|
| 485 |
pmp->pm_Heads = getushort(b50->bpbHeads); |
485 |
pmp->pm_Heads = getushort(b50->bpbHeads); |
| 486 |
pmp->pm_Media = b50->bpbMedia; |
486 |
pmp->pm_Media = b50->bpbMedia; |
| 487 |
|
487 |
|
|
|
488 |
/* calculate the ratio of sector size to DEV_BSIZE */ |
| 489 |
pmp->pm_SecBlkRatio = pmp->pm_BytesPerSec / DEV_BSIZE; |
| 490 |
|
| 488 |
#ifndef __FreeBSD__ |
491 |
#ifndef __FreeBSD__ |
| 489 |
if (!(argp->flags & MSDOSFSMNT_GEMDOSFS)) { |
492 |
if (!(argp->flags & MSDOSFSMNT_GEMDOSFS)) { |
| 490 |
#endif |
493 |
#endif |
|
Lines 676-682
Link Here
|
| 676 |
if (pmp->pm_fsinfo) { |
679 |
if (pmp->pm_fsinfo) { |
| 677 |
struct fsinfo *fp; |
680 |
struct fsinfo *fp; |
| 678 |
|
681 |
|
| 679 |
if ((error = bread(devvp, pmp->pm_fsinfo, 1024, NOCRED, &bp)) != 0) |
682 |
if ((error = bread(devvp, pmp->pm_fsinfo * pmp->pm_SecBlkRatio, |
|
|
683 |
fsi_size(pmp->pm_SecBlkRatio), |
| 684 |
NOCRED, &bp)) != 0) |
| 680 |
goto error_exit; |
685 |
goto error_exit; |
| 681 |
fp = (struct fsinfo *)bp->b_data; |
686 |
fp = (struct fsinfo *)bp->b_data; |
| 682 |
if (!bcmp(fp->fsisig1, "RRaA", 4) |
687 |
if (!bcmp(fp->fsisig1, "RRaA", 4) |