Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jul 2014 17:20:41 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r268699 - in stable/10: sys/cam/ctl usr.sbin/ctladm
Message-ID:  <201407151720.s6FHKffo091646@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Jul 15 17:20:40 2014
New Revision: 268699
URL: http://svnweb.freebsd.org/changeset/base/268699

Log:
  MFC r268447:
  Add LUN options to specify 64-bit EUI and NAA identifiers.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/usr.sbin/ctladm/ctladm.8
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c	Tue Jul 15 17:19:43 2014	(r268698)
+++ stable/10/sys/cam/ctl/ctl.c	Tue Jul 15 17:20:40 2014	(r268699)
@@ -4434,7 +4434,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
 	struct ctl_port *port;
 	struct scsi_vpd_id_descriptor *desc;
 	struct scsi_vpd_id_t10 *t10id;
-	const char *scsiname, *vendor;
+	const char *eui, *naa, *scsiname, *vendor;
 	int lun_number, i, lun_malloced;
 	int devidlen, idlen1, idlen2 = 0, len;
 
@@ -4478,6 +4478,14 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
 		idlen2 = roundup2(strlen(scsiname) + 1, 4);
 		len += sizeof(struct scsi_vpd_id_descriptor) + idlen2;
 	}
+	eui = ctl_get_opt(&be_lun->options, "eui");
+	if (eui != NULL) {
+		len += sizeof(struct scsi_vpd_id_descriptor) + 8;
+	}
+	naa = ctl_get_opt(&be_lun->options, "naa");
+	if (naa != NULL) {
+		len += sizeof(struct scsi_vpd_id_descriptor) + 8;
+	}
 	lun->lun_devid = malloc(sizeof(struct ctl_devid) + len,
 	    M_CTL, M_WAITOK | M_ZERO);
 	lun->lun_devid->len = len;
@@ -4504,6 +4512,24 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
 		desc->length = idlen2;
 		strlcpy(desc->identifier, scsiname, idlen2);
 	}
+	if (eui != NULL) {
+		desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] +
+		    desc->length);
+		desc->proto_codeset = SVPD_ID_CODESET_BINARY;
+		desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN |
+		    SVPD_ID_TYPE_EUI64;
+		desc->length = 8;
+		scsi_u64to8b(strtouq(eui, NULL, 0), desc->identifier);
+	}
+	if (naa != NULL) {
+		desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] +
+		    desc->length);
+		desc->proto_codeset = SVPD_ID_CODESET_BINARY;
+		desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN |
+		    SVPD_ID_TYPE_NAA;
+		desc->length = 8;
+		scsi_u64to8b(strtouq(naa, NULL, 0), desc->identifier);
+	}
 
 	mtx_lock(&ctl_softc->ctl_lock);
 	/*

Modified: stable/10/usr.sbin/ctladm/ctladm.8
==============================================================================
--- stable/10/usr.sbin/ctladm/ctladm.8	Tue Jul 15 17:19:43 2014	(r268698)
+++ stable/10/usr.sbin/ctladm/ctladm.8	Tue Jul 15 17:20:40 2014	(r268699)
@@ -34,7 +34,7 @@
 .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $
 .\" $FreeBSD$
 .\"
-.Dd June 15, 2014
+.Dd July 9, 2014
 .Dt CTLADM 8
 .Os
 .Sh NAME
@@ -947,6 +947,10 @@ Specifies LUN product string up to 16 ch
 Specifies LUN revision string up to 4 chars.
 .It Va scsiname
 Specifies LUN SCSI name string.
+.It Va eui
+Specifies LUN EUI-64 identified.
+.It Va naa
+Specifies LUN NAA identifier.
 .It Va unmap
 Set to "on", enables UNMAP support for the LUN.
 .El



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