From e4d11a85a44f270b69988bc8c0f3e7b60811fbd8 Mon Sep 17 00:00:00 2001 From: dillon Date: Tue, 15 May 2007 17:51:04 +0000 Subject: [PATCH] Continue untangling the disklabel. Reorganize struct partinfo and the DIOCGPART ioctl to extract the required information directly, and fix the DIOCGPART ioctl direction so userland can use it. This removes numerous disklabel references, particularly from the filesystem code which was doing silly indirections just to figure out the sector size. NOTE: The absolute byte offset of the slice or partition (relative to the base of the raw disk) is also made available, but is not currently used by the kernel. --- sys/dev/disk/ata/atapi-cd.c | 16 +++++++++++++--- sys/dev/disk/ccd/ccd.c | 36 ++++++++++++++++++++++++------------ sys/dev/disk/mcd/mcd.c | 27 +++++++++++++++++---------- sys/dev/disk/scd/scd.c | 18 +++++++++++++----- sys/dev/raid/vinum/vinumio.c | 11 ++++++----- sys/dev/raid/vinum/vinumioctl.c | 20 +++++++++++--------- sys/dev/raid/vinum/vinumvar.h | 3 +-- sys/kern/subr_diskslice.c | 28 ++++++++++++++++++++++------ sys/sys/disklabel.h | 23 ++++++++++++++++------- sys/sys/disklabel32.h | 23 ++++++++++++++++------- sys/sys/ndisklabel.h | 12 ++++++------ sys/vfs/gnu/ext2fs/ext2_vfsops.c | 10 ++++------ sys/vfs/msdosfs/msdosfs_vfsops.c | 31 +------------------------------ sys/vfs/ufs/ffs_vfsops.c | 6 +++--- 14 files changed, 153 insertions(+), 111 deletions(-) diff --git a/sys/dev/disk/ata/atapi-cd.c b/sys/dev/disk/ata/atapi-cd.c index 767a8f04a6..45cefbebf4 100644 --- a/sys/dev/disk/ata/atapi-cd.c +++ b/sys/dev/disk/ata/atapi-cd.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-cd.c,v 1.48.2.20 2002/11/25 05:30:31 njl Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-cd.c,v 1.30 2007/05/14 20:02:44 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-cd.c,v 1.31 2007/05/15 17:50:51 dillon Exp $ */ #include "opt_ata.h" @@ -1069,8 +1069,18 @@ acdioctl(struct dev_ioctl_args *ap) break; case DIOCGPART: - ((struct partinfo *)ap->a_data)->disklab = &cdp->disklabel; - ((struct partinfo *)ap->a_data)->part = &cdp->disklabel.d_partitions[0]; + { + struct partinfo *dpart = (void *)ap->a_data; + + bzero(dpart, sizeof(*dpart)); + dpart->media_offset = 0; + dpart->media_size = (u_int64_t)cdp->disk_size * cdp->block_size; + dpart->media_blocks = cdp->disk_size; + dpart->media_blksize = cdp->block_size; + dpart->fstype = FS_BSDFFS; + ksnprintf(dpart->fstypestr, sizeof(dpart->fstypestr), + "4.2BSD"); + } break; default: diff --git a/sys/dev/disk/ccd/ccd.c b/sys/dev/disk/ccd/ccd.c index 9b94e136a7..e5fa482364 100644 --- a/sys/dev/disk/ccd/ccd.c +++ b/sys/dev/disk/ccd/ccd.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/ccd/ccd.c,v 1.73.2.1 2001/09/11 09:49:52 kris Exp $ */ -/* $DragonFly: src/sys/dev/disk/ccd/ccd.c,v 1.39 2007/05/06 19:23:21 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/ccd/ccd.c,v 1.40 2007/05/15 17:50:52 dillon Exp $ */ /* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ @@ -397,8 +397,8 @@ ccdinit(struct ccddevice *ccd, char **cpaths, struct ucred *cred) /* * Get partition information for the component. */ - if ((error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart, - FREAD, cred)) != 0) { + error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart, FREAD, cred); + if (error) { #ifdef DEBUG if (ccddebug & (CCDB_FOLLOW|CCDB_INIT)) kprintf("ccd%d: %s: ioctl failed, error = %d\n", @@ -406,11 +406,11 @@ ccdinit(struct ccddevice *ccd, char **cpaths, struct ucred *cred) #endif goto fail; } - if (dpart.part->p_fstype == FS_BSDFFS) { - maxsecsize = - ((dpart.disklab->d_secsize > maxsecsize) ? - dpart.disklab->d_secsize : maxsecsize); - size = dpart.part->p_size - CCD_OFFSET; + if (dpart.fstype == FS_BSDFFS || + strcmp(dpart.fstypestr, "4.2BSD") == 0) { + if (maxsecsize < dpart.media_blksize) + maxsecsize = dpart.media_blksize; + size = dpart.media_blocks - CCD_OFFSET; } else { #ifdef DEBUG if (ccddebug & (CCDB_FOLLOW|CCDB_INIT)) @@ -1459,10 +1459,22 @@ ccdioctl(struct dev_ioctl_args *ap) case DIOCGPART: if ((cs->sc_flags & CCDF_INITED) == 0) return (ENXIO); - - ((struct partinfo *)ap->a_data)->disklab = &cs->sc_label; - ((struct partinfo *)ap->a_data)->part = - &cs->sc_label.d_partitions[ccdpart(dev)]; + { + struct partinfo *dpart; + struct partition *part; + + part = &cs->sc_label.d_partitions[ccdpart(dev)]; + dpart = (void *)ap->a_data; + + bzero(dpart, sizeof(*dpart)); + dpart->media_offset = (u_int64_t)part->p_offset * + cs->sc_geom.ccg_secsize; + dpart->media_size = (u_int64_t)part->p_size * + cs->sc_geom.ccg_secsize; + dpart->media_blocks = part->p_size; + dpart->media_blksize = cs->sc_geom.ccg_secsize; + dpart->fstype = part->p_fstype; + } break; case DIOCWDINFO: diff --git a/sys/dev/disk/mcd/mcd.c b/sys/dev/disk/mcd/mcd.c index d96f1fcdd7..94879abde5 100644 --- a/sys/dev/disk/mcd/mcd.c +++ b/sys/dev/disk/mcd/mcd.c @@ -41,7 +41,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/isa/mcd.c,v 1.115 2000/01/29 16:17:34 peter Exp $ - * $DragonFly: src/sys/dev/disk/mcd/Attic/mcd.c,v 1.22 2007/05/14 20:02:44 dillon Exp $ + * $DragonFly: src/sys/dev/disk/mcd/Attic/mcd.c,v 1.23 2007/05/15 17:50:53 dillon Exp $ */ static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; @@ -588,9 +588,17 @@ MCD_TRACE("ioctl called 0x%lx\n", ap->a_cmd); *(struct disklabel *) addr = cd->dlabel; return 0; case DIOCGPART: - ((struct partinfo *) addr)->disklab = &cd->dlabel; - ((struct partinfo *) addr)->part = - &cd->dlabel.d_partitions[mcd_part(dev)]; + { + struct partinfo *dpart = (void *)addr; + + bzero(dpart, sizeof(*dpart)); + dpart->media_offset = 0; + dpart->media_size = (u_int64_t)cd->disksize * + cd->blksize; + dpart->media_blocks = cd->disksize; + dpart->media_blksize = cd->blksize; + dpart->fstype = FS_BSDFFS; + } return 0; /* @@ -599,13 +607,12 @@ MCD_TRACE("ioctl called 0x%lx\n", ap->a_cmd); */ case DIOCWDINFO: case DIOCSDINFO: - if ((ap->a_fflag & FWRITE) == 0) + if ((ap->a_fflag & FWRITE) == 0) { return EBADF; - else { - return setdisklabel(&cd->dlabel, - (struct disklabel *) addr, - 0); + } else { + return setdisklabel(&cd->dlabel, (void *)addr, 0); } + /* NOT REACHED */ case DIOCWLABEL: return EBADF; case CDIOCPLAYTRACKS: @@ -666,7 +673,7 @@ static int mcd_getdisklabel(int unit) cd->dlabel.d_npartitions= 1; cd->dlabel.d_partitions[0].p_offset = 0; cd->dlabel.d_partitions[0].p_size = cd->disksize; - cd->dlabel.d_partitions[0].p_fstype = 9; + cd->dlabel.d_partitions[0].p_fstype = FS_BSDFFS; cd->dlabel.d_magic = DISKMAGIC; cd->dlabel.d_magic2 = DISKMAGIC; cd->dlabel.d_checksum = dkcksum(&cd->dlabel); diff --git a/sys/dev/disk/scd/scd.c b/sys/dev/disk/scd/scd.c index ba87a4a065..46e02351e6 100644 --- a/sys/dev/disk/scd/scd.c +++ b/sys/dev/disk/scd/scd.c @@ -42,7 +42,7 @@ /* $FreeBSD: src/sys/i386/isa/scd.c,v 1.54 2000/01/29 16:00:30 peter Exp $ */ -/* $DragonFly: src/sys/dev/disk/scd/Attic/scd.c,v 1.21 2007/05/14 20:02:44 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/scd/Attic/scd.c,v 1.22 2007/05/15 17:50:54 dillon Exp $ */ /* Please send any comments to micke@dynas.se */ @@ -435,9 +435,17 @@ scdioctl(struct dev_ioctl_args *ap) *(struct disklabel *)addr = cd->dlabel; return 0; case DIOCGPART: - ((struct partinfo *)addr)->disklab = &cd->dlabel; - ((struct partinfo *)addr)->part = - &cd->dlabel.d_partitions[0]; + { + struct partinfo *dpart = (void *)addr; + + bzero(dpart, sizeof(*dpart)); + dpart->media_offset = 0; + dpart->media_size = (u_int64_t)cd->disksize * + cd->blksize; + dpart->media_blocks = cd->disksize; + dpart->media_blksize = cd->blksize; + dpart->fstype = FS_BSDFFS; + } return 0; case CDIOCPLAYTRACKS: return scd_playtracks(unit, (struct ioc_play_track *) addr); @@ -1257,7 +1265,7 @@ read_toc(unsigned unit) cd->dlabel.d_npartitions= 1; cd->dlabel.d_partitions[0].p_offset = 0; cd->dlabel.d_partitions[0].p_size = cd->disksize; - cd->dlabel.d_partitions[0].p_fstype = 9; + cd->dlabel.d_partitions[0].p_fstype = FS_BSDFFS; cd->dlabel.d_magic = DISKMAGIC; cd->dlabel.d_magic2 = DISKMAGIC; cd->dlabel.d_checksum = dkcksum(&cd->dlabel); diff --git a/sys/dev/raid/vinum/vinumio.c b/sys/dev/raid/vinum/vinumio.c index 1d2dfedea5..e804a5e9f4 100644 --- a/sys/dev/raid/vinum/vinumio.c +++ b/sys/dev/raid/vinum/vinumio.c @@ -35,7 +35,7 @@ * * $Id: vinumio.c,v 1.30 2000/05/10 23:23:30 grog Exp grog $ * $FreeBSD: src/sys/dev/vinum/vinumio.c,v 1.52.2.6 2002/05/02 08:43:44 grog Exp $ - * $DragonFly: src/sys/dev/raid/vinum/vinumio.c,v 1.22 2007/05/08 02:31:42 dillon Exp $ + * $DragonFly: src/sys/dev/raid/vinum/vinumio.c,v 1.23 2007/05/15 17:50:56 dillon Exp $ */ #include "vinumhdr.h" @@ -169,13 +169,12 @@ set_drive_parms(struct drive *drive) { drive->blocksize = BLKDEV_IOSIZE; /* do we need this? */ drive->secsperblock = drive->blocksize /* number of sectors per block */ - / drive->partinfo.disklab->d_secsize; + / drive->partinfo.media_blksize; /* Now update the label part */ bcopy(hostname, drive->label.sysname, VINUMHOSTNAMELEN); /* put in host name */ getmicrotime(&drive->label.date_of_birth); /* and current time */ - drive->label.drive_size = ((u_int64_t) drive->partinfo.part->p_size) /* size of the drive in bytes */ - *((u_int64_t) drive->partinfo.disklab->d_secsize); + drive->label.drive_size = drive->partinfo.media_size; #if VINUMDEBUG if (debug & DEBUG_BIGDRIVE) /* pretend we're 100 times as big */ drive->label.drive_size *= 100; @@ -239,7 +238,9 @@ init_drive(struct drive *drive, int verbose) close_drive(drive); return drive->lasterror; } - if (drive->partinfo.part->p_fstype != FS_VINUM) { /* not Vinum */ + if (drive->partinfo.fstype != FS_VINUM && + strcmp(drive->partinfo.fstypestr, "vinum") != 0 + ) { drive->lasterror = EFTYPE; if (verbose) log(LOG_WARNING, diff --git a/sys/dev/raid/vinum/vinumioctl.c b/sys/dev/raid/vinum/vinumioctl.c index d42a778e36..901290e519 100644 --- a/sys/dev/raid/vinum/vinumioctl.c +++ b/sys/dev/raid/vinum/vinumioctl.c @@ -43,7 +43,7 @@ * * $Id: vinumioctl.c,v 1.14 2000/10/27 03:07:53 grog Exp grog $ * $FreeBSD: src/sys/dev/vinum/vinumioctl.c,v 1.25.2.4 2002/02/03 00:44:19 grog Exp $ - * $DragonFly: src/sys/dev/raid/vinum/vinumioctl.c,v 1.7 2006/09/10 01:26:36 dillon Exp $ + * $DragonFly: src/sys/dev/raid/vinum/vinumioctl.c,v 1.8 2007/05/15 17:50:56 dillon Exp $ */ #include "vinumhdr.h" @@ -387,15 +387,17 @@ vinumioctl(struct dev_ioctl_args *ap) get_volume_label(vol->name, vol->plexes, vol->size, (struct disklabel *) data); break; - /* - * Care! DIOCGPART returns *pointers* to - * the caller, so we need to store this crap - * as well. And yes, we need it. - */ case DIOCGPART: /* get partition information */ - get_volume_label(vol->name, vol->plexes, vol->size, &vol->label); - ((struct partinfo *) data)->disklab = &vol->label; - ((struct partinfo *) data)->part = &vol->label.d_partitions[0]; + { + struct partinfo *dpart = (void *)data; + + bzero(dpart, sizeof(*dpart)); + dpart->media_offset = 0; + dpart->media_size = (u_int64_t)vol->size * DEV_BSIZE; + dpart->media_blocks = vol->size; + dpart->media_blksize = DEV_BSIZE; + dpart->fstype = FS_BSDFFS; + } break; /* diff --git a/sys/dev/raid/vinum/vinumvar.h b/sys/dev/raid/vinum/vinumvar.h index bf6d86a6bf..1561174d62 100644 --- a/sys/dev/raid/vinum/vinumvar.h +++ b/sys/dev/raid/vinum/vinumvar.h @@ -39,7 +39,7 @@ * * $Id: vinumvar.h,v 1.24 2000/03/01 02:34:57 grog Exp grog $ * $FreeBSD: src/sys/dev/vinum/vinumvar.h,v 1.32.2.4 2001/05/28 05:56:27 grog Exp $ - * $DragonFly: src/sys/dev/raid/vinum/vinumvar.h,v 1.9 2006/09/10 01:26:36 dillon Exp $ + * $DragonFly: src/sys/dev/raid/vinum/vinumvar.h,v 1.10 2007/05/15 17:50:56 dillon Exp $ */ #include @@ -564,7 +564,6 @@ struct volume { * plex pointers is static. */ int plex[MAXPLEX]; /* index of plexes */ - struct disklabel label; /* for DIOCGPART */ }; /* diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c index 1b66a95436..29afc11e20 100644 --- a/sys/kern/subr_diskslice.c +++ b/sys/kern/subr_diskslice.c @@ -44,7 +44,7 @@ * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ * $FreeBSD: src/sys/kern/subr_diskslice.c,v 1.82.2.6 2001/07/24 09:49:41 dd Exp $ - * $DragonFly: src/sys/kern/subr_diskslice.c,v 1.29 2007/05/15 05:37:38 dillon Exp $ + * $DragonFly: src/sys/kern/subr_diskslice.c,v 1.30 2007/05/15 17:50:58 dillon Exp $ */ #include @@ -441,11 +441,27 @@ dsioctl(cdev_t dev, u_long cmd, caddr_t data, int flags, #endif case DIOCGPART: - if (lp == NULL) - return (EINVAL); - ((struct partinfo *)data)->disklab = lp; - ((struct partinfo *)data)->part - = &lp->d_partitions[dkpart(dev)]; + { + struct partinfo *dpart = (void *)data; + + bzero(dpart, sizeof(*dpart)); + dpart->media_offset = (u_int64_t)sp->ds_offset * + info->d_media_blksize; + dpart->media_size = (u_int64_t)sp->ds_size * + info->d_media_blksize; + dpart->media_blocks = sp->ds_size; + dpart->media_blksize = info->d_media_blksize; + if (lp && slice != WHOLE_DISK_SLICE) { + struct partition *p; + + p = &lp->d_partitions[dkpart(dev)]; + dpart->fstype = p->p_fstype; + dpart->media_offset += (u_int64_t)p->p_offset * + info->d_media_blksize; + dpart->media_size = (u_int64_t)p->p_size * + info->d_media_blksize; + } + } return (0); case DIOCGSLICEINFO: diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index 6c76e5d8c4..cce6bf2377 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -32,7 +32,7 @@ * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 * $FreeBSD: src/sys/sys/disklabel.h,v 1.49.2.7 2001/05/27 05:58:26 jkh Exp $ - * $DragonFly: src/sys/sys/disklabel.h,v 1.18 2007/05/15 00:01:04 dillon Exp $ + * $DragonFly: src/sys/sys/disklabel.h,v 1.19 2007/05/15 17:51:02 dillon Exp $ */ #ifndef _SYS_DISKLABEL_H_ @@ -294,22 +294,31 @@ static const char *fstypenames[] = { #ifndef LOCORE /* - * Structure used internally to retrieve information about a partition - * or disk. + * DIOCGPART ioctl - returns information about a slice or partition. This + * ioctl is primarily used to get the block size and media size. + * + * NOTE: media_offset currently represents the byte offset on the raw device, + * it is not a partition relative offset. */ struct partinfo { - struct disklabel *disklab; - struct partition *part; + u_int64_t media_offset; /* byte offset in parent layer */ + u_int64_t media_size; /* media size in bytes */ + u_int64_t media_blocks; /* media size in blocks */ + int media_blksize; /* block size in bytes (sector size) */ + + int reserved01; + int reserved02; + int fstype; /* filesystem type if numeric */ + char fstypestr[16]; /* filesystem type as ascii */ }; /* * Disk-specific ioctls. */ - /* get and set disklabel; DIOCGPART used internally */ #define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */ #define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */ #define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */ -#define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */ +#define DIOCGPART _IOR('d', 104, struct partinfo) /* get partition */ #define DIOCGDVIRGIN _IOR('d', 105, struct disklabel) /* get virgin label */ #define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */ diff --git a/sys/sys/disklabel32.h b/sys/sys/disklabel32.h index 0e418e57df..7eb7452a42 100644 --- a/sys/sys/disklabel32.h +++ b/sys/sys/disklabel32.h @@ -32,7 +32,7 @@ * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 * $FreeBSD: src/sys/sys/disklabel.h,v 1.49.2.7 2001/05/27 05:58:26 jkh Exp $ - * $DragonFly: src/sys/sys/disklabel32.h,v 1.18 2007/05/15 00:01:04 dillon Exp $ + * $DragonFly: src/sys/sys/disklabel32.h,v 1.19 2007/05/15 17:51:02 dillon Exp $ */ #ifndef _SYS_DISKLABEL_H_ @@ -294,22 +294,31 @@ static const char *fstypenames[] = { #ifndef LOCORE /* - * Structure used internally to retrieve information about a partition - * or disk. + * DIOCGPART ioctl - returns information about a slice or partition. This + * ioctl is primarily used to get the block size and media size. + * + * NOTE: media_offset currently represents the byte offset on the raw device, + * it is not a partition relative offset. */ struct partinfo { - struct disklabel *disklab; - struct partition *part; + u_int64_t media_offset; /* byte offset in parent layer */ + u_int64_t media_size; /* media size in bytes */ + u_int64_t media_blocks; /* media size in blocks */ + int media_blksize; /* block size in bytes (sector size) */ + + int reserved01; + int reserved02; + int fstype; /* filesystem type if numeric */ + char fstypestr[16]; /* filesystem type as ascii */ }; /* * Disk-specific ioctls. */ - /* get and set disklabel; DIOCGPART used internally */ #define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */ #define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */ #define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */ -#define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */ +#define DIOCGPART _IOR('d', 104, struct partinfo) /* get partition */ #define DIOCGDVIRGIN _IOR('d', 105, struct disklabel) /* get virgin label */ #define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */ diff --git a/sys/sys/ndisklabel.h b/sys/sys/ndisklabel.h index 617029998b..b3d0eb2778 100644 --- a/sys/sys/ndisklabel.h +++ b/sys/sys/ndisklabel.h @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/sys/Attic/ndisklabel.h,v 1.1 2007/05/14 20:02:45 dillon Exp $ + * $DragonFly: src/sys/sys/Attic/ndisklabel.h,v 1.2 2007/05/15 17:51:02 dillon Exp $ */ /* @@ -58,16 +58,16 @@ * * Disklabels are stored in native-endian format and are portable as long * as the code checks for and properly converts the label. Only big-endian - * and little-endian formats are supported. + * and little-endian formats are supported. All fields are structuralized. */ -#define DFLY_DISKMAGIC ((u_int64_t)0xc4466c7942534430) -#define DFLY_DISKMAGIC_OTHER ((u_int64_t)0x30445342796c46c4) -#define DFLY_MAXPARTITIONS 26 +#define DFLY_DISKMAGIC ((u_int64_t)0xc4466c7942534430ULL) +#define DFLY_DISKMAGIC_OTHER ((u_int64_t)0x30445342796c46c4ULL) +#define DFLY_MAXPARTITIONS 16 #ifndef LOCORE /* - * The disk label and partitions a-z. All offsets and sizes are in bytes + * The disk label and partitions a-p. All offsets and sizes are in bytes * but must be sector-aligned. Other then the alignment requirement, the * disklabel doesn't care what the physical sector size of the media is. * diff --git a/sys/vfs/gnu/ext2fs/ext2_vfsops.c b/sys/vfs/gnu/ext2fs/ext2_vfsops.c index 8156d114fc..b01b2f2b63 100644 --- a/sys/vfs/gnu/ext2fs/ext2_vfsops.c +++ b/sys/vfs/gnu/ext2fs/ext2_vfsops.c @@ -38,7 +38,7 @@ * * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 * $FreeBSD: src/sys/gnu/ext2fs/ext2_vfsops.c,v 1.63.2.7 2002/07/01 00:18:51 iedowse Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_vfsops.c,v 1.53 2007/05/09 00:53:35 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_vfsops.c,v 1.54 2007/05/15 17:51:03 dillon Exp $ */ #include "opt_quota.h" @@ -699,7 +699,6 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp, struct ucred *cred) struct ext2_super_block * es; cdev_t dev; struct partinfo dpart; - int havepart = 0; int error, i, size; int ronly; @@ -731,11 +730,10 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp, struct ucred *cred) mp->mnt_iosize_max = dev->si_iosize_max; if (mp->mnt_iosize_max > MAXPHYS) mp->mnt_iosize_max = MAXPHYS; - if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, cred) != 0) + if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, cred) != 0) { size = DEV_BSIZE; - else { - havepart = 1; - size = dpart.disklab->d_secsize; + } else { + size = dpart.media_blksize; } bp = NULL; diff --git a/sys/vfs/msdosfs/msdosfs_vfsops.c b/sys/vfs/msdosfs/msdosfs_vfsops.c index 4f38b9e3df..f7feabee58 100644 --- a/sys/vfs/msdosfs/msdosfs_vfsops.c +++ b/sys/vfs/msdosfs/msdosfs_vfsops.c @@ -1,5 +1,5 @@ /* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/msdosfs/Attic/msdosfs_vfsops.c,v 1.60.2.8 2004/03/02 09:43:04 tjr Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vfsops.c,v 1.45 2007/05/09 00:53:35 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vfsops.c,v 1.46 2007/05/15 17:51:03 dillon Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */ /*- @@ -298,10 +298,6 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp, struct msdosfs_args *argp) struct msdosfsmount *pmp; struct buf *bp; cdev_t dev; -#ifndef __DragonFly__ - struct partinfo dpart; - int bsize = 0, dtype = 0, tmp; -#endif union bootsector *bsp; struct byte_bpb33 *b33; struct byte_bpb50 *b50; @@ -336,31 +332,6 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp, struct msdosfs_args *argp) bp = NULL; /* both used in error_exit */ pmp = NULL; -#ifndef __DragonFly__ - 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); - 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 = EINVAL; - goto error_exit; - } - } -#endif - /* * Read the boot sector of the filesystem, and then check the * boot signature. If not a dos boot sector then error out. diff --git a/sys/vfs/ufs/ffs_vfsops.c b/sys/vfs/ufs/ffs_vfsops.c index 21e973385d..aa9490e6a8 100644 --- a/sys/vfs/ufs/ffs_vfsops.c +++ b/sys/vfs/ufs/ffs_vfsops.c @@ -32,7 +32,7 @@ * * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 * $FreeBSD: src/sys/ufs/ffs/ffs_vfsops.c,v 1.117.2.10 2002/06/23 22:34:52 iedowse Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_vfsops.c,v 1.54 2007/05/09 00:53:36 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_vfsops.c,v 1.55 2007/05/15 17:51:04 dillon Exp $ */ #include "opt_quota.h" @@ -485,7 +485,7 @@ ffs_reload(struct mount *mp, struct ucred *cred) if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, cred) != 0) size = DEV_BSIZE; else - size = dpart.disklab->d_secsize; + size = dpart.media_blksize; if ((error = bread(devvp, SBOFF, SBSIZE, &bp)) != 0) { brelse(bp); return (error); @@ -652,7 +652,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct malloc_type *mtype) if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, proc0.p_ucred) != 0) size = DEV_BSIZE; else - size = dpart.disklab->d_secsize; + size = dpart.media_blksize; bp = NULL; ump = NULL; -- 2.11.4.GIT