From owner-svn-src-head@FreeBSD.ORG Wed Jul 9 04:37:51 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 3EFD42C7; Wed, 9 Jul 2014 04:37:51 +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 066E82E1B; Wed, 9 Jul 2014 04:37:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s694boGE060643; Wed, 9 Jul 2014 04:37:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s694bodU060641; Wed, 9 Jul 2014 04:37:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407090437.s694bodU060641@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Jul 2014 04:37:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268447 - in head: sys/cam/ctl usr.sbin/ctladm 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 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: Wed, 09 Jul 2014 04:37:51 -0000 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