Deleted Added
full compact
ctl_frontend_iscsi.c (268145) ctl_frontend_iscsi.c (268147)
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 268145 2014-07-02 10:37:22Z mav $
29 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 268147 2014-07-02 10:39:45Z 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 268145 2014-07-02 10:37:22Z mav $");
37__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 268147 2014-07-02 10:39:45Z 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>

--- 1994 unchanged lines hidden (view full) ---

2040 char *val;
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);
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>

--- 1994 unchanged lines hidden (view full) ---

2040 char *val;
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");
2048 wwpn_len += strlen(",t,0x0001");
2049 wwpn_len += 1; /* '\0' */
2050 if ((wwpn_len % 4) != 0)
2051 wwpn_len += (4 - (wwpn_len % 4));
2052
2053 devid_len = sizeof(struct scsi_vpd_device_id) +
2054 sizeof(struct scsi_vpd_id_descriptor) +
2055 sizeof(struct scsi_vpd_id_t10) + CTL_DEVID_LEN +
2056 sizeof(struct scsi_vpd_id_descriptor) + wwpn_len +

--- 72 unchanged lines hidden (view full) ---

2129
2130 /*
2131 * desc1 is for the WWPN which is a port asscociation.
2132 */
2133 desc1->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_UTF8;
2134 desc1->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
2135 SVPD_ID_TYPE_SCSI_NAME;
2136 desc1->length = wwpn_len;
2049 wwpn_len += 1; /* '\0' */
2050 if ((wwpn_len % 4) != 0)
2051 wwpn_len += (4 - (wwpn_len % 4));
2052
2053 devid_len = sizeof(struct scsi_vpd_device_id) +
2054 sizeof(struct scsi_vpd_id_descriptor) +
2055 sizeof(struct scsi_vpd_id_t10) + CTL_DEVID_LEN +
2056 sizeof(struct scsi_vpd_id_descriptor) + wwpn_len +

--- 72 unchanged lines hidden (view full) ---

2129
2130 /*
2131 * desc1 is for the WWPN which is a port asscociation.
2132 */
2133 desc1->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_UTF8;
2134 desc1->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
2135 SVPD_ID_TYPE_SCSI_NAME;
2136 desc1->length = wwpn_len;
2137 snprintf(desc1->identifier, wwpn_len, "%s,t,0x%x",
2137 snprintf(desc1->identifier, wwpn_len, "%s,t,0x%4.4x",
2138 cs->cs_target->ct_name, cs->cs_portal_group_tag);
2139
2140 /*
2141 * desc2 is for the Relative Target Port(type 4h) identifier
2142 */
2143 desc2->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_BINARY;
2144 desc2->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
2145 SVPD_ID_TYPE_RELTARG;

--- 733 unchanged lines hidden ---
2138 cs->cs_target->ct_name, cs->cs_portal_group_tag);
2139
2140 /*
2141 * desc2 is for the Relative Target Port(type 4h) identifier
2142 */
2143 desc2->proto_codeset = (SCSI_PROTO_ISCSI << 4) | SVPD_ID_CODESET_BINARY;
2144 desc2->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT |
2145 SVPD_ID_TYPE_RELTARG;

--- 733 unchanged lines hidden ---