Skip to content

Commit

Permalink
nfs: prepare to share nfs_set_port
Browse files Browse the repository at this point in the history
We plan to use this function elsewhere.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
J. Bruce Fields authored and Trond Myklebust committed Oct 7, 2008
1 parent 460cdbc commit f0c9292
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
20 changes: 20 additions & 0 deletions fs/nfs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,23 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len)
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;
}
}
}
19 changes: 0 additions & 19 deletions fs/nfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,25 +674,6 @@ static void nfs_umount_begin(struct super_block *sb)
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.
*
Expand Down

0 comments on commit f0c9292

Please sign in to comment.