diff options
author | phk <phk@FreeBSD.org> | 2004-09-05 21:15:58 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-09-05 21:15:58 +0000 |
commit | 38ae102f61e34fccf24c864f91b3f2560e50b18b (patch) | |
tree | 147fda4145293281b55787fc3a7e6af561de17f6 /sys/geom/geom_subr.c | |
parent | 2087edb93832a47d6a043b58602f699b1b2967a4 (diff) | |
download | FreeBSD-src-38ae102f61e34fccf24c864f91b3f2560e50b18b.zip FreeBSD-src-38ae102f61e34fccf24c864f91b3f2560e50b18b.tar.gz |
For removable devices without media we set a zero mediasize but a non-zero
sectorsize in order to avoid a lot of checks around various divisions etc.
Enforce the sectorsize being > 0 with a KASSERT on successful open.
Fix scsi_cd.c to return 2k sectors when no media inserted.
Diffstat (limited to 'sys/geom/geom_subr.c')
-rw-r--r-- | sys/geom/geom_subr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index c7058ea..3085c4b 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -706,6 +706,9 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int dce) cp->acr += dcr; cp->acw += dcw; cp->ace += dce; + if (pp->acr != 0 || pp->acw != 0 || pp->ace != 0) + KASSERT(pp->sectorsize > 0, + ("Provider %s lacks sectorsize", pp->name)); } return (error); } |