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 <arne.redlich@googlemail.com>
This commit is contained in:
35
lib/socket.c
35
lib/socket.c
@@ -61,7 +61,7 @@ static void set_nonblocking(int fd)
|
|||||||
int set_tcp_sockopt(int sockfd, int optname, int value)
|
int set_tcp_sockopt(int sockfd, int optname, int value)
|
||||||
{
|
{
|
||||||
int level;
|
int level;
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__sun)
|
#if defined(__FreeBSD__) || defined(__sun)
|
||||||
struct protoent *buf;
|
struct protoent *buf;
|
||||||
|
|
||||||
@@ -71,8 +71,8 @@ int set_tcp_sockopt(int sockfd, int optname, int value)
|
|||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
level = SOL_TCP;
|
level = SOL_TCP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return setsockopt(sockfd, level, optname, &value, sizeof(value));
|
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);
|
"Missing ']' in IPv6 address", portal);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*str = 0;
|
*str = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* is it a hostname ? */
|
/* is it a hostname ? */
|
||||||
@@ -205,9 +205,9 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal,
|
|||||||
iscsi->connect_data = private_data;
|
iscsi->connect_data = private_data;
|
||||||
|
|
||||||
set_nonblocking(iscsi->fd);
|
set_nonblocking(iscsi->fd);
|
||||||
|
|
||||||
iscsi_set_tcp_keepalive(iscsi, iscsi->tcp_keepidle, iscsi->tcp_keepcnt, iscsi->tcp_keepintvl);
|
iscsi_set_tcp_keepalive(iscsi, iscsi->tcp_keepidle, iscsi->tcp_keepcnt, iscsi->tcp_keepintvl);
|
||||||
|
|
||||||
if (iscsi->tcp_user_timeout > 0) {
|
if (iscsi->tcp_user_timeout > 0) {
|
||||||
set_tcp_user_timeout(iscsi);
|
set_tcp_user_timeout(iscsi);
|
||||||
}
|
}
|
||||||
@@ -227,9 +227,9 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal,
|
|||||||
}
|
}
|
||||||
|
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
|
|
||||||
strncpy(iscsi->connected_portal,portal,MAX_STRING_SIZE);
|
strncpy(iscsi->connected_portal,portal,MAX_STRING_SIZE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ iscsi_disconnect(struct iscsi_context *iscsi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
close(iscsi->fd);
|
close(iscsi->fd);
|
||||||
|
|
||||||
if (iscsi->connected_portal[0])
|
if (iscsi->connected_portal[0])
|
||||||
DPRINTF(iscsi,2,"disconnected from portal %s",iscsi->connected_portal);
|
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 */
|
/* stop sending. maxcmdsn is reached */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
total = iscsi->outqueue->outdata.size;
|
total = iscsi->outqueue->outdata.size;
|
||||||
total = (total + 3) & 0xfffffffc;
|
total = (total + 3) & 0xfffffffc;
|
||||||
|
|
||||||
@@ -442,7 +442,7 @@ iscsi_write_to_socket(struct iscsi_context *iscsi)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int inline
|
static inline int
|
||||||
iscsi_service_reconnect_if_loggedin(struct iscsi_context *iscsi)
|
iscsi_service_reconnect_if_loggedin(struct iscsi_context *iscsi)
|
||||||
{
|
{
|
||||||
if (iscsi->is_loggedin) {
|
if (iscsi->is_loggedin) {
|
||||||
@@ -506,7 +506,7 @@ iscsi_service(struct iscsi_context *iscsi, int revents)
|
|||||||
NULL, iscsi->connect_data);
|
NULL, iscsi->connect_data);
|
||||||
iscsi->socket_status_cb = NULL;
|
iscsi->socket_status_cb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return iscsi_service_reconnect_if_loggedin(iscsi);
|
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)
|
void iscsi_set_tcp_syncnt(struct iscsi_context *iscsi, int value)
|
||||||
{
|
{
|
||||||
iscsi->tcp_syncnt=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)
|
void iscsi_set_tcp_user_timeout(struct iscsi_context *iscsi, int value)
|
||||||
{
|
{
|
||||||
iscsi->tcp_user_timeout=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)
|
void iscsi_set_tcp_keepidle(struct iscsi_context *iscsi, int value)
|
||||||
{
|
{
|
||||||
iscsi->tcp_keepidle=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)
|
void iscsi_set_tcp_keepcnt(struct iscsi_context *iscsi, int value)
|
||||||
{
|
{
|
||||||
iscsi->tcp_keepcnt=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)
|
void iscsi_set_tcp_keepintvl(struct iscsi_context *iscsi, int value)
|
||||||
{
|
{
|
||||||
iscsi->tcp_keepintvl=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)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user