From: "J. Bruce Fields" Subject: [PATCH 4/5] nfs: prepare to share nfs_set_port Date: Wed, 8 Oct 2008 15:38:13 -0400 Message-ID: <1223494694-12778-4-git-send-email-bfields@citi.umich.edu> References: <20081008193114.GA12386@fieldses.org> <1223494694-12778-1-git-send-email-bfields@citi.umich.edu> <1223494694-12778-2-git-send-email-bfields@citi.umich.edu> <1223494694-12778-3-git-send-email-bfields@citi.umich.edu> Cc: linux-nfs@vger.kernel.org, "J. Bruce Fields" To: Trond Myklebust Return-path: Received: from mail.fieldses.org ([66.93.2.214]:36888 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754864AbYJHTiQ (ORCPT ); Wed, 8 Oct 2008 15:38:16 -0400 In-Reply-To: <1223494694-12778-3-git-send-email-bfields@citi.umich.edu> Sender: linux-nfs-owner@vger.kernel.org List-ID: We plan to use this function elsewhere. Signed-off-by: J. Bruce Fields --- fs/nfs/internal.h | 18 ++++++++++++++++++ fs/nfs/super.c | 19 ------------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 24241fc..926d8db 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -276,3 +276,21 @@ 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) +{ + struct sockaddr_in *ap = (struct sockaddr_in *)sap; + struct sockaddr_in6 *ap6 = (struct sockaddr_in6 *)sap; + + switch (sap->sa_family) { + case AF_INET: + ap->sin_port = htons(port); + break; + case AF_INET6: + ap6->sin6_port = htons(port); + break; + } +} diff --git a/fs/nfs/super.c b/fs/nfs/super.c index c989e71..9608797 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -664,25 +664,6 @@ static void nfs_umount_begin(struct super_block *sb) } /* - * 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. * * Address family must be initialized, and address must not be -- 1.5.5.rc1