Commit fc4c128e authored by Ilya Dryomov's avatar Ilya Dryomov

libceph: change ceph_con_in_msg_alloc() to take hdr

ceph_con_in_msg_alloc() is protocol independent, but con->in_hdr (and
struct ceph_msg_header in general) is msgr1 specific.  While the struct
is deeply ingrained inside and outside the messenger, con->in_hdr field
can be separated.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 8ee8abf7
...@@ -2386,7 +2386,8 @@ static int read_partial_msg_data(struct ceph_connection *con) ...@@ -2386,7 +2386,8 @@ static int read_partial_msg_data(struct ceph_connection *con)
/* /*
* read (part of) a message. * read (part of) a message.
*/ */
static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip); static int ceph_con_in_msg_alloc(struct ceph_connection *con,
struct ceph_msg_header *hdr, int *skip);
static int read_partial_message(struct ceph_connection *con) static int read_partial_message(struct ceph_connection *con)
{ {
...@@ -2450,7 +2451,7 @@ static int read_partial_message(struct ceph_connection *con) ...@@ -2450,7 +2451,7 @@ static int read_partial_message(struct ceph_connection *con)
dout("got hdr type %d front %d data %d\n", con->in_hdr.type, dout("got hdr type %d front %d data %d\n", con->in_hdr.type,
front_len, data_len); front_len, data_len);
ret = ceph_con_in_msg_alloc(con, &skip); ret = ceph_con_in_msg_alloc(con, &con->in_hdr, &skip);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -3455,9 +3456,9 @@ static int ceph_alloc_middle(struct ceph_connection *con, struct ceph_msg *msg) ...@@ -3455,9 +3456,9 @@ static int ceph_alloc_middle(struct ceph_connection *con, struct ceph_msg *msg)
* On error (ENOMEM, EAGAIN, ...), * On error (ENOMEM, EAGAIN, ...),
* - con->in_msg == NULL * - con->in_msg == NULL
*/ */
static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) static int ceph_con_in_msg_alloc(struct ceph_connection *con,
struct ceph_msg_header *hdr, int *skip)
{ {
struct ceph_msg_header *hdr = &con->in_hdr;
int middle_len = le32_to_cpu(hdr->middle_len); int middle_len = le32_to_cpu(hdr->middle_len);
struct ceph_msg *msg; struct ceph_msg *msg;
int ret = 0; int ret = 0;
...@@ -3489,7 +3490,7 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) ...@@ -3489,7 +3490,7 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip)
con->error_msg = "error allocating memory for incoming message"; con->error_msg = "error allocating memory for incoming message";
return -ENOMEM; return -ENOMEM;
} }
memcpy(&con->in_msg->hdr, &con->in_hdr, sizeof(con->in_hdr)); memcpy(&con->in_msg->hdr, hdr, sizeof(*hdr));
if (middle_len && !con->in_msg->middle) { if (middle_len && !con->in_msg->middle) {
ret = ceph_alloc_middle(con, con->in_msg); ret = ceph_alloc_middle(con, con->in_msg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment