NetBSD-Bugs archive

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

Re: kern/43785: ejecting cd causes error messages



The second patch is silly; perhaps this is better?

Index: cd.c
=====================================================================
RCS file: /s/NetBSD/cvsroot/src/sys/dev/scsipi/cd.c,v
retrieving revision 1.302
diff -u -r1.302 cd.c
--- cd.c        4 Apr 2010 21:36:22 -0000       1.302
+++ cd.c        22 Aug 2010 13:45:47 -0000
@@ -511,6 +511,7 @@
        struct scsipi_adapter *adapt = periph->periph_channel->chan_adapter;
        int part = CDPART(dev);
        int silent = 0;
+       int error;
 
        if (part == RAW_PART && ((cd->sc_dk.dk_label->d_npartitions == 0)=
 ||
            (part < cd->sc_dk.dk_label->d_npartitions &&
@@ -519,6 +520,13 @@
 
        mutex_enter(&cd->sc_lock);
 
+       error = scsipi_test_unit_ready(periph,
+           XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_MEDIA_CHANGE |
+           XS_CTL_SILENT);
+       /* XXX: is ENODEV sufficient here? */
+       if (error == ENODEV)
+               silent = XS_CTL_SILENT;
+
        switch (fmt) {
        case S_IFCHR:
                cd->sc_dk.dk_copenmask &= ~(1 << part);



Home | Main Index | Thread Index | Old Index