svn commit: r268447 - in head: sys/cam/ctl usr.sbin/ctladm

Alexander Motin mav at FreeBSD.org
Wed Jul 9 04:37:51 UTC 2014


Author: mav
Date: Wed Jul  9 04:37:50 2014
New Revision: 268447
URL: http://svnweb.freebsd.org/changeset/base/268447

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

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	Wed Jul  9 01:33:35 2014	(r268446)
+++ head/sys/cam/ctl/ctl.c	Wed Jul  9 04:37:50 2014	(r268447)
@@ -4432,7 +4432,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;
 
@@ -4476,6 +4476,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;
@@ -4502,6 +4510,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: head/usr.sbin/ctladm/ctladm.8
==============================================================================
--- head/usr.sbin/ctladm/ctladm.8	Wed Jul  9 01:33:35 2014	(r268446)
+++ head/usr.sbin/ctladm/ctladm.8	Wed Jul  9 04:37:50 2014	(r268447)
@@ -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


More information about the svn-src-head mailing list