ctl_frontend_iscsi.c (268143) | ctl_frontend_iscsi.c (268145) |
---|---|
1/*- 2 * Copyright (c) 2012 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Edward Tomasz Napierala under sponsorship 6 * from the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2012 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Edward Tomasz Napierala under sponsorship 6 * from the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 268143 2014-07-02 10:35:06Z mav $ | 29 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 268145 2014-07-02 10:37:22Z mav $ |
30 */ 31 32/* 33 * CTL frontend for the iSCSI protocol. 34 */ 35 36#include <sys/cdefs.h> | 30 */ 31 32/* 33 * CTL frontend for the iSCSI protocol. 34 */ 35 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 268143 2014-07-02 10:35:06Z mav $"); | 37__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 268145 2014-07-02 10:37:22Z mav $"); |
38 39#include <sys/param.h> 40#include <sys/capability.h> 41#include <sys/condvar.h> 42#include <sys/file.h> 43#include <sys/kernel.h> 44#include <sys/kthread.h> 45#include <sys/lock.h> --- 1986 unchanged lines hidden (view full) --- 2032{ 2033 struct cfiscsi_session *cs; 2034 struct scsi_vpd_device_id *devid_ptr; 2035 struct scsi_vpd_id_descriptor *desc, *desc1; 2036 struct scsi_vpd_id_descriptor *desc2, *desc3; /* for types 4h and 5h */ 2037 struct scsi_vpd_id_t10 *t10id; 2038 struct ctl_lun *lun; 2039 const struct icl_pdu *request; | 38 39#include <sys/param.h> 40#include <sys/capability.h> 41#include <sys/condvar.h> 42#include <sys/file.h> 43#include <sys/kernel.h> 44#include <sys/kthread.h> 45#include <sys/lock.h> --- 1986 unchanged lines hidden (view full) --- 2032{ 2033 struct cfiscsi_session *cs; 2034 struct scsi_vpd_device_id *devid_ptr; 2035 struct scsi_vpd_id_descriptor *desc, *desc1; 2036 struct scsi_vpd_id_descriptor *desc2, *desc3; /* for types 4h and 5h */ 2037 struct scsi_vpd_id_t10 *t10id; 2038 struct ctl_lun *lun; 2039 const struct icl_pdu *request; |
2040 char *val; |
|
2040 size_t devid_len, wwpn_len; 2041 2042 lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; 2043 request = ctsio->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; 2044 cs = PDU_SESSION(request); 2045 2046 wwpn_len = strlen(cs->cs_target->ct_name); 2047 wwpn_len += strlen(",t,0x01"); --- 48 unchanged lines hidden (view full) --- 2096 2097 /* 2098 * We're using a LUN association here. i.e., this device ID is a 2099 * per-LUN identifier. 2100 */ 2101 desc->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_ASCII; 2102 desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10; 2103 desc->length = sizeof(*t10id) + CTL_DEVID_LEN; | 2041 size_t devid_len, wwpn_len; 2042 2043 lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; 2044 request = ctsio->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; 2045 cs = PDU_SESSION(request); 2046 2047 wwpn_len = strlen(cs->cs_target->ct_name); 2048 wwpn_len += strlen(",t,0x01"); --- 48 unchanged lines hidden (view full) --- 2097 2098 /* 2099 * We're using a LUN association here. i.e., this device ID is a 2100 * per-LUN identifier. 2101 */ 2102 desc->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_ASCII; 2103 desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10; 2104 desc->length = sizeof(*t10id) + CTL_DEVID_LEN; |
2104 strncpy((char *)t10id->vendor, CTL_VENDOR, sizeof(t10id->vendor)); | 2105 if (lun == NULL || (val = ctl_get_opt(lun->be_lun, "vendor")) == NULL) { 2106 strncpy((char *)t10id->vendor, CTL_VENDOR, sizeof(t10id->vendor)); 2107 } else { 2108 memset(t10id->vendor, ' ', sizeof(t10id->vendor)); 2109 strncpy(t10id->vendor, val, 2110 min(sizeof(t10id->vendor), strlen(val))); 2111 } |
2105 2106 /* 2107 * If we've actually got a backend, copy the device id from the 2108 * per-LUN data. Otherwise, set it to all spaces. 2109 */ 2110 if (lun != NULL) { 2111 /* 2112 * Copy the backend's LUN ID. --- 759 unchanged lines hidden --- | 2112 2113 /* 2114 * If we've actually got a backend, copy the device id from the 2115 * per-LUN data. Otherwise, set it to all spaces. 2116 */ 2117 if (lun != NULL) { 2118 /* 2119 * Copy the backend's LUN ID. --- 759 unchanged lines hidden --- |