Commit 456018d7 authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Trond Myklebust

NFS: Cleanup nfs_set_port

Signed-off-by: default avatar"J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 03254e65
...@@ -285,16 +285,15 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len) ...@@ -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) 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) { switch (sap->sa_family) {
case AF_INET: { case AF_INET:
struct sockaddr_in *ap = (struct sockaddr_in *)sap; ap->sin_port = htons(port);
ap->sin_port = htons(port); break;
break; case AF_INET6:
} ap6->sin6_port = htons(port);
case AF_INET6: { break;
struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap;
ap->sin6_port = htons(port);
break;
}
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment