Date: Thu, 5 Jan 2017 11:43:02 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r311424 - in stable/11/sys/cam: . scsi Message-ID: <201701051143.v05Bh2gO058348@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Jan 5 11:43:01 2017 New Revision: 311424 URL: https://svnweb.freebsd.org/changeset/base/311424 Log: MFC r310360, r310361: Report UUID and MD5 LUN IDs. Modified: stable/11/sys/cam/cam_xpt.c stable/11/sys/cam/scsi/scsi_all.c stable/11/sys/cam/scsi/scsi_all.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_xpt.c ============================================================================== --- stable/11/sys/cam/cam_xpt.c Thu Jan 5 11:41:53 2017 (r311423) +++ stable/11/sys/cam/cam_xpt.c Thu Jan 5 11:43:01 2017 (r311424) @@ -1097,7 +1097,7 @@ xpt_denounce_periph(struct cam_periph *p int xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path) { - int ret = -1, l; + int ret = -1, l, o; struct ccb_dev_advinfo cdai; struct scsi_vpd_id_descriptor *idd; @@ -1137,6 +1137,12 @@ xpt_getattr(char *buf, size_t len, const if (idd == NULL) idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, cdai.provsiz, scsi_devid_is_lun_eui64); + if (idd == NULL) + idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, + cdai.provsiz, scsi_devid_is_lun_uuid); + if (idd == NULL) + idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, + cdai.provsiz, scsi_devid_is_lun_md5); } else idd = NULL; if (idd == NULL) @@ -1163,6 +1169,17 @@ xpt_getattr(char *buf, size_t len, const buf[l] = 0; } else ret = EFAULT; + } else if ((idd->id_type & SVPD_ID_TYPE_MASK) == SVPD_ID_TYPE_UUID + && idd->identifier[0] == 0x10) { + if ((idd->length - 2) * 2 + 4 < len) { + for (l = 2, o = 0; l < idd->length; l++) { + if (l == 6 || l == 8 || l == 10 || l == 12) + o += sprintf(buf + o, "-"); + o += sprintf(buf + o, "%02x", + idd->identifier[l]); + } + } else + ret = EFAULT; } else { if (idd->length * 2 < len) { for (l = 0; l < idd->length; l++) Modified: stable/11/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_all.c Thu Jan 5 11:41:53 2017 (r311423) +++ stable/11/sys/cam/scsi/scsi_all.c Thu Jan 5 11:43:01 2017 (r311424) @@ -5691,6 +5691,32 @@ scsi_devid_is_lun_name(uint8_t *bufp) } int +scsi_devid_is_lun_md5(uint8_t *bufp) +{ + struct scsi_vpd_id_descriptor *descr; + + descr = (struct scsi_vpd_id_descriptor *)bufp; + if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) + return 0; + if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_MD5_LUN_ID) + return 0; + return 1; +} + +int +scsi_devid_is_lun_uuid(uint8_t *bufp) +{ + struct scsi_vpd_id_descriptor *descr; + + descr = (struct scsi_vpd_id_descriptor *)bufp; + if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) + return 0; + if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_UUID) + return 0; + return 1; +} + +int scsi_devid_is_port_naa(uint8_t *bufp) { struct scsi_vpd_id_descriptor *descr; Modified: stable/11/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/11/sys/cam/scsi/scsi_all.h Thu Jan 5 11:41:53 2017 (r311423) +++ stable/11/sys/cam/scsi/scsi_all.h Thu Jan 5 11:43:01 2017 (r311424) @@ -3782,6 +3782,8 @@ int scsi_devid_is_lun_eui64(uint8_t *bu int scsi_devid_is_lun_naa(uint8_t *bufp); int scsi_devid_is_lun_name(uint8_t *bufp); int scsi_devid_is_lun_t10(uint8_t *bufp); +int scsi_devid_is_lun_md5(uint8_t *bufp); +int scsi_devid_is_lun_uuid(uint8_t *bufp); int scsi_devid_is_port_naa(uint8_t *bufp); struct scsi_vpd_id_descriptor * scsi_get_devid(struct scsi_vpd_device_id *id, uint32_t len,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701051143.v05Bh2gO058348>