Skip to contentSkip to conversation

use atcp

PATCH New Jeff Garzik 1 participant 1 message Sep 23, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use atcp

This converts itd over to using [a local copy of] atcp.

 Makefile.am |    1 
 iscsiutil.h |   52 +------------
 target.c    |   27 +++----
 target.h    |    2 
 util.c      |  223 ++----------------------------------------------------------
 5 files changed, 29 insertions(+), 276 deletions(-)
Makefile.am +1 -0
index d559165..9ef9e23 100644
@@ -7,6 +7,7 @@ INCLUDES	= @GLIB_CFLAGS@
 sbin_PROGRAMS	= itd
 
 itd_SOURCES	= \
+	atcp.c atcp.h \
 	elist.h scsi_cmd_codes.h iscsiutil.h iscsi.h parameters.h target.h \
 	main.c iscsi.c target.c util.c parameters.c
 itd_LDADD	= @GLIB_LIBS@ @CRYPTO_LIBS@ @EVENT_LIBS@
iscsiutil.h +5 -47

77 lines not on this page · raw message

target.c +14 -13
index 7ef7d72..c68f857 100644
@@ -613,9 +613,9 @@ static int task_command_t(struct target_session *sess, const uint8_t *header)
 		goto err_out_hdr;
 	}
 
-	tcp_writeq(&sess->wst, rsp_header, ISCSI_HEADER_LEN,
+	atcp_writeq(&sess->wst, rsp_header, ISCSI_HEADER_LEN,
 		   hdr_cb_free, rsp_header);
-	tcp_write_start(&sess->wst);
+	atcp_write_start(&sess->wst);
 
 	return 0;
 
@@ -839,18 +839,18 @@ static int text_command_t(struct target_session *sess, const uint8_t *header)
 		goto err_out_hdr;
 	}
 
-	tcp_writeq(&sess->wst, rsp_header, ISCSI_HEADER_LEN,
+	atcp_writeq(&sess->wst, rsp_header, ISCSI_HEADER_LEN,
 		   hdr_cb_free, rsp_header);
 
 	if (len_out) {
-		tcp_writeq(&sess->wst, text_out, len_out,
-			   tcp_wr_cb_free, text_out);
+		atcp_writeq(&sess->wst, text_out, len_out,
+			   atcp_cb_free, text_out);
 		text_out = NULL;
 
 		send_padding(&sess->wst, len_out);
 	}
 
-	tcp_write_start(&sess->wst);
+	atcp_write_start(&sess->wst);
 
 	free(text_in);
 	free(text_out);
@@ -1228,9 +1228,9 @@ static int logout_command_t(struct target_session *sess, const uint8_t *header)
 		return -1;
 	}
 
-	tcp_writeq(&sess->wst, rsp_header, ISCSI_HEADER_LEN,
+	atcp_writeq(&sess->wst, rsp_header, ISCSI_HEADER_LEN,
 		   hdr_cb_free, rsp_header);
-	tcp_write_start(&sess->wst);
+	atcp_write_start(&sess->wst);
 
 	iscsi_trace(TRACE_ISCSI_DEBUG, __FILE__, __LINE__,
 		    "sent logout response OK\n");
@@ -1494,9 +1494,9 @@ static int send_r2t(struct target_session *sess)
 		    sess->xfer.r2t.tag, sess->xfer.r2t.transfer_tag,
 		    sess->xfer.r2t.length, sess->xfer.r2t.offset);
 
-	tcp_writeq(&sess->wst, header, ISCSI_HEADER_LEN,
+	atcp_writeq(&sess->wst, header, ISCSI_HEADER_LEN,
 		   hdr_cb_free, header);
-	tcp_write_start(&sess->wst);
+	atcp_write_start(&sess->wst);
 
 	sess->xfer.r2t_flag = 1;
 	sess->xfer.r2t.R2TSN += 1;
@@ -1761,7 +1761,7 @@ int target_sess_cleanup(struct target_session *sess)
 
 	event_del(&sess->ev);
 
-	tcp_write_exit(&sess->wst);
+	atcp_wr_exit(&sess->wst);
 
 	/* Terminate connection */
 	if (sess->fd >= 0)
@@ -1965,7 +1965,7 @@ restart:
 		break;
 	}
 
-	tcp_write_run_compl(&sess->wst);
+	atcp_write_run_compl(&sess->wst);
 	return;
 
 err_out:
@@ -2013,7 +2013,8 @@ int target_accept(struct globals *gp, struct server_socket *sock)
 
 	sess->globals = gp;
 
-	tcp_write_init(&sess->wst, sess->fd);
+	atcp_wr_init(&sess->wst, sess);
+	atcp_wr_set_fd(&sess->wst, sess->fd);
 
 	event_set(&sess->ev, sess->fd, EV_READ | EV_PERSIST,
 		  target_tcp_evt, sess);
target.h +1 -1
index ddedb0a..0e9bc54 100644
@@ -220,7 +220,7 @@ struct target_session {
 	struct sockaddr		addr;
 	struct event		ev;
 
-	struct tcp_write_state	wst;
+	struct atcp_wr_state	wst;
 
 	struct session_xfer	xfer;
 
util.c +8 -215

269 lines not on this page · raw message