From: Chuck Lever <chuck.lever@oracle.com>
To: nfs@lists.sourceforge.net
Cc: netdev@vger.kernel.org
Subject: [PATCH 21/25] NFS: Refactor mount option address parsing into separate function
Date: Tue, 13 Nov 2007 13:32:51 -0500 [thread overview]
Message-ID: <20071113183251.5087.71147.stgit@manray.1015granger.net> (raw)
Some mount options pass in a string IP address. Let's parse these strings
in a separate function since this is done for at least two different mount
options.
This allows us to support IPv6 string addresses more easily in a subsequent
patch
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/super.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 1831394..c09c045 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -614,6 +614,16 @@ static int nfs_verify_server_address(struct sockaddr *addr)
}
/*
+ * Parse string addresses passed in via a mount option.
+ */
+static void nfs_parse_server_address(char *value,
+ struct sockaddr_in *addr)
+{
+ addr->sin_family = AF_INET;
+ addr->sin_addr.s_addr = in_aton(value);
+}
+
+/*
* Parse the value of the 'sec=' option.
*/
static int nfs_parse_security_flavors(char *value,
@@ -966,9 +976,8 @@ static int nfs_parse_mount_options(char *raw,
string = match_strdup(args);
if (string == NULL)
goto out_nomem;
- mnt->nfs_server.address.sin_family = AF_INET;
- mnt->nfs_server.address.sin_addr.s_addr =
- in_aton(string);
+ nfs_parse_server_address(string,
+ &mnt->nfs_server.address);
kfree(string);
break;
case Opt_clientaddr:
@@ -987,9 +996,8 @@ static int nfs_parse_mount_options(char *raw,
string = match_strdup(args);
if (string == NULL)
goto out_nomem;
- mnt->mount_server.address.sin_family = AF_INET;
- mnt->mount_server.address.sin_addr.s_addr =
- in_aton(string);
+ nfs_parse_server_address(string,
+ &mnt->mount_server.address);
kfree(string);
break;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
reply other threads:[~2007-11-13 18:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071113183251.5087.71147.stgit@manray.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox