From 4539005d7c27f7f55458340a171a5ad17ffacaef Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 29 Mar 2011 14:30:01 +0000 Subject: [PATCH] Patch from Alexey Obitotskiy making get_initiator_port_transport_id() more flexible git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3322 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- fcst/ft_sess.c | 3 ++- ibmvstgt/src/ibmvstgt.c | 4 ++-- iscsi-scst/kernel/iscsi.c | 4 ++-- qla2x00t/qla2x00-target/qla2x00t.c | 8 ++++---- qla_isp/linux/isp_scst.c | 4 ++-- scst/include/scst.h | 6 +++--- scst/src/scst_pres.c | 11 +++++------ scst/src/scst_targ.c | 4 ++-- scst_local/scst_local.c | 3 ++- srpt/src/ib_srpt.c | 4 ++-- 10 files changed, 26 insertions(+), 25 deletions(-) diff --git a/fcst/ft_sess.c b/fcst/ft_sess.c index 70f84dbbc..1e4d4ac3d 100644 --- a/fcst/ft_sess.c +++ b/fcst/ft_sess.c @@ -303,7 +303,8 @@ static void ft_sess_close(struct ft_sess *sess) /* * Allocate and fill in the SPC Transport ID for persistent reservations. */ -int ft_get_transport_id(struct scst_session *scst_sess, uint8_t **result) +int ft_get_transport_id(struct scst_tgt *tgt, struct scst_session *scst_sess, + uint8_t **result) { struct ft_sess *sess; struct { diff --git a/ibmvstgt/src/ibmvstgt.c b/ibmvstgt/src/ibmvstgt.c index 66c647a06..fd0845edf 100644 --- a/ibmvstgt/src/ibmvstgt.c +++ b/ibmvstgt/src/ibmvstgt.c @@ -1123,8 +1123,8 @@ static int ibmvstgt_get_serial(const struct scst_tgt_dev *tgt_dev, char *buf, * * See also SPC-3, section 7.5.4.5, TransportID for initiator ports using SRP. */ -static int ibmvstgt_get_transportid(struct scst_session *sess, - uint8_t **transport_id) +static int ibmvstgt_get_transportid(struct scst_tgt *tgt, + struct scst_session *sess, uint8_t **transport_id) { struct vio_port *vport; struct spc_rdma_transport_id { diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 6ba91ce69..8e2396abf 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -3650,8 +3650,8 @@ static int iscsi_report_aen(struct scst_aen *aen) return res; } -static int iscsi_get_initiator_port_transport_id(struct scst_session *scst_sess, - uint8_t **transport_id) +static int iscsi_get_initiator_port_transport_id(struct scst_tgt *tgt, + struct scst_session *scst_sess, uint8_t **transport_id) { struct iscsi_session *sess; int res = 0; diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index c1bc416e6..78debb689 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -77,8 +77,8 @@ static int __q24_xmit_response(struct q2t_cmd *cmd, int xmit_type); static int q2t_rdy_to_xfer(struct scst_cmd *scst_cmd); static void q2t_on_free_cmd(struct scst_cmd *scst_cmd); static void q2t_task_mgmt_fn_done(struct scst_mgmt_cmd *mcmd); -static int q2t_get_initiator_port_transport_id(struct scst_session *scst_sess, - uint8_t **transport_id); +static int q2t_get_initiator_port_transport_id(struct scst_tgt *tgt, + struct scst_session *scst_sess, uint8_t **transport_id); /* Predefs for callbacks handed to qla2xxx(target) */ static void q24_atio_pkt(scsi_qla_host_t *ha, atio7_entry_t *pkt); @@ -6114,8 +6114,8 @@ out: #endif /*((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) || \ defined(FC_VPORT_CREATE_DEFINED))*/ -static int q2t_get_initiator_port_transport_id(struct scst_session *scst_sess, - uint8_t **transport_id) +static int q2t_get_initiator_port_transport_id(struct scst_tgt *tgt, + struct scst_session *scst_sess, uint8_t **transport_id) { struct q2t_sess *sess; int res = 0; diff --git a/qla_isp/linux/isp_scst.c b/qla_isp/linux/isp_scst.c index 5d2c60a13..b5da2e5b8 100644 --- a/qla_isp/linux/isp_scst.c +++ b/qla_isp/linux/isp_scst.c @@ -1321,8 +1321,8 @@ isp_task_mgmt_fn_done(struct scst_mgmt_cmd *mgmt_cmd) (*bp->h.r_action) (QIN_NOTIFY_ACK, ins); } -int isp_get_initiator_port_transport_id(struct scst_session *scst_sess, - uint8_t **transport_id) +int isp_get_initiator_port_transport_id(struct scst_tgt *tgt, + struct scst_session *scst_sess, uint8_t **transport_id) { ini_t *ini; int res = 0; diff --git a/scst/include/scst.h b/scst/include/scst.h index cf1d7fda5..18d55e638 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -871,14 +871,14 @@ struct scst_tgt_template { * kfree() it, when it isn't needed anymore. * * If sess is NULL, this function must return TransportID PROTOCOL - * IDENTIFIER of this transport. + * IDENTIFIER for the requested target. * * Returns 0 on success or negative error code otherwise. * * SHOULD HAVE, because it's required for Persistent Reservations. */ - int (*get_initiator_port_transport_id) (struct scst_session *sess, - uint8_t **transport_id); + int (*get_initiator_port_transport_id) (struct scst_tgt *tgt, + struct scst_session *sess, uint8_t **transport_id); /* * This function allows to enable or disable particular target. diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index 23f387579..83361fb4d 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -1469,12 +1469,12 @@ static void scst_pr_unregister_all_tg_pt(struct scst_device *dev, if (tgtt->get_initiator_port_transport_id == NULL) continue; - if (tgtt->get_initiator_port_transport_id(NULL, NULL) != proto_id) - continue; - list_for_each_entry(tgt, &tgtt->tgt_list, tgt_list_entry) { struct scst_dev_registrant *reg; + if (tgtt->get_initiator_port_transport_id(tgt, NULL, NULL) != proto_id) + continue; + reg = scst_pr_find_reg(dev, transport_id, tgt->rel_tgt_id); if (reg == NULL) @@ -1556,12 +1556,11 @@ static int scst_pr_register_all_tg_pt(struct scst_cmd *cmd, uint8_t *buffer, if (tgtt->get_initiator_port_transport_id == NULL) continue; - if (tgtt->get_initiator_port_transport_id(NULL, NULL) != proto_id) - continue; - TRACE_PR("tgtt %s, spec_i_pt %d", tgtt->name, spec_i_pt); list_for_each_entry(tgt, &tgtt->tgt_list, tgt_list_entry) { + if (tgtt->get_initiator_port_transport_id(tgt, NULL, NULL) != proto_id) + continue; if (tgt->rel_tgt_id == 0) continue; TRACE_PR("tgt %s, rel_tgt_id %d", tgt->tgt_name, diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 319ea0bda..4b51c1a5f 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -6198,8 +6198,8 @@ static int scst_init_session(struct scst_session *sess) list_add_tail(&sess->sess_list_entry, &sess->tgt->sess_list); if (sess->tgt->tgtt->get_initiator_port_transport_id != NULL) { - res = sess->tgt->tgtt->get_initiator_port_transport_id(sess, - &sess->transport_id); + res = sess->tgt->tgtt->get_initiator_port_transport_id( + sess->tgt, sess, &sess->transport_id); if (res != 0) { PRINT_ERROR("Unable to make initiator %s port " "transport id", sess->initiator_name); diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 85e5bb86f..2499df9bb 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -239,7 +239,8 @@ out: } static int scst_local_get_initiator_port_transport_id( - struct scst_session *scst_sess, uint8_t **transport_id) + struct scst_tgt *tgt, struct scst_session *scst_sess, + uint8_t **transport_id) { int res = 0; int tr_id_size = 0; diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index d8b46ea5f..ea304ea3a 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -3195,8 +3195,8 @@ static void srpt_tsk_mgmt_done(struct scst_mgmt_cmd *mcmnd) * * See also SPC-3, section 7.5.4.5, TransportID for initiator ports using SRP. */ -static int srpt_get_initiator_port_transport_id(struct scst_session *scst_sess, - uint8_t **transport_id) +static int srpt_get_initiator_port_transport_id(struct scst_tgt *tgt, + struct scst_session *scst_sess, uint8_t **transport_id) { struct srpt_rdma_ch *ch; struct spc_rdma_transport_id {