The connection_new() routine was taking an absurd number of parameters; fix it.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2015-02-05 07:32:24 +00:00
parent e708492700
commit 83f375616e

View File

@ -151,9 +151,7 @@ resolve_addr(const struct connection *conn, const char *address,
}
static struct connection *
connection_new(unsigned int session_id, const uint8_t isid[8], uint16_t tsih,
const struct iscsi_session_conf *conf, const struct iscsi_session_limits
*limits, int iscsi_fd)
connection_new(int iscsi_fd, const struct iscsi_daemon_request *request)
{
struct connection *conn;
struct addrinfo *from_ai, *to_ai;
@ -177,17 +175,13 @@ connection_new(unsigned int session_id, const uint8_t isid[8], uint16_t tsih,
conn->conn_max_data_segment_length = 8192;
conn->conn_max_burst_length = 262144;
conn->conn_first_burst_length = 65536;
conn->conn_session_id = session_id;
memcpy(&conn->conn_isid, isid, sizeof(conn->conn_isid));
conn->conn_tsih = tsih;
conn->conn_iscsi_fd = iscsi_fd;
/*
* XXX: Should we sanitize this somehow?
*/
memcpy(&conn->conn_conf, conf, sizeof(conn->conn_conf));
memcpy(&conn->conn_limits, limits, sizeof(conn->conn_limits));
conn->conn_session_id = request->idr_session_id;
memcpy(&conn->conn_conf, &request->idr_conf, sizeof(conn->conn_conf));
memcpy(&conn->conn_isid, &request->idr_isid, sizeof(conn->conn_isid));
conn->conn_tsih = request->idr_tsih;
memcpy(&conn->conn_limits, &request->idr_limits, sizeof(conn->conn_limits));
from_addr = conn->conn_conf.isc_initiator_addr;
to_addr = conn->conn_conf.isc_target_addr;
@ -444,9 +438,7 @@ handle_request(int iscsi_fd, const struct iscsi_daemon_request *request, int tim
setproctitle("%s", request->idr_conf.isc_target_addr);
}
conn = connection_new(request->idr_session_id, request->idr_isid,
request->idr_tsih, &request->idr_conf, &request->idr_limits,
iscsi_fd);
conn = connection_new(iscsi_fd, request);
set_timeout(timeout);
capsicate(conn);
login(conn);