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

nfs: prepare to share nfs_set_port

We plan to use this function elsewhere.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 460cdbc8
...@@ -276,3 +276,23 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len) ...@@ -276,3 +276,23 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len)
PAGE_SIZE - 1) >> PAGE_SHIFT; PAGE_SIZE - 1) >> PAGE_SHIFT;
} }
/*
* Set the port number in an address. Be agnostic about the address
* family.
*/
static inline void nfs_set_port(struct sockaddr *sap, unsigned short port)
{
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;
}
}
}
...@@ -674,25 +674,6 @@ static void nfs_umount_begin(struct super_block *sb) ...@@ -674,25 +674,6 @@ static void nfs_umount_begin(struct super_block *sb)
rpc_killall_tasks(rpc); rpc_killall_tasks(rpc);
} }
/*
* Set the port number in an address. Be agnostic about the address family.
*/
static void nfs_set_port(struct sockaddr *sap, unsigned short port)
{
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;
}
}
}
/* /*
* Sanity-check a server address provided by the mount command. * Sanity-check a server address provided by the mount command.
* *
......
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