[sheepdog] [PATCH] net: remove redundant argument from tx

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Jan 16 15:16:06 CET 2013


We don't pass any flags to send/2, so we can simply use write/2
instead of it.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 include/net.h   |    2 +-
 lib/net.c       |    4 ++--
 sheep/request.c |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/net.h b/include/net.h
index 25d46af..f795707 100644
--- a/include/net.h
+++ b/include/net.h
@@ -39,7 +39,7 @@ int conn_rx_on(struct connection *conn);
 bool is_conn_dead(const struct connection *conn);
 int do_read(int sockfd, void *buf, int len);
 int rx(struct connection *conn, enum conn_state next_state);
-int tx(struct connection *conn, enum conn_state next_state, int flags);
+int tx(struct connection *conn, enum conn_state next_state);
 int connect_to(const char *name, int port);
 int send_req(int sockfd, struct sd_req *hdr, void *data, unsigned int wlen);
 int exec_req(int sockfd, struct sd_req *hdr, void *data);
diff --git a/lib/net.c b/lib/net.c
index b4f7176..e6d8a56 100644
--- a/lib/net.c
+++ b/lib/net.c
@@ -94,11 +94,11 @@ int rx(struct connection *conn, enum conn_state next_state)
 	return ret;
 }
 
-notrace int tx(struct connection *conn, enum conn_state next_state, int flags)
+notrace int tx(struct connection *conn, enum conn_state next_state)
 {
 	int ret;
 
-	ret = send(conn->fd, conn->tx_buf, conn->tx_length, flags);
+	ret = write(conn->fd, conn->tx_buf, conn->tx_length);
 	if (ret < 0) {
 		if (errno != EAGAIN)
 			conn->c_tx_state = C_IO_CLOSED;
diff --git a/sheep/request.c b/sheep/request.c
index 4ade726..877b75e 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -666,7 +666,7 @@ static inline int begin_tx(struct client_info *ci)
 
 	switch (ci->conn.c_tx_state) {
 	case C_IO_HEADER:
-		ret = tx(&ci->conn, C_IO_DATA_INIT, 0);
+		ret = tx(&ci->conn, C_IO_DATA_INIT);
 		if (!ret)
 			break;
 
@@ -679,7 +679,7 @@ static inline int begin_tx(struct client_info *ci)
 			break;
 		}
 	case C_IO_DATA:
-		ret = tx(&ci->conn, C_IO_END, 0);
+		ret = tx(&ci->conn, C_IO_END);
 		if (!ret)
 			break;
 	default:
-- 
1.7.2.5




More information about the sheepdog mailing list