From 25ed58e17f528f9408bef469ea813292be541b72 Mon Sep 17 00:00:00 2001 From: mav Date: Thu, 5 Jan 2017 11:43:47 +0000 Subject: MFC r310360, r310361: Report UUID and MD5 LUN IDs. --- sys/cam/cam_xpt.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'sys/cam/cam_xpt.c') diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 184d43e..3cf307a 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -1096,7 +1096,7 @@ xpt_denounce_periph(struct cam_periph *periph) 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; @@ -1136,6 +1136,12 @@ xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path) 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) @@ -1162,6 +1168,17 @@ xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path) 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++) -- cgit v1.1