summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-08-24 09:42:14 +0000
committermav <mav@FreeBSD.org>2013-08-24 09:42:14 +0000
commite8031ce26c0c12d1c7b4c0eb69a6887d48355ccf (patch)
tree724c9efe931c745ab377f18541d3a299e6100904 /sys/cam
parent281a193b5361cf3955f69760d10d8bb1e29651c7 (diff)
downloadFreeBSD-src-e8031ce26c0c12d1c7b4c0eb69a6887d48355ccf.zip
FreeBSD-src-e8031ce26c0c12d1c7b4c0eb69a6887d48355ccf.tar.gz
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.
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/cam_xpt.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 2b94d10..da0b4da 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -1091,7 +1091,8 @@ xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path)
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 char *attr, struct cam_path *path)
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);
OpenPOWER on IntegriCloud