diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2008-10-08 23:31:14 +0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-10-10 22:41:50 +0400 |
commit | 456018d791ff4ef03d610f72486c637056bcd749 (patch) | |
tree | c278b69dc731a048e3c5a1d350b0d74611fcb791 /fs/nfs/internal.h | |
parent | 03254e65a60d3113164672dbbadc023c4a56ecd1 (diff) | |
download | linux-456018d791ff4ef03d610f72486c637056bcd749.tar.xz |
NFS: Cleanup nfs_set_port
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/internal.h')
-rw-r--r-- | fs/nfs/internal.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 5d2a5d3c4241..d212ee41caf2 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -285,16 +285,15 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len) */ static inline void nfs_set_port(struct sockaddr *sap, unsigned short port) { + struct sockaddr_in *ap = (struct sockaddr_in *)sap; + struct sockaddr_in6 *ap6 = (struct sockaddr_in6 *)sap; + switch (sap->sa_family) { - case AF_INET: { - struct sockaddr_in *ap = (struct sockaddr_in *)sap; - ap->sin_port = htons(port); - break; - } - case AF_INET6: { - struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap; - ap->sin6_port = htons(port); - break; - } + case AF_INET: + ap->sin_port = htons(port); + break; + case AF_INET6: + ap6->sin6_port = htons(port); + break; } } |