From owner-freebsd-scsi@FreeBSD.ORG Fri Jul 14 01:15:24 2006 Return-Path: X-Original-To: freebsd-scsi@FreeBSD.org Delivered-To: freebsd-scsi@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3052B16A4DA for ; Fri, 14 Jul 2006 01:15:24 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id C3F9243D49 for ; Fri, 14 Jul 2006 01:15:23 +0000 (GMT) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.1/8.13.1) with ESMTP id k6E1FMTs099938 for ; Thu, 13 Jul 2006 21:15:22 -0400 (EDT) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-scsi@FreeBSD.org Date: Thu, 13 Jul 2006 21:15:04 -0400 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: Multipart/Mixed; boundary="Boundary-00=_dAvtEycNiuDyQgk" Message-Id: <200607132115.09178.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV 0.88/1598/Thu Jul 13 07:38:16 2006 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: Subject: [PATCH] Be less verbose with removable da(4). X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2006 01:15:24 -0000 --Boundary-00=_dAvtEycNiuDyQgk Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline This patch shuts up SCSI errors when there's no medium in the removable SCSI disk drive, e.g., flash card reader. We could completely shut it up with SF_NO_PRINT flag from dagetcapacity() like scsi_cd.c does but I decided to add another flag, i.e., SF_QUIET_NM, because we don't want to miss any other errors and it can be used in scsi_cd.c and others later. Thanks! Jung-uk Kim --Boundary-00=_dAvtEycNiuDyQgk Content-Type: text/plain; charset="iso-8859-1"; name="removable_da.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="removable_da.diff" Index: sys/cam/scsi/scsi_all.c =================================================================== RCS file: /home/ncvs/src/sys/cam/scsi/scsi_all.c,v retrieving revision 1.48 diff -u -r1.48 scsi_all.c --- sys/cam/scsi/scsi_all.c 14 Apr 2005 03:52:50 -0000 1.48 +++ sys/cam/scsi/scsi_all.c 14 Jul 2006 00:54:45 -0000 @@ -1706,6 +1706,9 @@ */ action &= ~(SS_MASK|SSQ_MASK|SS_ERRMASK); action |= SS_NOP|SSQ_PRINT_SENSE; + } else if (sense_key == SSD_KEY_NOT_READY) { + if ((sense_flags & SF_QUIET_NM) != 0 && asc == 0x3a) + action &= ~SSQ_PRINT_SENSE; } else if (sense_key == SSD_KEY_ILLEGAL_REQUEST) { if ((sense_flags & SF_QUIET_IR) != 0) action &= ~SSQ_PRINT_SENSE; Index: sys/cam/scsi/scsi_all.h =================================================================== RCS file: /home/ncvs/src/sys/cam/scsi/scsi_all.h,v retrieving revision 1.25 diff -u -r1.25 scsi_all.h --- sys/cam/scsi/scsi_all.h 30 May 2006 22:44:00 -0000 1.25 +++ sys/cam/scsi/scsi_all.h 14 Jul 2006 00:54:46 -0000 @@ -936,7 +936,7 @@ #define SF_NO_PRINT 0x02 #define SF_QUIET_IR 0x04 /* Be quiet about Illegal Request reponses */ #define SF_PRINT_ALWAYS 0x08 - +#define SF_QUIET_NM 0x10 /* Be quiet about Medium not present response */ const char * scsi_op_desc(u_int16_t opcode, struct scsi_inquiry_data *inq_data); Index: sys/cam/scsi/scsi_da.c =================================================================== RCS file: /home/ncvs/src/sys/cam/scsi/scsi_da.c,v retrieving revision 1.190 diff -u -r1.190 scsi_da.c --- sys/cam/scsi/scsi_da.c 18 Apr 2006 22:01:59 -0000 1.190 +++ sys/cam/scsi/scsi_da.c 14 Jul 2006 00:54:46 -0000 @@ -1751,12 +1751,15 @@ struct scsi_read_capacity_data_long *rcaplong; uint32_t block_len; uint64_t maxsector; - int error; + int error, sf; softc = (struct da_softc *)periph->softc; block_len = 0; maxsector = 0; error = 0; + sf = SF_RETRY_UA; + if (softc->flags & DA_FLAG_PACK_REMOVABLE) + sf |= SF_QUIET_NM; /* Do a read capacity */ rcap = (struct scsi_read_capacity_data *)malloc(sizeof(*rcaplong), @@ -1775,7 +1778,7 @@ error = cam_periph_runccb(ccb, daerror, /*cam_flags*/CAM_RETRY_SELTO, - /*sense_flags*/SF_RETRY_UA, + /*sense_flags*/sf, softc->disk->d_devstat); if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) @@ -1810,7 +1813,7 @@ error = cam_periph_runccb(ccb, daerror, /*cam_flags*/CAM_RETRY_SELTO, - /*sense_flags*/SF_RETRY_UA, + /*sense_flags*/sf, softc->disk->d_devstat); if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) Index: sys/geom/geom_disk.c =================================================================== RCS file: /home/ncvs/src/sys/geom/geom_disk.c,v retrieving revision 1.99 diff -u -r1.99 geom_disk.c --- sys/geom/geom_disk.c 10 Apr 2006 03:55:13 -0000 1.99 +++ sys/geom/geom_disk.c 14 Jul 2006 00:54:46 -0000 @@ -133,7 +133,7 @@ if (dp->d_open != NULL) { g_disk_lock_giant(dp); error = dp->d_open(dp); - if (error != 0) + if (error != 0 && bootverbose) printf("Opened disk %s -> %d\n", pp->name, error); g_disk_unlock_giant(dp); --Boundary-00=_dAvtEycNiuDyQgk--