Module Name:    src
Committed By:   martin
Date:           Tue Mar 23 12:42:55 UTC 2010

Modified Files:
        src/sys/dev/scsipi: cd.c

Log Message:
Make cdclose() silent, if we only have the raw partition open (e.g. when
probing for media and not finding any)


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 src/sys/dev/scsipi/cd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/scsipi/cd.c
diff -u src/sys/dev/scsipi/cd.c:1.299 src/sys/dev/scsipi/cd.c:1.300
--- src/sys/dev/scsipi/cd.c:1.299	Mon Mar 22 16:49:41 2010
+++ src/sys/dev/scsipi/cd.c	Tue Mar 23 12:42:55 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd.c,v 1.299 2010/03/22 16:49:41 martin Exp $	*/
+/*	$NetBSD: cd.c,v 1.300 2010/03/23 12:42:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.299 2010/03/22 16:49:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.300 2010/03/23 12:42:55 martin Exp $");
 
 #include "rnd.h"
 
@@ -510,6 +510,12 @@
 	struct scsipi_periph *periph = cd->sc_periph;
 	struct scsipi_adapter *adapt = periph->periph_channel->chan_adapter;
 	int part = CDPART(dev);
+	int silent = 0;
+
+	if (part == RAW_PART && ((cd->sc_dk.dk_label->d_npartitions == 0) ||
+	    (part < cd->sc_dk.dk_label->d_npartitions &&
+	    cd->sc_dk.dk_label->d_partitions[part].p_fstype == FS_UNUSED)))
+		silent = XS_CTL_SILENT;
 
 	mutex_enter(&cd->sc_lock);
 
@@ -526,14 +532,14 @@
 
 	if (cd->sc_dk.dk_openmask == 0) {
 		/* synchronise caches on last close */
-		cdcachesync(periph, 0);
+		cdcachesync(periph, silent);
 
 		/* drain outstanding calls */
 		scsipi_wait_drain(periph);
 
 		scsipi_prevent(periph, SPAMR_ALLOW,
 		    XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_MEDIA_CHANGE |
-		    XS_CTL_IGNORE_NOT_READY);
+		    XS_CTL_IGNORE_NOT_READY | silent);
 		periph->periph_flags &= ~PERIPH_OPEN;
 
 		scsipi_wait_drain(periph);

Reply via email to