summaryrefslogtreecommitdiffstats
path: root/lib/libcam
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2013-12-10 22:55:22 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2013-12-10 22:55:22 +0000
commitebd6e46afc039487de816679ccd814d942b9fa8e (patch)
treea62a3ba1c112ab79fb456e1d6a5ccc8a5acf663c /lib/libcam
parent7d9ae8a27ce80284899505ce7b0e40604cb11a34 (diff)
downloadFreeBSD-src-ebd6e46afc039487de816679ccd814d942b9fa8e.zip
FreeBSD-src-ebd6e46afc039487de816679ccd814d942b9fa8e.tar.gz
MFC r257345,257382,257388:
Implement extended LUN support. If PIM_EXTLUNS is set by a SIM, encode the upper 32-bits of the LUN, if possible, into the target_lun field as passed directly from the REPORT LUNs response. This allows extended LUN support to work for all LUNs with zeros in the lower 32-bits, which covers most addressing modes without breaking KBI. Behavior for drivers not setting PIM_EXTLUNS is unchanged. No user-facing interfaces are modified. Extended LUNs are stored with swizzled 16-bit word order so that, for devices implementing LUN addressing (like SCSI-2), the numerical representation of the LUN is identical with and without PIM_EXTLUNS. Thus setting PIM_EXTLUNS keeps most behavior, and user-facing LUN IDs, unchanged. This follows the strategy used in Solaris. A macro (CAM_EXTLUN_BYTE_SWIZZLE) is provided to transform a lun_id_t into a uint64_t ordered for the wire. This is the second part of work for full 64-bit extended LUN support and is designed to a bridge for stable/10 to the final 64-bit LUN code. The third and final part will involve widening lun_id_t to 64 bits and will not be MFCed. This third part will break the KBI but will keep the KPI unchanged so that all drivers that will care about this can be updated now and not require code changes between HEAD and stable/10. Reviewed by: scottl
Diffstat (limited to 'lib/libcam')
-rw-r--r--lib/libcam/camlib.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libcam/camlib.c b/lib/libcam/camlib.c
index cd59922..f320247 100644
--- a/lib/libcam/camlib.c
+++ b/lib/libcam/camlib.c
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
@@ -348,16 +349,16 @@ cam_open_btl(path_id_t path_id, target_id_t target_id, lun_id_t target_lun,
if (ccb.cdm.status == CAM_DEV_MATCH_MORE) {
snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
"%s: CDM reported more than one"
- " passthrough device at %d:%d:%d!!\n",
- func_name, path_id, target_id, target_lun);
+ " passthrough device at %d:%d:%jx!!\n",
+ func_name, path_id, target_id, (uintmax_t)target_lun);
goto btl_bailout;
}
if (ccb.cdm.num_matches == 0) {
snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
"%s: no passthrough device found at"
- " %d:%d:%d", func_name, path_id, target_id,
- target_lun);
+ " %d:%d:%jx", func_name, path_id, target_id,
+ (uintmax_t)target_lun);
goto btl_bailout;
}
@@ -687,14 +688,14 @@ cam_path_string(struct cam_device *dev, char *str, int len)
return(str);
}
- snprintf(str, len, "(%s%d:%s%d:%d:%d:%d): ",
+ snprintf(str, len, "(%s%d:%s%d:%d:%d:%jx): ",
(dev->device_name[0] != '\0') ? dev->device_name : "pass",
dev->dev_unit_num,
(dev->sim_name[0] != '\0') ? dev->sim_name : "unknown",
dev->sim_unit_number,
dev->bus_id,
dev->target_id,
- dev->target_lun);
+ (uintmax_t)dev->target_lun);
return(str);
}
OpenPOWER on IntegriCloud