Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Apr 2010 08:29:14 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r206648 - head/sys/cam/scsi
Message-ID:  <201004150829.o3F8TEa4042464@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <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

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:
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004150829.o3F8TEa4042464>