From 558ad000383725b70f53704d95c06c4869a57ec3 Mon Sep 17 00:00:00 2001 From: Arne Redlich Date: Wed, 31 Oct 2012 14:39:51 +0100 Subject: [PATCH] iscsi_service_reconnect_if_loggedin: fix compiler warning and make it static Quoth gcc-4.6.3: libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I./include "-D_U_=__attribute__((unused))" -Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -g -O2 -MT lib/socket.lo -MD -MP -MF lib/.deps/socket.Tpo -c lib/socket.c -fPIC -DPIC -o lib/.libs/socket.o lib/socket.c:445:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] Fix this and make it a static function. Also remove trailing whitespace from this file while at it. Signed-off-by: Arne Redlich --- lib/socket.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/lib/socket.c b/lib/socket.c index 68c6a13..a4b1d49 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -61,7 +61,7 @@ static void set_nonblocking(int fd) int set_tcp_sockopt(int sockfd, int optname, int value) { int level; - + #if defined(__FreeBSD__) || defined(__sun) struct protoent *buf; @@ -71,8 +71,8 @@ int set_tcp_sockopt(int sockfd, int optname, int value) return -1; #else level = SOL_TCP; - #endif - + #endif + return setsockopt(sockfd, level, optname, &value, sizeof(value)); } @@ -156,7 +156,7 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal, "Missing ']' in IPv6 address", portal); return -1; } - *str = 0; + *str = 0; } /* is it a hostname ? */ @@ -205,9 +205,9 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal, iscsi->connect_data = private_data; set_nonblocking(iscsi->fd); - + iscsi_set_tcp_keepalive(iscsi, iscsi->tcp_keepidle, iscsi->tcp_keepcnt, iscsi->tcp_keepintvl); - + if (iscsi->tcp_user_timeout > 0) { set_tcp_user_timeout(iscsi); } @@ -227,9 +227,9 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal, } freeaddrinfo(ai); - + strncpy(iscsi->connected_portal,portal,MAX_STRING_SIZE); - + return 0; } @@ -243,7 +243,7 @@ iscsi_disconnect(struct iscsi_context *iscsi) } close(iscsi->fd); - + if (iscsi->connected_portal[0]) DPRINTF(iscsi,2,"disconnected from portal %s",iscsi->connected_portal); @@ -409,7 +409,7 @@ iscsi_write_to_socket(struct iscsi_context *iscsi) /* stop sending. maxcmdsn is reached */ return 0; } - + total = iscsi->outqueue->outdata.size; total = (total + 3) & 0xfffffffc; @@ -442,7 +442,7 @@ iscsi_write_to_socket(struct iscsi_context *iscsi) return 0; } -int inline +static inline int iscsi_service_reconnect_if_loggedin(struct iscsi_context *iscsi) { if (iscsi->is_loggedin) { @@ -506,7 +506,7 @@ iscsi_service(struct iscsi_context *iscsi, int revents) NULL, iscsi->connect_data); iscsi->socket_status_cb = NULL; } - + return iscsi_service_reconnect_if_loggedin(iscsi); } @@ -585,31 +585,31 @@ iscsi_free_iscsi_inqueue(struct iscsi_in_pdu *inqueue) void iscsi_set_tcp_syncnt(struct iscsi_context *iscsi, int value) { iscsi->tcp_syncnt=value; - DPRINTF(iscsi,2,"TCP_SYNCNT will be set to %d on next socket creation",value); + DPRINTF(iscsi,2,"TCP_SYNCNT will be set to %d on next socket creation",value); } void iscsi_set_tcp_user_timeout(struct iscsi_context *iscsi, int value) { iscsi->tcp_user_timeout=value; - DPRINTF(iscsi,2,"TCP_USER_TIMEOUT will be set to %dms on next socket creation",value); + DPRINTF(iscsi,2,"TCP_USER_TIMEOUT will be set to %dms on next socket creation",value); } void iscsi_set_tcp_keepidle(struct iscsi_context *iscsi, int value) { iscsi->tcp_keepidle=value; - DPRINTF(iscsi,2,"TCP_KEEPIDLE will be set to %d on next socket creation",value); + DPRINTF(iscsi,2,"TCP_KEEPIDLE will be set to %d on next socket creation",value); } void iscsi_set_tcp_keepcnt(struct iscsi_context *iscsi, int value) { iscsi->tcp_keepcnt=value; - DPRINTF(iscsi,2,"TCP_KEEPCNT will be set to %d on next socket creation",value); + DPRINTF(iscsi,2,"TCP_KEEPCNT will be set to %d on next socket creation",value); } void iscsi_set_tcp_keepintvl(struct iscsi_context *iscsi, int value) { iscsi->tcp_keepintvl=value; - DPRINTF(iscsi,2,"TCP_KEEPINTVL will be set to %d on next socket creation",value); + DPRINTF(iscsi,2,"TCP_KEEPINTVL will be set to %d on next socket creation",value); } int iscsi_set_tcp_keepalive(struct iscsi_context *iscsi, int idle, int count, int interval) @@ -646,4 +646,3 @@ int iscsi_set_tcp_keepalive(struct iscsi_context *iscsi, int idle, int count, in return 0; } -