diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index ac65e368ed63..f587b00a703c 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -2723,7 +2723,7 @@ cdcheckmedia(struct cam_periph *periph) cdprevent(periph, PR_PREVENT); softc->disk->d_maxsize = DFLTPHYS; - softc->disk->d_sectorsize = 0; + softc->disk->d_sectorsize = 2048; softc->disk->d_mediasize = 0; /* diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index c7058ea857fa..3085c4bf0be6 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); } diff --git a/sys/geom/notes b/sys/geom/notes index 3b0f811f091f..4fcacaefbc40 100644 --- a/sys/geom/notes +++ b/sys/geom/notes @@ -138,3 +138,13 @@ application | | | | X | X | geom_slice.h is special in that it documents a "library" for implementing a specific kind of class, and consequently does not appear in the above matrix. +----------------------------------------------------------------------- +Removable media. + +In general, the theory is that a drive creates the provider when it has +a media and destroys it when the media disappears. + +In a more realistic world, we will allow a provider to be opened medialess +(set any sectorsize and a mediasize==0) in order to allow operations like +open/close tray etc. +