Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jun 2014 08:43:52 +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: r267498 - head/sys/cam/ctl
Message-ID:  <201406150843.s5F8hqeU011403@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Jun 15 08:43:52 2014
New Revision: 267498
URL: http://svnweb.freebsd.org/changeset/base/267498

Log:
  Respect "vendor" option in all places.
  
  MFC after:	2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_frontend_iscsi.c

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c	Sun Jun 15 07:52:59 2014	(r267497)
+++ head/sys/cam/ctl/ctl.c	Sun Jun 15 08:43:52 2014	(r267498)
@@ -9303,6 +9303,7 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio
 	struct ctl_softc *ctl_softc;
 	struct ctl_lun *lun;
 	struct ctl_frontend *fe;
+	char *val;
 #ifndef CTL_USE_BACKEND_SN
 	char tmpstr[32];
 #endif /* CTL_USE_BACKEND_SN */
@@ -9396,7 +9397,13 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio
 	 */
 	desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10;
 	desc->length = sizeof(*t10id) + CTL_DEVID_LEN;
-	strncpy((char *)t10id->vendor, CTL_VENDOR, sizeof(t10id->vendor));
+	if (lun == NULL || (val = ctl_get_opt(lun->be_lun, "vendor")) == NULL) {
+		strncpy((char *)t10id->vendor, CTL_VENDOR, sizeof(t10id->vendor));
+	} else {
+		memset(t10id->vendor, ' ', sizeof(t10id->vendor));
+		strncpy(t10id->vendor, val,
+		    min(sizeof(t10id->vendor), strlen(val)));
+	}
 
 	/*
 	 * desc1 is for the WWPN which is a port asscociation.

Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c
==============================================================================
--- head/sys/cam/ctl/ctl_frontend_iscsi.c	Sun Jun 15 07:52:59 2014	(r267497)
+++ head/sys/cam/ctl/ctl_frontend_iscsi.c	Sun Jun 15 08:43:52 2014	(r267498)
@@ -2038,6 +2038,7 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
 	struct scsi_vpd_id_t10 *t10id;
 	struct ctl_lun *lun;
 	const struct icl_pdu *request;
+	char *val;
 	size_t devid_len, wwpn_len;
 
 	lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
@@ -2102,7 +2103,13 @@ cfiscsi_devid(struct ctl_scsiio *ctsio, 
 	desc->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_ASCII;
 	desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10;
 	desc->length = sizeof(*t10id) + CTL_DEVID_LEN;
-	strncpy((char *)t10id->vendor, CTL_VENDOR, sizeof(t10id->vendor));
+	if (lun == NULL || (val = ctl_get_opt(lun->be_lun, "vendor")) == NULL) {
+		strncpy((char *)t10id->vendor, CTL_VENDOR, sizeof(t10id->vendor));
+	} else {
+		memset(t10id->vendor, ' ', sizeof(t10id->vendor));
+		strncpy(t10id->vendor, val,
+		    min(sizeof(t10id->vendor), strlen(val)));
+	}
 
 	/*
 	 * If we've actually got a backend, copy the device id from the



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