scsi_cd: CD_FLAG_VALID_MEDIA is sufficient to set d_sectorsize and

d_mediasize

CD_FLAG_VALID_TOC is not required for setting those media properties.

PR:		kern/145385
Submitted by:	Juergen Lock <nox@jelal.kn-bremen.de>
		a slightly different version
Tested by:	Pavel Sukhoy <sukhoy@ripn.net>,
		Markus Wild <m.wild@cybernet.ch>,
		Juergen Lock <nox@jelal.kn-bremen.de>,
		uqs
MFC after:	1 week
This commit is contained in:
avg 2010-04-15 08:29:14 +00:00
parent e5e811b1e9
commit 701362298a

View File

@ -2773,8 +2773,12 @@ cdcheckmedia(struct cam_periph *periph)
softc->flags &= ~(CD_FLAG_VALID_MEDIA|CD_FLAG_VALID_TOC);
cdprevent(periph, PR_ALLOW);
return (error);
} else
} else {
softc->flags |= CD_FLAG_VALID_MEDIA;
softc->disk->d_sectorsize = softc->params.blksize;
softc->disk->d_mediasize =
(off_t)softc->params.blksize * softc->params.disksize;
}
/*
* Now we check the table of contents. This (currently) is only
@ -2863,9 +2867,6 @@ cdcheckmedia(struct cam_periph *periph)
}
softc->flags |= CD_FLAG_VALID_TOC;
softc->disk->d_sectorsize = softc->params.blksize;
softc->disk->d_mediasize =
(off_t)softc->params.blksize * softc->params.disksize;
bailout: