diff options
author | bde <bde@FreeBSD.org> | 1995-05-08 16:53:33 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1995-05-08 16:53:33 +0000 |
commit | da9e45c7bd5346a2f6ace48d3fc2c258277fdf18 (patch) | |
tree | 3d76195f8043d1f23e2fdd44252dac713d2ad6e9 /sys/scsi | |
parent | 4cb3ce6d8c9871191b5ae5bb005e16636e8a41a3 (diff) | |
download | FreeBSD-src-da9e45c7bd5346a2f6ace48d3fc2c258277fdf18.zip FreeBSD-src-da9e45c7bd5346a2f6ace48d3fc2c258277fdf18.tar.gz |
sdsize() didn't open a device often enough. This caused swap partitions on
slices other than the first slice looked at to be unavailable for swapping.
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/sd.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index b66381a..e7bd97a 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * - * $Id: sd.c,v 1.62 1995/04/30 15:14:34 bde Exp $ + * $Id: sd.c,v 1.63 1995/05/03 18:09:17 dufault Exp $ */ #define SPLSD splbio @@ -765,25 +765,12 @@ sd_get_parms(unit, flags) int sdsize(dev_t dev) { - u_int32 unit = SDUNIT(dev), part = PARTITION(dev); struct scsi_data *sd; - struct disklabel *lp; - if ((sd = SCSI_DATA(&sd_switch, unit)) == NULL) - return -1; - if ((sd->flags & SDINIT) == 0) - return -1; - if (!dsisopen(sd->dk_slices)) { - if (sdopen(dkmodpart(dev, RAW_PART), FREAD, S_IFBLK, - (struct proc *)NULL) != 0) - return (-1); - sdclose(dkmodpart(dev, RAW_PART), FREAD/*XXX?*/, S_IFBLK, - (struct proc *)NULL); - } - lp = dsgetlabel(dev, sd->dk_slices); - if (lp == NULL) + sd = SCSI_DATA(&sd_switch, (u_int32) SDUNIT(dev)); + if (sd == NULL) return (-1); - return ((int)lp->d_partitions[part].p_size); + return (dssize(dev, &sd->dk_slices, sdopen, sdclose)); } /* |