Author: avg
Date: Thu Apr 15 08:29:14 2010
New Revision: 206648
URL: http://svn.freebsd.org/changeset/base/206648

Log:
  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 <n...@jelal.kn-bremen.de>
                a slightly different version
  Tested by:    Pavel Sukhoy <suk...@ripn.net>,
                Markus Wild <m.w...@cybernet.ch>,
                Juergen Lock <n...@jelal.kn-bremen.de>,
                uqs
  MFC after:    1 week

Modified:
  head/sys/cam/scsi/scsi_cd.c

Modified: head/sys/cam/scsi/scsi_cd.c
==============================================================================
--- head/sys/cam/scsi/scsi_cd.c Thu Apr 15 08:20:57 2010        (r206647)
+++ head/sys/cam/scsi/scsi_cd.c Thu Apr 15 08:29:14 2010        (r206648)
@@ -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:
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to