From owner-svn-src-all@FreeBSD.ORG Sun Jun 15 06:56:11 2014 Return-Path: Delivered-To: svn-src-all@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 3804A9DA; Sun, 15 Jun 2014 06:56:11 +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 0B7CA281F; Sun, 15 Jun 2014 06:56:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5F6uAhm059615; Sun, 15 Jun 2014 06:56:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5F6uAiJ059614; Sun, 15 Jun 2014 06:56:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201406150656.s5F6uAiJ059614@svn.freebsd.org> From: Alexander Motin Date: Sun, 15 Jun 2014 06:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267496 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jun 2014 06:56:11 -0000 Author: mav Date: Sun Jun 15 06:56:10 2014 New Revision: 267496 URL: http://svnweb.freebsd.org/changeset/base/267496 Log: Add "vendor", "product" and "revision" options to control inquiry data. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Jun 15 05:17:40 2014 (r267495) +++ head/sys/cam/ctl/ctl.c Sun Jun 15 06:56:10 2014 (r267496) @@ -9634,6 +9634,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio struct scsi_inquiry *cdb; struct ctl_softc *ctl_softc; struct ctl_lun *lun; + char *val; uint32_t alloc_len; int is_fc; @@ -9778,10 +9779,16 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio * We have 8 bytes for the vendor name, and 16 bytes for the device * name and 4 bytes for the revision. */ - strncpy(inq_ptr->vendor, CTL_VENDOR, sizeof(inq_ptr->vendor)); + if (lun == NULL || (val = ctl_get_opt(lun->be_lun, "vendor")) == NULL) { + strcpy(inq_ptr->vendor, CTL_VENDOR); + } else { + memset(inq_ptr->vendor, ' ', sizeof(inq_ptr->vendor)); + strncpy(inq_ptr->vendor, val, + min(sizeof(inq_ptr->vendor), strlen(val))); + } if (lun == NULL) { strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT); - } else { + } else if ((val = ctl_get_opt(lun->be_lun, "product")) == NULL) { switch (lun->be_lun->lun_type) { case T_DIRECT: strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT); @@ -9793,13 +9800,23 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio strcpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT); break; } + } else { + memset(inq_ptr->product, ' ', sizeof(inq_ptr->product)); + strncpy(inq_ptr->product, val, + min(sizeof(inq_ptr->product), strlen(val))); } /* * XXX make this a macro somewhere so it automatically gets * incremented when we make changes. */ - strncpy(inq_ptr->revision, "0001", sizeof(inq_ptr->revision)); + if (lun == NULL || (val = ctl_get_opt(lun->be_lun, "revision")) == NULL) { + strncpy(inq_ptr->revision, "0001", sizeof(inq_ptr->revision)); + } else { + memset(inq_ptr->revision, ' ', sizeof(inq_ptr->revision)); + strncpy(inq_ptr->revision, val, + min(sizeof(inq_ptr->revision), strlen(val))); + } /* * For parallel SCSI, we support double transition and single