summaryrefslogtreecommitdiff
path: root/sys/msdosfs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/msdosfs')
-rw-r--r--sys/msdosfs/bootsect.h18
-rw-r--r--sys/msdosfs/bpb.h24
-rw-r--r--sys/msdosfs/fat.h7
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c99
-rw-r--r--sys/msdosfs/msdosfsmount.h5
5 files changed, 10 insertions, 143 deletions
diff --git a/sys/msdosfs/bootsect.h b/sys/msdosfs/bootsect.h
index 806062ee95e..56cde30376d 100644
--- a/sys/msdosfs/bootsect.h
+++ b/sys/msdosfs/bootsect.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootsect.h,v 1.4 2000/11/10 15:33:10 provos Exp $ */
+/* $OpenBSD: bootsect.h,v 1.5 2006/12/15 03:04:24 krw Exp $ */
/* $NetBSD: bootsect.h,v 1.8 1997/10/17 11:23:29 ws Exp $ */
/*
@@ -71,22 +71,6 @@ struct bootsector710 {
#define BOOTSIG2 0
#define BOOTSIG3 0
};
-#ifdef atari
-/*
- * The boot sector on a gemdos fs is a little bit different from the msdos fs
- * format. Currently there is no need to declare a separate structure, the
- * bootsector33 struct will do.
- */
-#if 0
-struct bootsec_atari {
- u_int8_t bsBranch[2]; /* branch inst if auto-boot */
- int8_t bsFiller[6]; /* anything or nothing */
- int8_t bsSerial[3]; /* serial no. for mediachange */
- int8_t bsBPB[19]; /* BIOS parameter block */
- int8_t bsBootCode[482]; /* pad so struct is 512b */
-};
-#endif
-#endif /* atari */
union bootsector {
struct bootsector33 bs33;
diff --git a/sys/msdosfs/bpb.h b/sys/msdosfs/bpb.h
index 0817efb91c5..d9550a1b40c 100644
--- a/sys/msdosfs/bpb.h
+++ b/sys/msdosfs/bpb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpb.h,v 1.4 2005/09/28 20:53:56 miod Exp $ */
+/* $OpenBSD: bpb.h,v 1.5 2006/12/15 03:04:24 krw Exp $ */
/* $NetBSD: bpb.h,v 1.6 1997/10/17 11:23:35 ws Exp $ */
/*
@@ -81,28 +81,6 @@ struct bpb710 {
/* There is a 12 byte filler here, but we ignore it */
};
-#ifdef atari
-/*
- * BPB for gemdos filesystems. Atari leaves the obsolete stuff undefined.
- * Currently there is no need for a separate BPB structure.
- */
-#if 0
-struct bpb_a {
- u_int16_t bpbBytesPerSec; /* bytes per sector */
- u_int8_t bpbSecPerClust; /* sectors per cluster */
- u_int16_t bpbResSectors; /* number of reserved sectors */
- u_int8_t bpbFATs; /* number of FATs */
- u_int16_t bpbRootDirEnts; /* number of root directory entries */
- u_int16_t bpbSectors; /* total number of sectors */
- u_int8_t bpbUseless1; /* meaningless on gemdos fs */
- u_int16_t bpbFATsecs; /* number of sectors per FAT */
- u_int16_t bpbUseless2; /* meaningless for harddisk fs */
- u_int16_t bpbUseless3; /* meaningless for harddisk fs */
- u_int16_t bpbHiddenSecs; /* the TOS-BIOS ignores this */
-};
-#endif
-#endif /* atari */
-
/*
* The following structures represent how the bpb's look on disk. shorts
* and longs are just character arrays of the appropriate length. This is
diff --git a/sys/msdosfs/fat.h b/sys/msdosfs/fat.h
index 48d45bf0184..661736e0d82 100644
--- a/sys/msdosfs/fat.h
+++ b/sys/msdosfs/fat.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fat.h,v 1.8 2006/10/03 19:49:06 pedro Exp $ */
+/* $OpenBSD: fat.h,v 1.9 2006/12/15 03:04:24 krw Exp $ */
/* $NetBSD: fat.h,v 1.11 1997/10/17 11:23:49 ws Exp $ */
/*-
@@ -71,11 +71,6 @@
* 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
- * and store the result in the pm_fatentrysize. Note that this kind of
- * detection gets flakey when mounting a vnd-device.
*/
#define FAT12(pmp) (pmp->pm_fatmask == FAT12_MASK)
#define FAT16(pmp) (pmp->pm_fatmask == FAT16_MASK)
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 4f312c02827..e64bbe7ba28 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vfsops.c,v 1.44 2006/12/14 10:55:03 tom Exp $ */
+/* $OpenBSD: msdosfs_vfsops.c,v 1.45 2006/12/15 03:04:24 krw Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */
/*-
@@ -214,12 +214,6 @@ msdosfs_mount(mp, path, data, ndp, p)
pmp->pm_mask = args.mask;
pmp->pm_flags |= args.flags & MSDOSFSMNT_MNTOPT;
- /*
- * GEMDOS knows nothing (yet) about win95
- */
- if (pmp->pm_flags & MSDOSFSMNT_GEMDOSFS)
- pmp->pm_flags |= MSDOSFSMNT_NOWIN95;
-
if (pmp->pm_flags & MSDOSFSMNT_NOWIN95)
pmp->pm_flags |= MSDOSFSMNT_SHORTNAME;
else if (!(pmp->pm_flags & (MSDOSFSMNT_SHORTNAME | MSDOSFSMNT_LONGNAME))) {
@@ -263,7 +257,6 @@ msdosfs_mountfs(devvp, mp, p, argp)
struct msdosfsmount *pmp;
struct buf *bp;
dev_t dev = devvp->v_rdev;
- struct partinfo dpart;
union bootsector *bsp;
struct byte_bpb33 *b33;
struct byte_bpb50 *b50;
@@ -271,7 +264,6 @@ msdosfs_mountfs(devvp, mp, p, argp)
extern struct vnode *rootvp;
u_int8_t SecPerClust;
int ronly, error, bmapsiz;
- int bsize = 0, dtype = 0, tmp;
uint32_t fat_max_clusters;
/*
@@ -298,30 +290,6 @@ msdosfs_mountfs(devvp, mp, p, argp)
bp = NULL; /* both used in error_exit */
pmp = NULL;
- if (argp->flags & MSDOSFSMNT_GEMDOSFS) {
- /*
- * We need the disklabel to calculate the size of a FAT entry
- * later on. Also make sure the partition contains a filesystem
- * of type FS_MSDOS. This doesn't work for floppies, so we have
- * to check for them too.
- *
- * At least some parts of the msdos fs driver seem to assume
- * that the size of a disk block will always be 512 bytes.
- * Let's check it...
- */
- error = VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart,
- FREAD, NOCRED, p);
- if (error)
- goto error_exit;
- tmp = dpart.part->p_fstype;
- dtype = dpart.disklab->d_type;
- bsize = dpart.disklab->d_secsize;
- if (bsize != 512 || (dtype!=DTYPE_FLOPPY && tmp!=FS_MSDOS)) {
- error = EFTYPE;
- goto error_exit;
- }
- }
-
/*
* Read the boot sector of the filesystem, and then check the
* boot signature. If not a dos boot sector then error out.
@@ -354,12 +322,9 @@ msdosfs_mountfs(devvp, mp, p, argp)
pmp->pm_Heads = getushort(b50->bpbHeads);
pmp->pm_Media = b50->bpbMedia;
- if (!(argp->flags & MSDOSFSMNT_GEMDOSFS)) {
- if (!pmp->pm_BytesPerSec || !SecPerClust
- || pmp->pm_SecPerTrack > 63) {
- error = EFTYPE;
- goto error_exit;
- }
+ if (!pmp->pm_BytesPerSec || !SecPerClust || pmp->pm_SecPerTrack > 63) {
+ error = EFTYPE;
+ goto error_exit;
}
if (pmp->pm_Sectors == 0) {
@@ -387,47 +352,6 @@ msdosfs_mountfs(devvp, mp, p, argp)
} else
pmp->pm_flags |= MSDOSFS_FATMIRROR;
- if (argp->flags & MSDOSFSMNT_GEMDOSFS) {
- if (FAT32(pmp)) {
- /*
- * GEMDOS doesn't know fat32.
- */
- error = EINVAL;
- goto error_exit;
- }
-
- /*
- * Check a few values (could do some more):
- * - logical sector size: power of 2, >= block size
- * - sectors per cluster: power of 2, >= 1
- * - number of sectors: >= 1, <= size of partition
- */
- if ( (SecPerClust == 0)
- || (SecPerClust & (SecPerClust - 1))
- || (pmp->pm_BytesPerSec < bsize)
- || (pmp->pm_BytesPerSec & (pmp->pm_BytesPerSec - 1))
- || (pmp->pm_HugeSectors == 0)
- || (pmp->pm_HugeSectors * (pmp->pm_BytesPerSec / bsize)
- > dpart.part->p_size)
- ) {
- error = EFTYPE;
- goto error_exit;
- }
- /*
- * XXX - Many parts of the msdos fs driver seem to assume that
- * the number of bytes per logical sector (BytesPerSec) will
- * always be the same as the number of bytes per disk block
- * Let's pretend it is.
- */
- tmp = pmp->pm_BytesPerSec / bsize;
- pmp->pm_BytesPerSec = bsize;
- pmp->pm_HugeSectors *= tmp;
- pmp->pm_HiddenSects *= tmp;
- pmp->pm_ResSectors *= tmp;
- pmp->pm_Sectors *= tmp;
- pmp->pm_FATsecs *= tmp;
- SecPerClust *= tmp;
- }
pmp->pm_fatblk = pmp->pm_ResSectors;
if (FAT32(pmp)) {
pmp->pm_rootdirblk = getulong(b710->bpbRootClust);
@@ -448,20 +372,7 @@ msdosfs_mountfs(devvp, mp, p, argp)
pmp->pm_maxcluster = pmp->pm_nmbrofclusters + 1;
pmp->pm_fatsize = pmp->pm_FATsecs * pmp->pm_BytesPerSec;
- if (argp->flags & MSDOSFSMNT_GEMDOSFS) {
- if ((pmp->pm_nmbrofclusters <= (0xff0 - 2))
- && ((dtype == DTYPE_FLOPPY) || ((dtype == DTYPE_VNODE)
- && ((pmp->pm_Heads == 1) || (pmp->pm_Heads == 2))))
- ) {
- pmp->pm_fatmask = FAT12_MASK;
- pmp->pm_fatmult = 3;
- pmp->pm_fatdiv = 2;
- } else {
- pmp->pm_fatmask = FAT16_MASK;
- pmp->pm_fatmult = 2;
- pmp->pm_fatdiv = 1;
- }
- } else if (pmp->pm_fatmask == 0) {
+ if (pmp->pm_fatmask == 0) {
if (pmp->pm_maxcluster
<= ((CLUST_RSRVD - CLUST_FIRST) & FAT12_MASK)) {
/*
diff --git a/sys/msdosfs/msdosfsmount.h b/sys/msdosfs/msdosfsmount.h
index 3b44d747981..56f2cd971ff 100644
--- a/sys/msdosfs/msdosfsmount.h
+++ b/sys/msdosfs/msdosfsmount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfsmount.h,v 1.16 2004/05/14 04:05:05 tedu Exp $ */
+/* $OpenBSD: msdosfsmount.h,v 1.17 2006/12/15 03:04:24 krw Exp $ */
/* $NetBSD: msdosfsmount.h,v 1.16 1997/10/17 11:24:24 ws Exp $ */
/*-
@@ -96,14 +96,13 @@ struct msdosfsmount {
#define MSDOSFSMNT_SHORTNAME 0x01
#define MSDOSFSMNT_LONGNAME 0x02
#define MSDOSFSMNT_NOWIN95 0x04
-#define MSDOSFSMNT_GEMDOSFS 0x08
#define MSDOSFSMNT_ALLOWDIRX 0x10
#endif
/* All flags above: */
#define MSDOSFSMNT_MNTOPT \
(MSDOSFSMNT_SHORTNAME|MSDOSFSMNT_LONGNAME|MSDOSFSMNT_NOWIN95 \
- |MSDOSFSMNT_GEMDOSFS|MSDOSFSMNT_ALLOWDIRX)
+ |MSDOSFSMNT_ALLOWDIRX)
#define MSDOSFSMNT_RONLY 0x80000000 /* mounted read-only */
#define MSDOSFSMNT_WAITONFAT 0x40000000 /* mounted synchronous */
#define MSDOSFS_FATMIRROR 0x20000000 /* FAT is mirrored */