aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/messenger.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-05-27 00:26:43 -0400
committerAlex Elder <elder@dreamhost.com>2012-06-06 10:23:54 -0400
commit1bfd89f4e6e1adc6a782d94aa5d4c53be1e404d7 (patch)
tree32bbe82e2817619bf16516d8531a2e5b79e2528c /net/ceph/messenger.c
parent20581c1faf7b15ae1f8b80c0ec757877b0b53151 (diff)
libceph: fully initialize connection in con_init()
Move the initialization of a ceph connection's private pointer, operations vector pointer, and peer name information into ceph_con_init(). Rearrange the arguments so the connection pointer is first. Hide the byte-swapping of the peer entity number inside ceph_con_init() Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r--net/ceph/messenger.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 36b440a00cc2..3b65f6e6911b 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -521,15 +521,22 @@ void ceph_con_put(struct ceph_connection *con)
521/* 521/*
522 * initialize a new connection. 522 * initialize a new connection.
523 */ 523 */
524void ceph_con_init(struct ceph_messenger *msgr, struct ceph_connection *con) 524void ceph_con_init(struct ceph_connection *con, void *private,
525 const struct ceph_connection_operations *ops,
526 struct ceph_messenger *msgr, __u8 entity_type, __u64 entity_num)
525{ 527{
526 dout("con_init %p\n", con); 528 dout("con_init %p\n", con);
527 memset(con, 0, sizeof(*con)); 529 memset(con, 0, sizeof(*con));
530 con->private = private;
531 con->ops = ops;
528 atomic_set(&con->nref, 1); 532 atomic_set(&con->nref, 1);
529 con->msgr = msgr; 533 con->msgr = msgr;
530 534
531 con_sock_state_init(con); 535 con_sock_state_init(con);
532 536
537 con->peer_name.type = (__u8) entity_type;
538 con->peer_name.num = cpu_to_le64(entity_num);
539
533 mutex_init(&con->mutex); 540 mutex_init(&con->mutex);
534 INIT_LIST_HEAD(&con->out_queue); 541 INIT_LIST_HEAD(&con->out_queue);
535 INIT_LIST_HEAD(&con->out_sent); 542 INIT_LIST_HEAD(&con->out_sent);