diff options
-rw-r--r-- | sys/cam/ctl/ctl.c | 28 | ||||
-rw-r--r-- | usr.sbin/ctladm/ctladm.8 | 6 |
2 files changed, 32 insertions, 2 deletions
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 6ef555c..28058cf 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -4434,7 +4434,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, 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_softc, struct ctl_lun *ctl_lun, 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_softc, struct ctl_lun *ctl_lun, 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); /* diff --git a/usr.sbin/ctladm/ctladm.8 b/usr.sbin/ctladm/ctladm.8 index a832dbb..955375f 100644 --- a/usr.sbin/ctladm/ctladm.8 +++ b/usr.sbin/ctladm/ctladm.8 @@ -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 chars. 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 |