[Stgt-devel] [PATCH 10/20] iser connection transport data
Pete Wyckoff
pw
Tue Oct 16 17:20:44 CEST 2007
Add a private data field to iscsi_connection to hold state for the
transport, and allocate room for it at connection allocation time.
Move the TCP socket fd from generic code into this private data region.
Also virtualize getsockname and getpeername as TCP and RDMA determine
those IP addresses differently.
Signed-off-by: Pete Wyckoff <pw at osc.edu>
---
usr/iscsi/conn.c | 21 +++++++-------
usr/iscsi/iscsi_tcp.c | 72 ++++++++++++++++++++++++++++++++++++------------
usr/iscsi/iscsid.c | 58 +++++++++++++++++++-------------------
usr/iscsi/iscsid.h | 14 +++++-----
usr/iscsi/session.c | 2 +-
usr/iscsi/target.c | 10 +++---
usr/iscsi/transport.h | 20 +++++++++----
7 files changed, 120 insertions(+), 77 deletions(-)
diff --git a/usr/iscsi/conn.c b/usr/iscsi/conn.c
index fcd2385..1e9dace 100644
--- a/usr/iscsi/conn.c
+++ b/usr/iscsi/conn.c
@@ -42,11 +42,11 @@ void conn_add_to_session(struct iscsi_connection *conn, struct iscsi_session *se
list_add(&conn->clist, &session->conn_list);
}
-struct iscsi_connection *conn_alloc(void)
+struct iscsi_connection *conn_alloc(unsigned int trans_len)
{
struct iscsi_connection *conn;
- conn = zalloc(sizeof(*conn));
+ conn = zalloc(sizeof(*conn) + trans_len);
if (!conn)
return NULL;
@@ -69,6 +69,9 @@ struct iscsi_connection *conn_alloc(void)
INIT_LIST_HEAD(&conn->clist);
INIT_LIST_HEAD(&conn->tx_clist);
+ if (trans_len)
+ conn->trans_data = &conn[1];
+
return conn;
}
@@ -87,12 +90,11 @@ static void conn_free(struct iscsi_connection *conn)
session_put(session);
}
-void conn_close(struct iscsi_connection *conn, int fd)
+void conn_close(struct iscsi_connection *conn)
{
struct iscsi_task *task, *tmp;
- tgt_event_del(fd);
- conn->tp->ep_close(fd);
+ conn->tp->ep_close(conn);
dprintf("connection closed\n");
@@ -166,13 +168,10 @@ struct iscsi_connection *conn_find(struct iscsi_session *session, uint32_t cid)
return NULL;
}
-int conn_take_fd(struct iscsi_connection *conn, int fd)
+int conn_take_fd(struct iscsi_connection *conn)
{
- uint64_t sid = sid64(conn->isid, conn->tsih);
-
- dprintf("conn_take_fd: %d %u %u %u %" PRIx64 "\n",
- fd, conn->cid, conn->stat_sn, conn->exp_stat_sn, sid);
+ dprintf("%u %u %u %" PRIx64 "\n", conn->cid, conn->stat_sn,
+ conn->exp_stat_sn, sid64(conn->isid, conn->tsih));
conn->session->conn_cnt++;
-
return 0;
}
diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c
index 7e0ab90..33cd6f8 100644
--- a/usr/iscsi/iscsi_tcp.c
+++ b/usr/iscsi/iscsi_tcp.c
@@ -42,6 +42,10 @@
static void iscsi_tcp_event_handler(int fd, int events, void *data);
+struct tcp_conn_info {
+ int fd;
+};
+
static int set_keepalive(int fd)
{
int ret, opt;
@@ -74,6 +78,7 @@ static void accept_connection(int afd, int events, void *data)
struct sockaddr_storage from;
socklen_t namesize;
struct iscsi_connection *conn;
+ struct tcp_conn_info *tci;
int fd, err;
dprintf("%d\n", afd);
@@ -89,11 +94,12 @@ static void accept_connection(int afd, int events, void *data)
if (err)
goto out;
- conn = conn_alloc();
+ conn = conn_alloc(sizeof(*tci));
if (!conn)
goto out;
- conn->fd = fd;
+ tci = conn->trans_data;
+ tci->fd = fd;
conn->tp = &iscsi_tcp;
conn_read_pdu(conn);
@@ -116,16 +122,16 @@ static void iscsi_tcp_event_handler(int fd, int events, void *data)
struct iscsi_connection *conn = (struct iscsi_connection *) data;
if (events & EPOLLIN)
- iscsi_rx_handler(fd, conn);
+ iscsi_rx_handler(conn);
if (conn->state == STATE_CLOSE)
dprintf("connection closed\n");
if (conn->state != STATE_CLOSE && events & EPOLLOUT)
- iscsi_tx_handler(fd, conn);
+ iscsi_tx_handler(conn);
if (conn->state == STATE_CLOSE) {
- conn_close(conn, fd);
+ conn_close(conn);
dprintf("connection closed\n");
}
}
@@ -204,38 +210,49 @@ static int iscsi_tcp_init(void)
return !nr_sock;
}
-static size_t iscsi_tcp_read (int ep, void *buf, size_t nbytes)
+static size_t iscsi_tcp_read(struct iscsi_connection *conn, void *buf,
+ size_t nbytes)
{
- return read(ep, buf, nbytes);
+ struct tcp_conn_info *tci = conn->trans_data;
+ return read(tci->fd, buf, nbytes);
}
-static size_t iscsi_tcp_write_begin(int ep, void *buf, size_t nbytes)
+static size_t iscsi_tcp_write_begin(struct iscsi_connection *conn, void *buf,
+ size_t nbytes)
{
+ struct tcp_conn_info *tci = conn->trans_data;
int opt = 1;
- setsockopt(ep, SOL_TCP, TCP_CORK, &opt, sizeof(opt));
- return write(ep, buf, nbytes);
+
+ setsockopt(tci->fd, SOL_TCP, TCP_CORK, &opt, sizeof(opt));
+ return write(tci->fd, buf, nbytes);
}
-static void iscsi_tcp_write_end(int ep)
+static void iscsi_tcp_write_end(struct iscsi_connection *conn)
{
+ struct tcp_conn_info *tci = conn->trans_data;
int opt = 0;
- setsockopt(ep, SOL_TCP, TCP_CORK, &opt, sizeof(opt));
+
+ setsockopt(tci->fd, SOL_TCP, TCP_CORK, &opt, sizeof(opt));
}
-static size_t iscsi_tcp_close(int ep)
+static size_t iscsi_tcp_close(struct iscsi_connection *conn)
{
- return close(ep);
+ struct tcp_conn_info *tci = conn->trans_data;
+
+ tgt_event_del(tci->fd);
+ return close(tci->fd);
}
-static int iscsi_tcp_show(int ep, char *buf, int rest)
+static int iscsi_tcp_show(struct iscsi_connection *conn, char *buf, int rest)
{
+ struct tcp_conn_info *tci = conn->trans_data;
int err, total = 0;
socklen_t slen;
char dst[INET6_ADDRSTRLEN];
struct sockaddr_storage from;
slen = sizeof(from);
- err = getpeername(ep, (struct sockaddr *) &from, &slen);
+ err = getpeername(tci->fd, (struct sockaddr *) &from, &slen);
if (err < 0) {
eprintf("%m\n");
return 0;
@@ -253,11 +270,12 @@ static int iscsi_tcp_show(int ep, char *buf, int rest)
return total > 0 ? total : 0;
}
-void iscsi_event_modify(int fd, int events)
+void iscsi_event_modify(struct iscsi_connection *conn, int events)
{
int ret;
+ struct tcp_conn_info *tci = conn->trans_data;
- ret = tgt_event_modify(fd, events);
+ ret = tgt_event_modify(tci->fd, events);
if (ret)
eprintf("tgt_event_modify failed\n");
}
@@ -274,6 +292,22 @@ void iscsi_tcp_free(struct iscsi_connection *conn __attribute__((unused)),
free(buf);
}
+int iscsi_tcp_getsockname(struct iscsi_connection *conn, struct sockaddr *sa,
+ socklen_t *len)
+{
+ struct tcp_conn_info *tci = conn->trans_data;
+
+ return getsockname(tci->fd, sa, len);
+}
+
+int iscsi_tcp_getpeername(struct iscsi_connection *conn, struct sockaddr *sa,
+ socklen_t *len)
+{
+ struct tcp_conn_info *tci = conn->trans_data;
+
+ return getpeername(tci->fd, sa, len);
+}
+
struct iscsi_transport iscsi_tcp = {
.name = "iscsi",
.rdma = 0,
@@ -286,4 +320,6 @@ struct iscsi_transport iscsi_tcp = {
.ep_event_modify = iscsi_event_modify,
.ep_malloc = iscsi_tcp_malloc,
.ep_free = iscsi_tcp_free,
+ .ep_getsockname = iscsi_tcp_getsockname,
+ .ep_getpeername = iscsi_tcp_getpeername,
};
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 85c7724..51d9bd9 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -435,7 +435,7 @@ static void login_start(struct iscsi_connection *conn)
return;
}
- if (ip_acl(conn->tid, conn->fd)) {
+ if (ip_acl(conn->tid, conn)) {
rsp->status_class = ISCSI_STATUS_CLS_INITIATOR_ERR;
rsp->status_detail = ISCSI_LOGIN_STATUS_TGT_NOT_FOUND;
conn->state = STATE_EXIT;
@@ -687,7 +687,8 @@ static void text_scan_text(struct iscsi_connection *conn)
blen = sizeof(buf);
slen = sizeof(ss);
- getsockname(conn->fd, (struct sockaddr *) &ss, &slen);
+ conn->tp->ep_getsockname(conn, (struct sockaddr *) &ss,
+ &slen);
if (ss.ss_family == AF_INET6) {
*p++ = '[';
blen--;
@@ -1037,7 +1038,7 @@ static int iscsi_scsi_cmd_done(uint64_t nid, int result, struct scsi_cmd *scmd)
}
list_add_tail(&task->c_list, &task->conn->tx_clist);
- task->conn->tp->ep_event_modify(task->conn->fd, EPOLLIN | EPOLLOUT);
+ task->conn->tp->ep_event_modify(task->conn, EPOLLIN | EPOLLOUT);
return 0;
}
@@ -1167,7 +1168,7 @@ int iscsi_scsi_cmd_execute(struct iscsi_task *task)
task->offset = 0; /* for use as transmit pointer for data-ins */
err = iscsi_target_cmd_queue(task);
no_queuing:
- conn->tp->ep_event_modify(conn->fd, EPOLLIN | EPOLLOUT);
+ conn->tp->ep_event_modify(conn, EPOLLIN | EPOLLOUT);
return err;
}
@@ -1197,7 +1198,7 @@ static int iscsi_tm_done(struct mgmt_req *mreq)
break;
}
list_add_tail(&task->c_list, &task->conn->tx_clist);
- task->conn->tp->ep_event_modify(task->conn->fd, EPOLLIN | EPOLLOUT);
+ task->conn->tp->ep_event_modify(task->conn, EPOLLIN | EPOLLOUT);
return 0;
}
@@ -1253,8 +1254,7 @@ static int iscsi_task_execute(struct iscsi_task *task)
case ISCSI_OP_NOOP_OUT:
case ISCSI_OP_LOGOUT:
list_add_tail(&task->c_list, &task->conn->tx_clist);
- task->conn->tp->ep_event_modify(task->conn->fd,
- EPOLLIN | EPOLLOUT);
+ task->conn->tp->ep_event_modify(task->conn, EPOLLIN | EPOLLOUT);
break;
case ISCSI_OP_SCSI_CMD:
/* convenient directionality for our internal use */
@@ -1274,7 +1274,7 @@ static int iscsi_task_execute(struct iscsi_task *task)
err = iscsi_tm_execute(task);
if (err) {
list_add_tail(&task->c_list, &task->conn->tx_clist);
- task->conn->tp->ep_event_modify(task->conn->fd,
+ task->conn->tp->ep_event_modify(task->conn,
EPOLLIN | EPOLLOUT);
}
break;
@@ -1719,15 +1719,15 @@ static int iscsi_task_tx_start(struct iscsi_connection *conn)
nodata:
dprintf("no more data\n");
- conn->tp->ep_event_modify(conn->fd, EPOLLIN);
+ conn->tp->ep_event_modify(conn, EPOLLIN);
return -EAGAIN;
}
-static int do_recv(int fd, struct iscsi_connection *conn, int next_state)
+static int do_recv(struct iscsi_connection *conn, int next_state)
{
int ret;
- ret = conn->tp->ep_read(fd, conn->rx_buffer, conn->rx_size);
+ ret = conn->tp->ep_read(conn, conn->rx_buffer, conn->rx_size);
if (!ret) {
conn->state = STATE_CLOSE;
return 0;
@@ -1746,7 +1746,7 @@ static int do_recv(int fd, struct iscsi_connection *conn, int next_state)
return ret;
}
-void iscsi_rx_handler(int fd, struct iscsi_connection *conn)
+void iscsi_rx_handler(struct iscsi_connection *conn)
{
int ret = 0, hdigest, ddigest;
uint32_t crc;
@@ -1760,7 +1760,7 @@ void iscsi_rx_handler(int fd, struct iscsi_connection *conn)
again:
switch (conn->rx_iostate) {
case IOSTATE_RX_BHS:
- ret = do_recv(fd, conn, IOSTATE_RX_INIT_AHS);
+ ret = do_recv(conn, IOSTATE_RX_INIT_AHS);
if (ret <= 0 || conn->rx_iostate != IOSTATE_RX_INIT_AHS)
break;
case IOSTATE_RX_INIT_AHS:
@@ -1797,7 +1797,7 @@ again:
else if (conn->rx_iostate != IOSTATE_RX_AHS)
break;
case IOSTATE_RX_AHS:
- ret = do_recv(fd, conn, hdigest ?
+ ret = do_recv(conn, hdigest ?
IOSTATE_RX_INIT_HDIGEST : IOSTATE_RX_INIT_DATA);
if (ret <= 0)
break;
@@ -1810,7 +1810,7 @@ again:
conn->rx_size = sizeof(conn->rx_digest);
conn->rx_iostate = IOSTATE_RX_HDIGEST;
case IOSTATE_RX_HDIGEST:
- ret = do_recv(fd, conn, IOSTATE_RX_CHECK_HDIGEST);
+ ret = do_recv(conn, IOSTATE_RX_CHECK_HDIGEST);
if (ret <= 0 || conn->rx_iostate != IOSTATE_RX_CHECK_HDIGEST)
break;
case IOSTATE_RX_CHECK_HDIGEST:
@@ -1836,7 +1836,7 @@ again:
break;
}
case IOSTATE_RX_DATA:
- ret = do_recv(fd, conn, ddigest ?
+ ret = do_recv(conn, ddigest ?
IOSTATE_RX_INIT_DDIGEST : IOSTATE_RX_END);
if (ret <= 0 || conn->rx_iostate != IOSTATE_RX_INIT_DDIGEST)
break;
@@ -1845,7 +1845,7 @@ again:
conn->rx_size = sizeof(conn->rx_digest);
conn->rx_iostate = IOSTATE_RX_DDIGEST;
case IOSTATE_RX_DDIGEST:
- ret = do_recv(fd, conn, IOSTATE_RX_CHECK_DDIGEST);
+ ret = do_recv(conn, IOSTATE_RX_CHECK_DDIGEST);
if (ret <= 0 || conn->rx_iostate != IOSTATE_RX_CHECK_DDIGEST)
break;
case IOSTATE_RX_CHECK_DDIGEST:
@@ -1883,18 +1883,18 @@ again:
conn_read_pdu(conn);
} else {
conn_write_pdu(conn);
- conn->tp->ep_event_modify(fd, EPOLLOUT);
+ conn->tp->ep_event_modify(conn, EPOLLOUT);
ret = cmnd_execute(conn);
if (ret)
conn->state = STATE_CLOSE;
}
}
-static int do_send(int fd, struct iscsi_connection *conn, int next_state)
+static int do_send(struct iscsi_connection *conn, int next_state)
{
int ret;
again:
- ret = conn->tp->ep_write_begin(fd, conn->tx_buffer, conn->tx_size);
+ ret = conn->tp->ep_write_begin(conn, conn->tx_buffer, conn->tx_size);
if (ret < 0) {
if (errno != EINTR && errno != EAGAIN)
conn->state = STATE_CLOSE;
@@ -1913,7 +1913,7 @@ again:
return 0;
}
-void iscsi_tx_handler(int fd, struct iscsi_connection *conn)
+void iscsi_tx_handler(struct iscsi_connection *conn)
{
int ret = 0, hdigest, ddigest;
uint32_t crc;
@@ -1933,7 +1933,7 @@ void iscsi_tx_handler(int fd, struct iscsi_connection *conn)
switch (conn->tx_iostate) {
case IOSTATE_TX_BHS:
- ret = do_send(fd, conn, IOSTATE_TX_INIT_AHS);
+ ret = do_send(conn, IOSTATE_TX_INIT_AHS);
if (ret < 0)
break;
case IOSTATE_TX_INIT_AHS:
@@ -1962,7 +1962,7 @@ void iscsi_tx_handler(int fd, struct iscsi_connection *conn)
conn->tx_buffer = conn->tx_digest;
conn->tx_size = sizeof(conn->tx_digest);
case IOSTATE_TX_HDIGEST:
- ret = do_send(fd, conn, IOSTATE_TX_INIT_DATA);
+ ret = do_send(conn, IOSTATE_TX_INIT_DATA);
if (ret < 0)
break;
case IOSTATE_TX_INIT_DATA:
@@ -1983,7 +1983,7 @@ void iscsi_tx_handler(int fd, struct iscsi_connection *conn)
if (conn->tx_iostate != IOSTATE_TX_DATA)
break;
case IOSTATE_TX_DATA:
- ret = do_send(fd, conn, ddigest ?
+ ret = do_send(conn, ddigest ?
IOSTATE_TX_INIT_DDIGEST : IOSTATE_TX_END);
if (ret < 0)
return;
@@ -1998,7 +1998,7 @@ void iscsi_tx_handler(int fd, struct iscsi_connection *conn)
conn->tx_buffer = conn->tx_digest;
conn->tx_size = sizeof(conn->tx_digest);
case IOSTATE_TX_DDIGEST:
- ret = do_send(fd, conn, IOSTATE_TX_END);
+ ret = do_send(conn, IOSTATE_TX_END);
break;
default:
eprintf("error %d %d\n", conn->state, conn->tx_iostate);
@@ -2016,18 +2016,18 @@ void iscsi_tx_handler(int fd, struct iscsi_connection *conn)
exit(1);
}
- conn->tp->ep_write_end(fd);
+ conn->tp->ep_write_end(conn);
cmnd_finish(conn);
switch (conn->state) {
case STATE_KERNEL:
- ret = conn_take_fd(conn, fd);
+ ret = conn_take_fd(conn);
if (ret)
conn->state = STATE_CLOSE;
else {
conn->state = STATE_SCSI;
conn_read_pdu(conn);
- conn->tp->ep_event_modify(fd, EPOLLIN);
+ conn->tp->ep_event_modify(conn, EPOLLIN);
}
break;
case STATE_EXIT:
@@ -2038,7 +2038,7 @@ void iscsi_tx_handler(int fd, struct iscsi_connection *conn)
break;
default:
conn_read_pdu(conn);
- conn->tp->ep_event_modify(fd, EPOLLIN);
+ conn->tp->ep_event_modify(conn, EPOLLIN);
break;
}
}
diff --git a/usr/iscsi/iscsid.h b/usr/iscsi/iscsid.h
index 524c2f3..d4b4799 100644
--- a/usr/iscsi/iscsid.h
+++ b/usr/iscsi/iscsid.h
@@ -134,7 +134,6 @@ struct iscsi_connection {
int state;
int rx_iostate;
int tx_iostate;
- int fd;
int refcount;
struct list_head clist;
@@ -185,6 +184,7 @@ struct iscsi_connection {
} auth;
struct iscsi_transport *tp;
+ void *trans_data; /* transport specific data */
};
#define STATE_FREE 0
@@ -250,20 +250,20 @@ extern struct list_head iscsi_targets_list;
extern int cmnd_exec_auth_chap(struct iscsi_connection *conn);
/* conn.c */
-extern struct iscsi_connection *conn_alloc(void);
-extern void conn_close(struct iscsi_connection *conn, int fd);
+extern struct iscsi_connection *conn_alloc(unsigned int trans_len);
+extern void conn_close(struct iscsi_connection *conn);
extern void conn_put(struct iscsi_connection *conn);
extern int conn_get(struct iscsi_connection *conn);
extern struct iscsi_connection * conn_find(struct iscsi_session *session, uint32_t cid);
-extern int conn_take_fd(struct iscsi_connection *conn, int fd);
+extern int conn_take_fd(struct iscsi_connection *conn);
extern void conn_add_to_session(struct iscsi_connection *conn, struct iscsi_session *session);
/* iscsid.c */
extern char *text_key_find(struct iscsi_connection *conn, char *searchKey);
extern void text_key_add(struct iscsi_connection *conn, char *key, char *value);
extern void conn_read_pdu(struct iscsi_connection *conn);
-extern void iscsi_tx_handler(int fd, struct iscsi_connection *conn);
-extern void iscsi_rx_handler(int fd, struct iscsi_connection *conn);
+extern void iscsi_tx_handler(struct iscsi_connection *conn);
+extern void iscsi_rx_handler(struct iscsi_connection *conn);
extern int iscsi_scsi_cmd_execute(struct iscsi_task *task);
/* iscsid.c iscsi_task */
@@ -279,7 +279,7 @@ extern void session_put(struct iscsi_session *session);
struct iscsi_target * target_find_by_name(const char *name);
struct iscsi_target * target_find_by_id(int tid);
extern void target_list_build(struct iscsi_connection *, char *, char *);
-extern int ip_acl(int tid, int fd);
+extern int ip_acl(int tid, struct iscsi_connection *conn);
extern int iscsi_target_create(struct target *);
extern void iscsi_target_destroy(int);
extern int iscsi_target_show(int mode, int tid, uint64_t sid, uint32_t cid,
diff --git a/usr/iscsi/session.c b/usr/iscsi/session.c
index dfb94d0..3b1650d 100644
--- a/usr/iscsi/session.c
+++ b/usr/iscsi/session.c
@@ -103,7 +103,7 @@ int session_create(struct iscsi_connection *conn)
}
memset(addr, 0, sizeof(addr));
- conn->tp->ep_show(conn->fd, addr, sizeof(addr));
+ conn->tp->ep_show(conn, addr, sizeof(addr));
snprintf(session->info, 1024, _TAB3 "Initiator: %s\n"
_TAB3 "Connection: %u\n"
diff --git a/usr/iscsi/target.c b/usr/iscsi/target.c
index 2653839..ab0685f 100644
--- a/usr/iscsi/target.c
+++ b/usr/iscsi/target.c
@@ -115,7 +115,7 @@ static int address_match(struct sockaddr *sa1, struct sockaddr *sa2)
return 0;
}
-static int ip_match(int fd, char *address)
+static int ip_match(struct iscsi_connection *conn, char *address)
{
struct sockaddr_storage from;
struct addrinfo hints, *res;
@@ -124,7 +124,7 @@ static int ip_match(int fd, char *address)
int err;
len = sizeof(from);
- err = getpeername(fd, (struct sockaddr *) &from, &len);
+ err = conn->tp->ep_getpeername(conn, (struct sockaddr *) &from, &len);
if (err < 0)
return -EPERM;
@@ -173,7 +173,7 @@ out:
return err;
}
-int ip_acl(int tid, int fd)
+int ip_acl(int tid, struct iscsi_connection *conn)
{
int idx, err;
char *addr;
@@ -183,7 +183,7 @@ int ip_acl(int tid, int fd)
if (!addr)
break;
- err = ip_match(fd, addr);
+ err = ip_match(conn, addr);
if (!err)
return 0;
}
@@ -198,7 +198,7 @@ void target_list_build(struct iscsi_connection *conn, char *addr, char *name)
if (name && strcmp(tgt_targetname(target->tid), name))
continue;
- if (ip_acl(target->tid, conn->fd))
+ if (ip_acl(target->tid, conn))
continue;
if (isns_scn_access(target->tid, conn->initiator))
diff --git a/usr/iscsi/transport.h b/usr/iscsi/transport.h
index c37d0da..c1e9dc1 100644
--- a/usr/iscsi/transport.h
+++ b/usr/iscsi/transport.h
@@ -1,6 +1,8 @@
#ifndef __TRANSPORT_H
#define __TRANSPORT_H
+#include <sys/socket.h>
+
struct iscsi_connection;
struct iscsi_transport {
@@ -8,14 +10,20 @@ struct iscsi_transport {
int rdma;
int (*ep_init) (void);
- size_t (*ep_read) (int ep, void *buf, size_t nbytes);
- size_t (*ep_write_begin) (int ep, void *buf, size_t nbytes);
- void (*ep_write_end)(int ep);
- size_t (*ep_close) (int ep);
- int (*ep_show) (int ep, char *buf, int rest);
- void (*ep_event_modify) (int ep, int events);
+ size_t (*ep_read) (struct iscsi_connection *conn, void *buf,
+ size_t nbytes);
+ size_t (*ep_write_begin) (struct iscsi_connection *conn, void *buf,
+ size_t nbytes);
+ void (*ep_write_end) (struct iscsi_connection *conn);
+ size_t (*ep_close) (struct iscsi_connection *conn);
+ int (*ep_show) (struct iscsi_connection *conn, char *buf, int rest);
+ void (*ep_event_modify) (struct iscsi_connection *conn, int events);
void *(*ep_malloc) (struct iscsi_connection *conn, size_t sz);
void (*ep_free) (struct iscsi_connection *conn, void *buf);
+ int (*ep_getsockname) (struct iscsi_connection *conn,
+ struct sockaddr *sa, socklen_t *len);
+ int (*ep_getpeername) (struct iscsi_connection *conn,
+ struct sockaddr *sa, socklen_t *len);
};
extern struct iscsi_transport iscsi_tcp;
--
1.5.3.4
More information about the stgt
mailing list