svn commit: r311425 - in stable/10/sys/cam: . scsi
Alexander Motin
mav at FreeBSD.org
Thu Jan 5 11:43:48 UTC 2017
Author: mav
Date: Thu Jan 5 11:43:47 2017
New Revision: 311425
URL: https://svnweb.freebsd.org/changeset/base/311425
Log:
MFC r310360, r310361: Report UUID and MD5 LUN IDs.
Modified:
stable/10/sys/cam/cam_xpt.c
stable/10/sys/cam/scsi/scsi_all.c
stable/10/sys/cam/scsi/scsi_all.h
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/cam/cam_xpt.c
==============================================================================
--- stable/10/sys/cam/cam_xpt.c Thu Jan 5 11:43:01 2017 (r311424)
+++ stable/10/sys/cam/cam_xpt.c Thu Jan 5 11:43:47 2017 (r311425)
@@ -1096,7 +1096,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;
@@ -1136,6 +1136,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)
@@ -1162,6 +1168,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/10/sys/cam/scsi/scsi_all.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_all.c Thu Jan 5 11:43:01 2017 (r311424)
+++ stable/10/sys/cam/scsi/scsi_all.c Thu Jan 5 11:43:47 2017 (r311425)
@@ -5639,6 +5639,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/10/sys/cam/scsi/scsi_all.h
==============================================================================
--- stable/10/sys/cam/scsi/scsi_all.h Thu Jan 5 11:43:01 2017 (r311424)
+++ stable/10/sys/cam/scsi/scsi_all.h Thu Jan 5 11:43:47 2017 (r311425)
@@ -3672,6 +3672,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,
More information about the svn-src-stable
mailing list