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 | |
| 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')
| -rw-r--r-- | utils/mount/network.c | 13 | ||||
| -rw-r--r-- | utils/mount/stropts.c | 7 |
2 files changed, 6 insertions, 14 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, diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 9a13509..57a4b32 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -35,6 +35,7 @@ #include <netinet/in.h> #include <arpa/inet.h> +#include "sockaddr.h" #include "xcommon.h" #include "mount.h" #include "nls.h" @@ -77,12 +78,6 @@ extern char *progname; extern int verbose; extern int sloppy; -union nfs_sockaddr { - struct sockaddr sa; - struct sockaddr_in s4; - struct sockaddr_in6 s6; -}; - struct nfsmount_info { const char *spec, /* server:/path */ *node, /* mounted-on dir */ |
