Subject: kern/817: reading CD subchannel generates kernel warning if no disk present
To: None <gnats-admin@NetBSD.ORG>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: netbsd-bugs
Date: 02/22/1995 15:50:08
>Number:         817
>Category:       kern
>Synopsis:       reading CD subchannel shouldn't generate warning
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 22 15:50:05 1995
>Originator:     John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Release:        -current (1995/02/21)
>Environment:
	
System: NetBSD kolvir 1.0A NetBSD 1.0A (KOLVIR) #92: Tue Feb 21 23:17:51 EST 1995 jtk@kolvir:/u1/NetBSD-current/src/sys/arch/i386/compile/KOLVIR i386


>Description:
If you use the CDIOCREADSUBCHANNEL ioctl(), and you've recently ejected
the disc,  you'll get an error message.

This is annoying for CD player applications--they'll notice the disk
having left the drive and periodically check for a disc insertion.  I'd
prefer no kernel message arrive in such a situation.

>How-To-Repeat:
	
>Fix:
add SCSI_SILENT to the cd_read_subchannel() message.
===================================================================
RCS file: RCS/cd.c,v
retrieving revision 1.8
diff -c20 -r1.8 cd.c
*** 1.8	1995/02/03 02:54:50
--- src/sys/scsi/cd.c	1995/02/21 04:35:44
***************
*** 1150,1190 ****
   */
  int 
  cd_read_subchannel(cd, mode, format, track, data, len)
  	struct cd_softc *cd;
  	int mode, format, len;
  	struct cd_sub_channel_info *data;
  {
  	struct scsi_read_subchannel scsi_cmd;
  
  	bzero(&scsi_cmd, sizeof(scsi_cmd));
  	scsi_cmd.opcode = READ_SUBCHANNEL;
  	if (mode == CD_MSF_FORMAT)
  		scsi_cmd.byte2 |= CD_MSF;
  	scsi_cmd.byte3 = SRS_SUBQ;
  	scsi_cmd.subchan_format = format;
  	scsi_cmd.track = track;
  	scsi_cmd.data_len[0] = (len) >> 8;
  	scsi_cmd.data_len[1] = (len) & 0xff;
  	return scsi_scsi_cmd(cd->sc_link, (struct scsi_generic *)&scsi_cmd,
  	    sizeof(struct scsi_read_subchannel), (u_char *)data, len,
! 	    CDRETRIES, 5000, NULL, SCSI_DATA_IN);
  }
  
  /*
   * Read table of contents
   */
  int 
  cd_read_toc(cd, mode, start, data, len)
  	struct cd_softc *cd;
  	int mode, start, len;
  	struct cd_toc_entry *data;
  {
  	struct scsi_read_toc scsi_cmd;
  	int ntoc;
  
  	bzero(&scsi_cmd, sizeof(scsi_cmd));
  	/*if (len!=sizeof(struct ioc_toc_header))
  	 * ntoc=((len)-sizeof(struct ioc_toc_header))/sizeof(struct cd_toc_entry);
  	 * else */
  	ntoc = len;
  	scsi_cmd.opcode = READ_TOC;
--- 1150,1190 ----
   */
  int 
  cd_read_subchannel(cd, mode, format, track, data, len)
  	struct cd_softc *cd;
  	int mode, format, len;
  	struct cd_sub_channel_info *data;
  {
  	struct scsi_read_subchannel scsi_cmd;
  
  	bzero(&scsi_cmd, sizeof(scsi_cmd));
  	scsi_cmd.opcode = READ_SUBCHANNEL;
  	if (mode == CD_MSF_FORMAT)
  		scsi_cmd.byte2 |= CD_MSF;
  	scsi_cmd.byte3 = SRS_SUBQ;
  	scsi_cmd.subchan_format = format;
  	scsi_cmd.track = track;
  	scsi_cmd.data_len[0] = (len) >> 8;
  	scsi_cmd.data_len[1] = (len) & 0xff;
  	return scsi_scsi_cmd(cd->sc_link, (struct scsi_generic *)&scsi_cmd,
  	    sizeof(struct scsi_read_subchannel), (u_char *)data, len,
! 	    CDRETRIES, 5000, NULL, SCSI_DATA_IN|SCSI_SILENT);
  }
  
  /*
   * Read table of contents
   */
  int 
  cd_read_toc(cd, mode, start, data, len)
  	struct cd_softc *cd;
  	int mode, start, len;
  	struct cd_toc_entry *data;
  {
  	struct scsi_read_toc scsi_cmd;
  	int ntoc;
  
  	bzero(&scsi_cmd, sizeof(scsi_cmd));
  	/*if (len!=sizeof(struct ioc_toc_header))
  	 * ntoc=((len)-sizeof(struct ioc_toc_header))/sizeof(struct cd_toc_entry);
  	 * else */
  	ntoc = len;
  	scsi_cmd.opcode = READ_TOC;
>Audit-Trail:
>Unformatted: