aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2008-08-20 16:10:22 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-10-07 18:17:36 -0400
commitf0c929251e01a7a86b6254c775cb6b65c6457f10 (patch)
tree18016ca1cffa8ab1bbe2c064bbf76bba443d8b78 /fs
parent460cdbc83268dd9641b57d893b03ef52fcc3f96d (diff)
nfs: prepare to share nfs_set_port
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/internal.h20
-rw-r--r--fs/nfs/super.c19
2 files changed, 20 insertions, 19 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 7bcf6ec2d458..8d91bd88e310 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -276,3 +276,23 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len)
276 PAGE_SIZE - 1) >> PAGE_SHIFT; 276 PAGE_SIZE - 1) >> PAGE_SHIFT;
277} 277}
278 278
279
280/*
281 * Set the port number in an address. Be agnostic about the address
282 * family.
283 */
284static inline void nfs_set_port(struct sockaddr *sap, unsigned short port)
285{
286 switch (sap->sa_family) {
287 case AF_INET: {
288 struct sockaddr_in *ap = (struct sockaddr_in *)sap;
289 ap->sin_port = htons(port);
290 break;
291 }
292 case AF_INET6: {
293 struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap;
294 ap->sin6_port = htons(port);
295 break;
296 }
297 }
298}
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 1e3558697219..b99096b8e827 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -675,25 +675,6 @@ static void nfs_umount_begin(struct super_block *sb)
675} 675}
676 676
677/* 677/*
678 * Set the port number in an address. Be agnostic about the address family.
679 */
680static void nfs_set_port(struct sockaddr *sap, unsigned short port)
681{
682 switch (sap->sa_family) {
683 case AF_INET: {
684 struct sockaddr_in *ap = (struct sockaddr_in *)sap;
685 ap->sin_port = htons(port);
686 break;
687 }
688 case AF_INET6: {
689 struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap;
690 ap->sin6_port = htons(port);
691 break;
692 }
693 }
694}
695
696/*
697 * Sanity-check a server address provided by the mount command. 678 * Sanity-check a server address provided by the mount command.
698 * 679 *
699 * Address family must be initialized, and address must not be 680 * Address family must be initialized, and address must not be