diff options
author | Alex Elder <elder@dreamhost.com> | 2012-01-23 16:49:27 -0500 |
---|---|---|
committer | Alex Elder <elder@dreamhost.com> | 2012-03-22 11:47:45 -0400 |
commit | bd406145129e8724cc71b65ff2a788dbd4d60c50 (patch) | |
tree | 51ba39087c13296256c0af6e5785dc3345a654f8 /net/ceph/messenger.c | |
parent | f64a93172b97dcfcfa68f595652220653562f605 (diff) |
ceph: eliminate some needless casts
This eliminates type casts in some places where they are not
required.
Signed-off-by: Alex Elder <elder@newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r-- | net/ceph/messenger.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index e86bb3f14859..09a412ba4b70 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -70,13 +70,13 @@ const char *ceph_pr_addr(const struct sockaddr_storage *ss) | |||
70 | 70 | ||
71 | switch (ss->ss_family) { | 71 | switch (ss->ss_family) { |
72 | case AF_INET: | 72 | case AF_INET: |
73 | snprintf(s, MAX_ADDR_STR_LEN, "%pI4:%u", &in4->sin_addr, | 73 | snprintf(s, MAX_ADDR_STR_LEN, "%pI4:%hu", &in4->sin_addr, |
74 | (unsigned int)ntohs(in4->sin_port)); | 74 | ntohs(in4->sin_port)); |
75 | break; | 75 | break; |
76 | 76 | ||
77 | case AF_INET6: | 77 | case AF_INET6: |
78 | snprintf(s, MAX_ADDR_STR_LEN, "[%pI6c]:%u", &in6->sin6_addr, | 78 | snprintf(s, MAX_ADDR_STR_LEN, "[%pI6c]:%hu", &in6->sin6_addr, |
79 | (unsigned int)ntohs(in6->sin6_port)); | 79 | ntohs(in6->sin6_port)); |
80 | break; | 80 | break; |
81 | 81 | ||
82 | default: | 82 | default: |
@@ -153,8 +153,8 @@ EXPORT_SYMBOL(ceph_msgr_flush); | |||
153 | /* data available on socket, or listen socket received a connect */ | 153 | /* data available on socket, or listen socket received a connect */ |
154 | static void ceph_data_ready(struct sock *sk, int count_unused) | 154 | static void ceph_data_ready(struct sock *sk, int count_unused) |
155 | { | 155 | { |
156 | struct ceph_connection *con = | 156 | struct ceph_connection *con = sk->sk_user_data; |
157 | (struct ceph_connection *)sk->sk_user_data; | 157 | |
158 | if (sk->sk_state != TCP_CLOSE_WAIT) { | 158 | if (sk->sk_state != TCP_CLOSE_WAIT) { |
159 | dout("ceph_data_ready on %p state = %lu, queueing work\n", | 159 | dout("ceph_data_ready on %p state = %lu, queueing work\n", |
160 | con, con->state); | 160 | con, con->state); |
@@ -189,8 +189,7 @@ static void ceph_write_space(struct sock *sk) | |||
189 | /* socket's state has changed */ | 189 | /* socket's state has changed */ |
190 | static void ceph_state_change(struct sock *sk) | 190 | static void ceph_state_change(struct sock *sk) |
191 | { | 191 | { |
192 | struct ceph_connection *con = | 192 | struct ceph_connection *con = sk->sk_user_data; |
193 | (struct ceph_connection *)sk->sk_user_data; | ||
194 | 193 | ||
195 | dout("ceph_state_change %p state = %lu sk_state = %u\n", | 194 | dout("ceph_state_change %p state = %lu sk_state = %u\n", |
196 | con, con->state, sk->sk_state); | 195 | con, con->state, sk->sk_state); |
@@ -225,7 +224,7 @@ static void set_sock_callbacks(struct socket *sock, | |||
225 | struct ceph_connection *con) | 224 | struct ceph_connection *con) |
226 | { | 225 | { |
227 | struct sock *sk = sock->sk; | 226 | struct sock *sk = sock->sk; |
228 | sk->sk_user_data = (void *)con; | 227 | sk->sk_user_data = con; |
229 | sk->sk_data_ready = ceph_data_ready; | 228 | sk->sk_data_ready = ceph_data_ready; |
230 | sk->sk_write_space = ceph_write_space; | 229 | sk->sk_write_space = ceph_write_space; |
231 | sk->sk_state_change = ceph_state_change; | 230 | sk->sk_state_change = ceph_state_change; |
@@ -552,7 +551,7 @@ static void prepare_write_message(struct ceph_connection *con) | |||
552 | 551 | ||
553 | /* fill in crc (except data pages), footer */ | 552 | /* fill in crc (except data pages), footer */ |
554 | con->out_msg->hdr.crc = | 553 | con->out_msg->hdr.crc = |
555 | cpu_to_le32(crc32c(0, (void *)&m->hdr, | 554 | cpu_to_le32(crc32c(0, &m->hdr, |
556 | sizeof(m->hdr) - sizeof(m->hdr.crc))); | 555 | sizeof(m->hdr) - sizeof(m->hdr.crc))); |
557 | con->out_msg->footer.flags = CEPH_MSG_FOOTER_COMPLETE; | 556 | con->out_msg->footer.flags = CEPH_MSG_FOOTER_COMPLETE; |
558 | con->out_msg->footer.front_crc = | 557 | con->out_msg->footer.front_crc = |
@@ -1647,7 +1646,7 @@ static int read_partial_message(struct ceph_connection *con) | |||
1647 | return ret; | 1646 | return ret; |
1648 | con->in_base_pos += ret; | 1647 | con->in_base_pos += ret; |
1649 | if (con->in_base_pos == sizeof(con->in_hdr)) { | 1648 | if (con->in_base_pos == sizeof(con->in_hdr)) { |
1650 | u32 crc = crc32c(0, (void *)&con->in_hdr, | 1649 | u32 crc = crc32c(0, &con->in_hdr, |
1651 | sizeof(con->in_hdr) - sizeof(con->in_hdr.crc)); | 1650 | sizeof(con->in_hdr) - sizeof(con->in_hdr.crc)); |
1652 | if (crc != le32_to_cpu(con->in_hdr.crc)) { | 1651 | if (crc != le32_to_cpu(con->in_hdr.crc)) { |
1653 | pr_err("read_partial_message bad hdr " | 1652 | pr_err("read_partial_message bad hdr " |