diff options
author | Or Gerlitz <ogerlitz@voltaire.com> | 2006-05-02 20:46:36 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-05-10 11:11:38 -0400 |
commit | 264faaaa12544e7914928ad57ccba21907cad56b (patch) | |
tree | eb8a6993e43f3802b203b371b81fcfb89fc4f754 /drivers/scsi | |
parent | 169e1a2a8a789fa84254695ec6a56fc410bb19a9 (diff) |
[SCSI] iscsi: add transport end point callbacks
add transport end point callbacks so iscsi drivers that cannot connect
from userspace, like iscsi tcp, using sockets do not have to
implement their own socket infrastructure.
Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 4 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 41 |
2 files changed, 42 insertions, 3 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index fe00a3f6d204..ac507daacfeb 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -1975,7 +1975,7 @@ iscsi_tcp_conn_destroy(struct iscsi_cls_conn *cls_conn) | |||
1975 | 1975 | ||
1976 | static int | 1976 | static int |
1977 | iscsi_tcp_conn_bind(struct iscsi_cls_session *cls_session, | 1977 | iscsi_tcp_conn_bind(struct iscsi_cls_session *cls_session, |
1978 | struct iscsi_cls_conn *cls_conn, uint32_t transport_fd, | 1978 | struct iscsi_cls_conn *cls_conn, uint64_t transport_eph, |
1979 | int is_leading) | 1979 | int is_leading) |
1980 | { | 1980 | { |
1981 | struct iscsi_conn *conn = cls_conn->dd_data; | 1981 | struct iscsi_conn *conn = cls_conn->dd_data; |
@@ -1985,7 +1985,7 @@ iscsi_tcp_conn_bind(struct iscsi_cls_session *cls_session, | |||
1985 | int err; | 1985 | int err; |
1986 | 1986 | ||
1987 | /* lookup for existing socket */ | 1987 | /* lookup for existing socket */ |
1988 | sock = sockfd_lookup(transport_fd, &err); | 1988 | sock = sockfd_lookup((int)transport_eph, &err); |
1989 | if (!sock) { | 1989 | if (!sock) { |
1990 | printk(KERN_ERR "iscsi_tcp: sockfd_lookup failed %d\n", err); | 1990 | printk(KERN_ERR "iscsi_tcp: sockfd_lookup failed %d\n", err); |
1991 | return -EEXIST; | 1991 | return -EEXIST; |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index bc9071d2d212..7b7a194822da 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -929,6 +929,40 @@ iscsi_set_param(struct iscsi_transport *transport, struct iscsi_uevent *ev) | |||
929 | } | 929 | } |
930 | 930 | ||
931 | static int | 931 | static int |
932 | iscsi_if_transport_ep(struct iscsi_transport *transport, | ||
933 | struct iscsi_uevent *ev, int msg_type) | ||
934 | { | ||
935 | struct sockaddr *dst_addr; | ||
936 | int rc = 0; | ||
937 | |||
938 | switch (msg_type) { | ||
939 | case ISCSI_UEVENT_TRANSPORT_EP_CONNECT: | ||
940 | if (!transport->ep_connect) | ||
941 | return -EINVAL; | ||
942 | |||
943 | dst_addr = (struct sockaddr *)((char*)ev + sizeof(*ev)); | ||
944 | rc = transport->ep_connect(dst_addr, | ||
945 | ev->u.ep_connect.non_blocking, | ||
946 | &ev->r.ep_connect_ret.handle); | ||
947 | break; | ||
948 | case ISCSI_UEVENT_TRANSPORT_EP_POLL: | ||
949 | if (!transport->ep_poll) | ||
950 | return -EINVAL; | ||
951 | |||
952 | ev->r.retcode = transport->ep_poll(ev->u.ep_poll.ep_handle, | ||
953 | ev->u.ep_poll.timeout_ms); | ||
954 | break; | ||
955 | case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT: | ||
956 | if (!transport->ep_disconnect) | ||
957 | return -EINVAL; | ||
958 | |||
959 | transport->ep_disconnect(ev->u.ep_disconnect.ep_handle); | ||
960 | break; | ||
961 | } | ||
962 | return rc; | ||
963 | } | ||
964 | |||
965 | static int | ||
932 | iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | 966 | iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
933 | { | 967 | { |
934 | int err = 0; | 968 | int err = 0; |
@@ -974,7 +1008,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
974 | 1008 | ||
975 | if (session && conn) | 1009 | if (session && conn) |
976 | ev->r.retcode = transport->bind_conn(session, conn, | 1010 | ev->r.retcode = transport->bind_conn(session, conn, |
977 | ev->u.b_conn.transport_fd, | 1011 | ev->u.b_conn.transport_eph, |
978 | ev->u.b_conn.is_leading); | 1012 | ev->u.b_conn.is_leading); |
979 | else | 1013 | else |
980 | err = -EINVAL; | 1014 | err = -EINVAL; |
@@ -1009,6 +1043,11 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
1009 | case ISCSI_UEVENT_GET_STATS: | 1043 | case ISCSI_UEVENT_GET_STATS: |
1010 | err = iscsi_if_get_stats(transport, nlh); | 1044 | err = iscsi_if_get_stats(transport, nlh); |
1011 | break; | 1045 | break; |
1046 | case ISCSI_UEVENT_TRANSPORT_EP_CONNECT: | ||
1047 | case ISCSI_UEVENT_TRANSPORT_EP_POLL: | ||
1048 | case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT: | ||
1049 | err = iscsi_if_transport_ep(transport, ev, nlh->nlmsg_type); | ||
1050 | break; | ||
1012 | default: | 1051 | default: |
1013 | err = -EINVAL; | 1052 | err = -EINVAL; |
1014 | break; | 1053 | break; |