diff options
author | mav <mav@FreeBSD.org> | 2014-08-17 18:22:42 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-08-17 18:22:42 +0000 |
commit | 6f742fb4d62ea9bdafce0da9fa923bb865cc1bc7 (patch) | |
tree | b1c0a807f72a84bdd3e4998ae5760dabffb4cddf /sys/cam/scsi/scsi_all.c | |
parent | 197183e80f536e00b7917b47c37765bc53e36987 (diff) | |
download | FreeBSD-src-6f742fb4d62ea9bdafce0da9fa923bb865cc1bc7.zip FreeBSD-src-6f742fb4d62ea9bdafce0da9fa923bb865cc1bc7.tar.gz |
MFC r269497:
Add support for Windows dialect of EXTENDED COPY command, aka Microsoft ODX.
This allows to avoid extra network traffic when copying files on NTFS iSCSI
disks within one storage host by drag'n'dropping them in Windows Explorer
of Windows 8/2012. It should also accelerate Hyper-V VM operations, etc.
Diffstat (limited to 'sys/cam/scsi/scsi_all.c')
-rw-r--r-- | sys/cam/scsi/scsi_all.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index 8351aa8..0f80532 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -5435,32 +5435,37 @@ scsi_devid_is_lun_name(uint8_t *bufp) } struct scsi_vpd_id_descriptor * -scsi_get_devid(struct scsi_vpd_device_id *id, uint32_t page_len, +scsi_get_devid_desc(struct scsi_vpd_id_descriptor *desc, uint32_t len, scsi_devid_checkfn_t ck_fn) { - struct scsi_vpd_id_descriptor *desc; - uint8_t *page_end; uint8_t *desc_buf_end; - page_end = (uint8_t *)id + page_len; - if (page_end < id->desc_list) - return (NULL); - - desc_buf_end = MIN(id->desc_list + scsi_2btoul(id->length), page_end); + desc_buf_end = (uint8_t *)desc + len; - for (desc = (struct scsi_vpd_id_descriptor *)id->desc_list; - desc->identifier <= desc_buf_end - && desc->identifier + desc->length <= desc_buf_end; - desc = (struct scsi_vpd_id_descriptor *)(desc->identifier + for (; desc->identifier <= desc_buf_end && + desc->identifier + desc->length <= desc_buf_end; + desc = (struct scsi_vpd_id_descriptor *)(desc->identifier + desc->length)) { if (ck_fn == NULL || ck_fn((uint8_t *)desc) != 0) return (desc); } - return (NULL); } +struct scsi_vpd_id_descriptor * +scsi_get_devid(struct scsi_vpd_device_id *id, uint32_t page_len, + scsi_devid_checkfn_t ck_fn) +{ + uint32_t len; + + if (page_len < sizeof(*id)) + return (NULL); + len = MIN(scsi_2btoul(id->length), page_len - sizeof(*id)); + return (scsi_get_devid_desc((struct scsi_vpd_id_descriptor *) + id->desc_list, len, ck_fn)); +} + int scsi_transportid_sbuf(struct sbuf *sb, struct scsi_transportid_header *hdr, uint32_t valid_len) |