mount command: rename connect_to helper
Subsystems (2)
PATCH 8/17 mount command: rename connect_to helper
Clean up: rename connect_to().
The get_socket() function uses a helper called connect_to() that wraps the connect(2) system call with logic that establishes a connection timeout. The name "connect_to()" is confusing though, as it suggests we are invoking some other system interface rather than a locally defined function.
Signed-off-by Chuck Lever <[email protected]>
---
utils/mount/network.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
utils/mount/network.c +8 -5
@@ -257,10 +257,13 @@ static int __nfs_gs_err_connect(const int socket, const struct sockaddr *saddr,/* * Attempt to connect a socket, but time out after "timeout" seconds. * -* On error return, caller closes the socket. +* Returns zero if successful, or -1 if an error occurred. +* On error return, caller must close the socket. */ -static int connect_to (int fd,struct sockaddr *addr, -socklen_t addrlen,time_t timeout) +static int __nfs_gs_connect_with_timeout (const int fd, +const struct sockaddr *addr, +const socklen_t addrlen, +const time_t timeout) {int ret, saved;fd_set rset, wset;
@@ -329,8 +332,8 @@ static int get_socket(struct sockaddr_in *saddr, unsigned int p_prot,return __nfs_gs_err_bind (so, p_prot, errno); }if (type ==SOCK_STREAM || conn) { -if (connect_to (so, (struct sockaddr *)saddr, namelen, - timeout) <0 ) +if (__nfs_gs_connect_with_timeout (so, (struct sockaddr *)saddr, + namelen, timeout) <0 )return __nfs_gs_err_connect (so, (struct sockaddr *)saddr, errno); }