diff options
-rw-r--r-- | fs/dlm/lowcomms.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index cdd168e4bf45..75010da95b39 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -55,9 +55,9 @@ | |||
55 | #include "config.h" | 55 | #include "config.h" |
56 | #include "midcomms.h" | 56 | #include "midcomms.h" |
57 | 57 | ||
58 | static struct sockaddr_storage *local_addr[DLM_MAX_ADDR_COUNT]; | 58 | static struct sockaddr_storage *dlm_local_addr[DLM_MAX_ADDR_COUNT]; |
59 | static int local_count; | 59 | static int dlm_local_count; |
60 | static int local_nodeid; | 60 | static int dlm_local_nodeid; |
61 | 61 | ||
62 | /* One of these per connected node */ | 62 | /* One of these per connected node */ |
63 | 63 | ||
@@ -153,14 +153,14 @@ static int nodeid_to_addr(int nodeid, struct sockaddr *retaddr) | |||
153 | struct sockaddr_storage addr; | 153 | struct sockaddr_storage addr; |
154 | int error; | 154 | int error; |
155 | 155 | ||
156 | if (!local_count) | 156 | if (!dlm_local_count) |
157 | return -1; | 157 | return -1; |
158 | 158 | ||
159 | error = dlm_nodeid_to_addr(nodeid, &addr); | 159 | error = dlm_nodeid_to_addr(nodeid, &addr); |
160 | if (error) | 160 | if (error) |
161 | return error; | 161 | return error; |
162 | 162 | ||
163 | if (local_addr[0]->ss_family == AF_INET) { | 163 | if (dlm_local_addr[0]->ss_family == AF_INET) { |
164 | struct sockaddr_in *in4 = (struct sockaddr_in *) &addr; | 164 | struct sockaddr_in *in4 = (struct sockaddr_in *) &addr; |
165 | struct sockaddr_in *ret4 = (struct sockaddr_in *) retaddr; | 165 | struct sockaddr_in *ret4 = (struct sockaddr_in *) retaddr; |
166 | ret4->sin_addr.s_addr = in4->sin_addr.s_addr; | 166 | ret4->sin_addr.s_addr = in4->sin_addr.s_addr; |
@@ -260,21 +260,21 @@ static void make_sockaddr(struct sockaddr_storage *saddr, uint16_t port, | |||
260 | struct sockaddr_in *local4_addr; | 260 | struct sockaddr_in *local4_addr; |
261 | struct sockaddr_in6 *local6_addr; | 261 | struct sockaddr_in6 *local6_addr; |
262 | 262 | ||
263 | if (!local_count) | 263 | if (!dlm_local_count) |
264 | return; | 264 | return; |
265 | 265 | ||
266 | if (!port) { | 266 | if (!port) { |
267 | if (local_addr[0]->ss_family == AF_INET) { | 267 | if (dlm_local_addr[0]->ss_family == AF_INET) { |
268 | local4_addr = (struct sockaddr_in *)local_addr[0]; | 268 | local4_addr = (struct sockaddr_in *)dlm_local_addr[0]; |
269 | port = be16_to_cpu(local4_addr->sin_port); | 269 | port = be16_to_cpu(local4_addr->sin_port); |
270 | } else { | 270 | } else { |
271 | local6_addr = (struct sockaddr_in6 *)local_addr[0]; | 271 | local6_addr = (struct sockaddr_in6 *)dlm_local_addr[0]; |
272 | port = be16_to_cpu(local6_addr->sin6_port); | 272 | port = be16_to_cpu(local6_addr->sin6_port); |
273 | } | 273 | } |
274 | } | 274 | } |
275 | 275 | ||
276 | saddr->ss_family = local_addr[0]->ss_family; | 276 | saddr->ss_family = dlm_local_addr[0]->ss_family; |
277 | if (local_addr[0]->ss_family == AF_INET) { | 277 | if (dlm_local_addr[0]->ss_family == AF_INET) { |
278 | struct sockaddr_in *in4_addr = (struct sockaddr_in *)saddr; | 278 | struct sockaddr_in *in4_addr = (struct sockaddr_in *)saddr; |
279 | in4_addr->sin_port = cpu_to_be16(port); | 279 | in4_addr->sin_port = cpu_to_be16(port); |
280 | memset(&in4_addr->sin_zero, 0, sizeof(in4_addr->sin_zero)); | 280 | memset(&in4_addr->sin_zero, 0, sizeof(in4_addr->sin_zero)); |
@@ -636,7 +636,7 @@ static void init_local(void) | |||
636 | struct sockaddr_storage sas, *addr; | 636 | struct sockaddr_storage sas, *addr; |
637 | int i; | 637 | int i; |
638 | 638 | ||
639 | local_nodeid = dlm_our_nodeid(); | 639 | dlm_local_nodeid = dlm_our_nodeid(); |
640 | 640 | ||
641 | for (i = 0; i < DLM_MAX_ADDR_COUNT - 1; i++) { | 641 | for (i = 0; i < DLM_MAX_ADDR_COUNT - 1; i++) { |
642 | if (dlm_our_addr(&sas, i)) | 642 | if (dlm_our_addr(&sas, i)) |
@@ -646,7 +646,7 @@ static void init_local(void) | |||
646 | if (!addr) | 646 | if (!addr) |
647 | break; | 647 | break; |
648 | memcpy(addr, &sas, sizeof(*addr)); | 648 | memcpy(addr, &sas, sizeof(*addr)); |
649 | local_addr[local_count++] = addr; | 649 | dlm_local_addr[dlm_local_count++] = addr; |
650 | } | 650 | } |
651 | } | 651 | } |
652 | 652 | ||
@@ -659,15 +659,15 @@ static int init_sock(void) | |||
659 | struct sctp_event_subscribe subscribe; | 659 | struct sctp_event_subscribe subscribe; |
660 | int result = -EINVAL, num = 1, i, addr_len; | 660 | int result = -EINVAL, num = 1, i, addr_len; |
661 | 661 | ||
662 | if (!local_count) { | 662 | if (!dlm_local_count) { |
663 | init_local(); | 663 | init_local(); |
664 | if (!local_count) { | 664 | if (!dlm_local_count) { |
665 | log_print("no local IP address has been set"); | 665 | log_print("no local IP address has been set"); |
666 | goto out; | 666 | goto out; |
667 | } | 667 | } |
668 | } | 668 | } |
669 | 669 | ||
670 | result = sock_create_kern(local_addr[0]->ss_family, SOCK_SEQPACKET, | 670 | result = sock_create_kern(dlm_local_addr[0]->ss_family, SOCK_SEQPACKET, |
671 | IPPROTO_SCTP, &sock); | 671 | IPPROTO_SCTP, &sock); |
672 | if (result < 0) { | 672 | if (result < 0) { |
673 | log_print("Can't create comms socket, check SCTP is loaded"); | 673 | log_print("Can't create comms socket, check SCTP is loaded"); |
@@ -700,8 +700,8 @@ static int init_sock(void) | |||
700 | sctp_con.sock->sk->sk_data_ready = lowcomms_data_ready; | 700 | sctp_con.sock->sk->sk_data_ready = lowcomms_data_ready; |
701 | 701 | ||
702 | /* Bind to all interfaces. */ | 702 | /* Bind to all interfaces. */ |
703 | for (i = 0; i < local_count; i++) { | 703 | for (i = 0; i < dlm_local_count; i++) { |
704 | memcpy(&localaddr, local_addr[i], sizeof(localaddr)); | 704 | memcpy(&localaddr, dlm_local_addr[i], sizeof(localaddr)); |
705 | make_sockaddr(&localaddr, dlm_config.tcp_port, &addr_len); | 705 | make_sockaddr(&localaddr, dlm_config.tcp_port, &addr_len); |
706 | 706 | ||
707 | result = add_bind_addr(&localaddr, addr_len, num); | 707 | result = add_bind_addr(&localaddr, addr_len, num); |
@@ -879,7 +879,7 @@ static void initiate_association(int nodeid) | |||
879 | cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); | 879 | cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); |
880 | sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg); | 880 | sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg); |
881 | memset(sinfo, 0x00, sizeof(struct sctp_sndrcvinfo)); | 881 | memset(sinfo, 0x00, sizeof(struct sctp_sndrcvinfo)); |
882 | sinfo->sinfo_ppid = cpu_to_le32(local_nodeid); | 882 | sinfo->sinfo_ppid = cpu_to_le32(dlm_local_nodeid); |
883 | 883 | ||
884 | outmessage.msg_controllen = cmsg->cmsg_len; | 884 | outmessage.msg_controllen = cmsg->cmsg_len; |
885 | ret = kernel_sendmsg(sctp_con.sock, &outmessage, iov, 1, 1); | 885 | ret = kernel_sendmsg(sctp_con.sock, &outmessage, iov, 1, 1); |
@@ -924,7 +924,7 @@ static int send_to_sock(struct nodeinfo *ni) | |||
924 | cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); | 924 | cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); |
925 | sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg); | 925 | sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg); |
926 | memset(sinfo, 0x00, sizeof(struct sctp_sndrcvinfo)); | 926 | memset(sinfo, 0x00, sizeof(struct sctp_sndrcvinfo)); |
927 | sinfo->sinfo_ppid = cpu_to_le32(local_nodeid); | 927 | sinfo->sinfo_ppid = cpu_to_le32(dlm_local_nodeid); |
928 | sinfo->sinfo_assoc_id = ni->assoc_id; | 928 | sinfo->sinfo_assoc_id = ni->assoc_id; |
929 | outmsg.msg_controllen = cmsg->cmsg_len; | 929 | outmsg.msg_controllen = cmsg->cmsg_len; |
930 | 930 | ||
@@ -1231,9 +1231,9 @@ void dlm_lowcomms_exit(void) | |||
1231 | { | 1231 | { |
1232 | int i; | 1232 | int i; |
1233 | 1233 | ||
1234 | for (i = 0; i < local_count; i++) | 1234 | for (i = 0; i < dlm_local_count; i++) |
1235 | kfree(local_addr[i]); | 1235 | kfree(dlm_local_addr[i]); |
1236 | local_count = 0; | 1236 | dlm_local_count = 0; |
1237 | local_nodeid = 0; | 1237 | dlm_local_nodeid = 0; |
1238 | } | 1238 | } |
1239 | 1239 | ||