Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Oct 2014 07:40:38 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273687 - in head: sys/cam/ctl usr.sbin/ctladm
Message-ID:  <201410260740.s9Q7ecUK038273@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Oct 26 07:40:37 2014
New Revision: 273687
URL: https://svnweb.freebsd.org/changeset/base/273687

Log:
  Add "rpm" and "formfactor" LUN options to match istgt functionality.
  
  MFC after:	1 week

Modified:
  head/sys/cam/ctl/ctl.c
  head/usr.sbin/ctladm/ctladm.8

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c	Sun Oct 26 07:07:54 2014	(r273686)
+++ head/sys/cam/ctl/ctl.c	Sun Oct 26 07:40:37 2014	(r273687)
@@ -10207,6 +10207,8 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio *
 {
 	struct scsi_vpd_block_device_characteristics *bdc_ptr;
 	struct ctl_lun *lun;
+	const char *value;
+	u_int i;
 
 	lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
 
@@ -10239,7 +10241,18 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio *
 		bdc_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT;
 	bdc_ptr->page_code = SVPD_BDC;
 	scsi_ulto2b(sizeof(*bdc_ptr) - 4, bdc_ptr->page_length);
-	scsi_ulto2b(SVPD_NON_ROTATING, bdc_ptr->medium_rotation_rate);
+	if (lun != NULL &&
+	    (value = ctl_get_opt(&lun->be_lun->options, "rpm")) != NULL)
+		i = strtol(value, NULL, 0);
+	else
+		i = SVPD_NON_ROTATING;
+	scsi_ulto2b(i, bdc_ptr->medium_rotation_rate);
+	if (lun != NULL &&
+	    (value = ctl_get_opt(&lun->be_lun->options, "formfactor")) != NULL)
+		i = strtol(value, NULL, 0);
+	else
+		i = 0;
+	bdc_ptr->wab_wac_ff = (i & 0x0f);
 	bdc_ptr->flags = SVPD_FUAB | SVPD_VBULS;
 
 	ctsio->scsi_status = SCSI_STATUS_OK;

Modified: head/usr.sbin/ctladm/ctladm.8
==============================================================================
--- head/usr.sbin/ctladm/ctladm.8	Sun Oct 26 07:07:54 2014	(r273686)
+++ head/usr.sbin/ctladm/ctladm.8	Sun Oct 26 07:40:37 2014	(r273687)
@@ -34,7 +34,7 @@
 .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $
 .\" $FreeBSD$
 .\"
-.Dd October 12, 2014
+.Dd October 26, 2014
 .Dt CTLADM 8
 .Os
 .Sh NAME
@@ -995,6 +995,12 @@ command sequence order shall be explicit
 client through the selection of appropriate commands and task attributes.
 The default value is "restricted".  It improves data integrity, but may
 introduce some additional delays.
+.It Va rpm
+Specifies medium rotation rate of the device: 0 -- not reported,
+1 -- non-rotating (SSD), >1024 -- value in revolutions per minute.
+.It Va formfactor
+Specifies nominal form factor of the device: 0 -- not reported, 1 -- 5.25",
+2 -- 3.5", 3 -- 2.5", 4 -- 1.8", 5 -- less then 1.8".
 .It Va unmap
 Set to "on", enables UNMAP support for the LUN, if supported by the backend.
 .It Va writecache



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410260740.s9Q7ecUK038273>