Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Aug 2013 09:42:15 +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: r254766 - in head/sys: cam geom
Message-ID:  <201308240942.r7O9gFaI083076@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Aug 24 09:42:14 2013
New Revision: 254766
URL: http://svnweb.freebsd.org/changeset/base/254766

Log:
  Add new attribute lunname to report only textual LUN-specific device IDs.
  While lunid attribute prefers to report numeric ones, having both may be
  useful in some situations.

Modified:
  head/sys/cam/cam_xpt.c
  head/sys/geom/geom_disk.c

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Sat Aug 24 08:47:09 2013	(r254765)
+++ head/sys/cam/cam_xpt.c	Sat Aug 24 09:42:14 2013	(r254766)
@@ -1091,7 +1091,8 @@ xpt_getattr(char *buf, size_t len, const
 		cdai.buftype = CDAI_TYPE_SERIAL_NUM;
 	else if (!strcmp(attr, "GEOM::physpath"))
 		cdai.buftype = CDAI_TYPE_PHYS_PATH;
-	else if (!strcmp(attr, "GEOM::lunid")) {
+	else if (strcmp(attr, "GEOM::lunid") == 0 ||
+		 strcmp(attr, "GEOM::lunname") == 0) {
 		cdai.buftype = CDAI_TYPE_SCSI_DEVID;
 		cdai.bufsiz = CAM_SCSI_DEVID_MAXLEN;
 	} else
@@ -1108,11 +1109,14 @@ xpt_getattr(char *buf, size_t len, const
 	if (cdai.provsiz == 0)
 		goto out;
 	if (cdai.buftype == CDAI_TYPE_SCSI_DEVID) {
-		idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf,
-		    cdai.provsiz, scsi_devid_is_lun_naa);
-		if (idd == NULL)
+		if (strcmp(attr, "GEOM::lunid") == 0) {
 			idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf,
-			    cdai.provsiz, scsi_devid_is_lun_eui64);
+			    cdai.provsiz, scsi_devid_is_lun_naa);
+			if (idd == NULL)
+				idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf,
+				    cdai.provsiz, scsi_devid_is_lun_eui64);
+		} else
+			idd = NULL;
 		if (idd == NULL)
 			idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf,
 			    cdai.provsiz, scsi_devid_is_lun_t10);

Modified: head/sys/geom/geom_disk.c
==============================================================================
--- head/sys/geom/geom_disk.c	Sat Aug 24 08:47:09 2013	(r254765)
+++ head/sys/geom/geom_disk.c	Sat Aug 24 09:42:14 2013	(r254766)
@@ -460,6 +460,12 @@ g_disk_dumpconf(struct sbuf *sb, const c
 			if (dp->d_getattr(bp) == 0)
 				sbuf_printf(sb, "%s<lunid>%s</lunid>\n",
 				    indent, buf);
+			bp->bio_attribute = "GEOM::lunname";
+			bp->bio_length = DISK_IDENT_SIZE;
+			bp->bio_data = buf;
+			if (dp->d_getattr(bp) == 0)
+				sbuf_printf(sb, "%s<lunname>%s</lunname>\n",
+				    indent, buf);
 			g_destroy_bio(bp);
 			g_free(buf);
 		} else



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