From owner-svn-src-all@FreeBSD.ORG Sat Sep 14 09:49:19 2013 Return-Path: Delivered-To: svn-src-all@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 ESMTP id D7BF0B1D; Sat, 14 Sep 2013 09:49:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) 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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AA73A2C8F; Sat, 14 Sep 2013 09:49:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9nJcp017269; Sat, 14 Sep 2013 09:49:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9nJsn017267; Sat, 14 Sep 2013 09:49:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140949.r8E9nJsn017267@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255556 - in stable/9/sys: cam geom X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:49:19 -0000 Author: mav Date: Sat Sep 14 09:49:18 2013 New Revision: 255556 URL: http://svnweb.freebsd.org/changeset/base/255556 Log: MFC r254766: 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: stable/9/sys/cam/cam_xpt.c stable/9/sys/geom/geom_disk.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Sat Sep 14 09:42:01 2013 (r255555) +++ stable/9/sys/cam/cam_xpt.c Sat Sep 14 09:49:18 2013 (r255556) @@ -1157,7 +1157,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 @@ -1174,11 +1175,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: stable/9/sys/geom/geom_disk.c ============================================================================== --- stable/9/sys/geom/geom_disk.c Sat Sep 14 09:42:01 2013 (r255555) +++ stable/9/sys/geom/geom_disk.c Sat Sep 14 09:49:18 2013 (r255556) @@ -466,6 +466,12 @@ g_disk_dumpconf(struct sbuf *sb, const c if (dp->d_getattr(bp) == 0) sbuf_printf(sb, "%s%s\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%s\n", + indent, buf); g_destroy_bio(bp); g_free(buf); } else