Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/scsipi Make cdclose() silent, if we only have the ra...



details:   https://anonhg.NetBSD.org/src/rev/63fad2fff4df
branches:  trunk
changeset: 753342:63fad2fff4df
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Mar 23 12:42:55 2010 +0000

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

diffstat:

 sys/dev/scsipi/cd.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 4e05bfbe527f -r 63fad2fff4df sys/dev/scsipi/cd.c
--- a/sys/dev/scsipi/cd.c       Tue Mar 23 12:13:28 2010 +0000
+++ b/sys/dev/scsipi/cd.c       Tue Mar 23 12:42:55 2010 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index