From owner-svn-src-head@FreeBSD.ORG Mon Sep 22 00:40:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D8F53AA; Mon, 22 Sep 2014 00:40:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D333AEE0; Mon, 22 Sep 2014 00:40:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8M0eK76009070; Mon, 22 Sep 2014 00:40:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8M0eKil009069; Mon, 22 Sep 2014 00:40:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201409220040.s8M0eKil009069@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 22 Sep 2014 00:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271940 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Sep 2014 00:40:21 -0000 Author: mav Date: Mon Sep 22 00:40:20 2014 New Revision: 271940 URL: http://svnweb.freebsd.org/changeset/base/271940 Log: Polish INQUIRY command fields validation. Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Sep 21 23:42:54 2014 (r271939) +++ head/sys/cam/ctl/ctl.c Mon Sep 22 00:40:20 2014 (r271940) @@ -10723,45 +10723,23 @@ ctl_inquiry(struct ctl_scsiio *ctsio) struct scsi_inquiry *cdb; int retval; - cdb = (struct scsi_inquiry *)ctsio->cdb; - - retval = 0; - CTL_DEBUG_PRINT(("ctl_inquiry\n")); - /* - * Right now, we don't support the CmdDt inquiry information. - * This would be nice to support in the future. When we do - * support it, we should change this test so that it checks to make - * sure SI_EVPD and SI_CMDDT aren't both set at the same time. - */ -#ifdef notyet - if (((cdb->byte2 & SI_EVPD) - && (cdb->byte2 & SI_CMDDT))) -#endif - if (cdb->byte2 & SI_CMDDT) { - /* - * Point to the SI_CMDDT bit. We might change this - * when we support SI_CMDDT, but since both bits would be - * "wrong", this should probably just stay as-is then. - */ + cdb = (struct scsi_inquiry *)ctsio->cdb; + if (cdb->byte2 & SI_EVPD) + retval = ctl_inquiry_evpd(ctsio); + else if (cdb->page_code == 0) + retval = ctl_inquiry_std(ctsio); + else { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 1); + /*field*/ 2, + /*bit_valid*/ 0, + /*bit*/ 0); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } - if (cdb->byte2 & SI_EVPD) - retval = ctl_inquiry_evpd(ctsio); -#ifdef notyet - else if (cdb->byte2 & SI_CMDDT) - retval = ctl_inquiry_cmddt(ctsio); -#endif - else - retval = ctl_inquiry_std(ctsio); return (retval); }