From 1ebc558b72c0c7511f7ea0136cad21f626fd823c Mon Sep 17 00:00:00 2001 From: dlg Date: Fri, 1 Aug 2008 01:44:20 +0000 Subject: [PATCH] silence failures to run scsi_prevent. dmesg spam sucks. ok krw@ marco@ miod@ deraadt@ --- sys/scsi/cd.c | 14 +++++++++----- sys/scsi/sd.c | 13 +++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 7724889c0f4..a796cfac311 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.143 2008/07/26 04:39:51 krw Exp $ */ +/* $OpenBSD: cd.c,v 1.144 2008/08/01 01:44:20 dlg Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -336,7 +336,8 @@ cdopen(dev_t dev, int flag, int fmt, struct proc *p) /* Lock the cd in. */ error = scsi_prevent(sc_link, PR_PREVENT, - SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); + SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | + SCSI_SILENT); if (error) goto bad; @@ -379,7 +380,8 @@ out: /* Insure only one open at a time. */ bad: if (cd->sc_dk.dk_openmask == 0) { scsi_prevent(sc_link, PR_ALLOW, - SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); + SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | + SCSI_SILENT); sc_link->flags &= ~(SDEV_OPEN | SDEV_MEDIA_LOADED); } @@ -422,7 +424,8 @@ cdclose(dev_t dev, int flag, int fmt, struct proc *p) /* XXXX Must wait for I/O to complete! */ scsi_prevent(cd->sc_link, PR_ALLOW, - SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_NOT_READY); + SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_NOT_READY | + SCSI_SILENT); cd->sc_link->flags &= ~(SDEV_OPEN | SDEV_MEDIA_LOADED); if (cd->sc_link->flags & SDEV_EJECTING) { @@ -1899,7 +1902,8 @@ cd_powerhook(int why, void *arg) */ if (why == PWR_RESUME && cd->sc_dk.dk_openmask != 0) scsi_prevent(cd->sc_link, PR_PREVENT, - SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); + SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE | + SCSI_SILENT); } int diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 5bfa738383d..ceb613cff60 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.151 2008/07/08 12:17:48 dlg Exp $ */ +/* $OpenBSD: sd.c,v 1.152 2008/08/01 01:44:20 dlg Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -368,14 +368,15 @@ sdopen(dev_t dev, int flag, int fmt, struct proc *p) * it's open. But allow the open to proceed if the device can't * be locked in. */ - if ((sc_link->flags & SDEV_REMOVABLE) != 0) - scsi_prevent(sc_link, PR_PREVENT, + if ((sc_link->flags & SDEV_REMOVABLE) != 0) { + scsi_prevent(sc_link, PR_PREVENT, SCSI_SILENT | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); + } /* Check that it is still responding and ok. */ error = scsi_test_unit_ready(sc_link, - TEST_READY_RETRIES, (rawopen ? SCSI_SILENT : 0) | + TEST_READY_RETRIES, SCSI_SILENT | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); if (error) { @@ -425,7 +426,7 @@ out: /* Insure only one open at a time. */ bad: if (sd->sc_dk.dk_openmask == 0) { if ((sd->sc_link->flags & SDEV_REMOVABLE) != 0) - scsi_prevent(sc_link, PR_ALLOW, + scsi_prevent(sc_link, PR_ALLOW, SCSI_SILENT | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE); sc_link->flags &= ~(SDEV_OPEN | SDEV_MEDIA_LOADED); @@ -477,7 +478,7 @@ sdclose(dev_t dev, int flag, int fmt, struct proc *p) if ((sd->sc_link->flags & SDEV_REMOVABLE) != 0) scsi_prevent(sd->sc_link, PR_ALLOW, SCSI_IGNORE_ILLEGAL_REQUEST | - SCSI_IGNORE_NOT_READY); + SCSI_IGNORE_NOT_READY | SCSI_SILENT); sd->sc_link->flags &= ~(SDEV_OPEN | SDEV_MEDIA_LOADED); if (sd->sc_link->flags & SDEV_EJECTING) { -- 2.20.1