diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-01-14 12:23:15 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2010-01-15 14:55:51 -0500 |
commit | f0d3a4bedccca7cce48296757bc1c8bd59b80828 (patch) | |
tree | b3c2012dcc177962eed5974e6ddc6f7d46e84a0a /utils/mount/network.c | |
parent | 18c3a41364836e61ceeb8e615e2b059904c5b65f (diff) | |
download | nfs-utils-f0d3a4bedccca7cce48296757bc1c8bd59b80828.tar.gz nfs-utils-f0d3a4bedccca7cce48296757bc1c8bd59b80828.tar.xz nfs-utils-f0d3a4bedccca7cce48296757bc1c8bd59b80828.zip |
nfs-utils: Collect socket address helpers into one location
Introduce generic helpers for managing socket addresses. These are
general enough that they are useful for pretty much any component of
nfs-utils.
We also include the definition of nfs_sockaddr here, so it can be
shared. See:
https://bugzilla.redhat.com/show_bug.cgi?id=448743
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'utils/mount/network.c')
-rw-r--r-- | utils/mount/network.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/utils/mount/network.c b/utils/mount/network.c index 906e20c..92bba2d 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -42,6 +42,7 @@ #include <rpc/pmap_prot.h> #include <rpc/pmap_clnt.h> +#include "sockaddr.h" #include "xcommon.h" #include "mount.h" #include "nls.h" @@ -56,10 +57,6 @@ #define CONNECT_TIMEOUT (20) #define MOUNT_TIMEOUT (30) -#if SIZEOF_SOCKLEN_T - 0 == 0 -#define socklen_t unsigned int -#endif - extern int nfs_mount_data_version; extern char *progname; extern int verbose; @@ -540,8 +537,8 @@ static int nfs_probe_port(const struct sockaddr *sap, const socklen_t salen, struct pmap *pmap, const unsigned long *versions, const unsigned int *protos) { - struct sockaddr_storage address; - struct sockaddr *saddr = (struct sockaddr *)&address; + union nfs_sockaddr address; + struct sockaddr *saddr = &address.sa; const unsigned long prog = pmap->pm_prog, *p_vers; const unsigned int prot = (u_int)pmap->pm_prot, *p_prot; const u_short port = (u_short) pmap->pm_port; @@ -831,8 +828,8 @@ int start_statd(void) int nfs_advise_umount(const struct sockaddr *sap, const socklen_t salen, const struct pmap *pmap, const dirpath *argp) { - struct sockaddr_storage address; - struct sockaddr *saddr = (struct sockaddr *)&address; + union nfs_sockaddr address; + struct sockaddr *saddr = &address.sa; struct pmap mnt_pmap = *pmap; struct timeval timeout = { .tv_sec = MOUNT_TIMEOUT >> 3, |