summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_disk.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-09-30 21:14:28 +0000
committerphk <phk@FreeBSD.org>1999-09-30 21:14:28 +0000
commitd653e2d1b532b17953165ae09f494def703ca550 (patch)
treef3d44ef491ae73504123477905ac1fc041359d31 /sys/kern/subr_disk.c
parent3021933a6c1ad95d61068e78bdc661fbe8b84708 (diff)
downloadFreeBSD-src-d653e2d1b532b17953165ae09f494def703ca550.zip
FreeBSD-src-d653e2d1b532b17953165ae09f494def703ca550.tar.gz
Make all slices/partitions correctly inherit si_* fields.
Lightly tested by: msmith
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r--sys/kern/subr_disk.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index ea394c7..bfa3d89 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -115,12 +115,16 @@ diskopen(dev_t dev, int oflags, int devtype, struct proc *p)
if (!dp)
return (ENXIO);
- dev->si_disk = dp;
+ if (!dsisopen(dp->d_slice))
+ error = dp->d_devsw->d_open(pdev, oflags, devtype, p);
+
+ /* Inherit properties from the whole/raw dev_t */
+ dev->si_disk = pdev->si_disk;
dev->si_drv1 = pdev->si_drv1;
dev->si_drv2 = pdev->si_drv2;
-
- if (!dsisopen(dp->d_slice))
- error = dp->d_devsw->d_open(dev, oflags, devtype, p);
+ dev->si_iosize_max = pdev->si_iosize_max;
+ dev->si_bsize_phys = pdev->si_bsize_phys;
+ dev->si_bsize_best = pdev->si_bsize_best;
if (error)
return(error);
@@ -138,12 +142,15 @@ diskclose(dev_t dev, int fflag, int devtype, struct proc *p)
{
struct disk *dp;
int error;
+ dev_t pdev;
error = 0;
dp = dev->si_disk;
dsclose(dev, devtype, dp->d_slice);
- if (!dsisopen(dp->d_slice))
- error = dp->d_devsw->d_close(dev, fflag, devtype, p);
+ if (!dsisopen(dp->d_slice)) {
+ pdev = dkmodpart(dkmodslice(dev, WHOLE_DISK_SLICE), RAW_PART);
+ error = dp->d_devsw->d_close(pdev, fflag, devtype, p);
+ }
return (error);
}
OpenPOWER on IntegriCloud