aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-05-10 15:07:41 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-14 20:30:30 -0400
commitd72c727cd9de490f936a41634e34cd4a61ba6dd6 (patch)
tree3330d6c5b46c5edd4c190c14cca1cd8016c675d7 /fs/nfs
parentb72e4f42a33137acc037546277a08f407d3c1016 (diff)
NFS: Create a single nfs_validate_mount_data() function
This new function chooses between the v2/3 parser and the v4 parser by filesystem type. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/super.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index db636d709f28..5b025b08e766 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -335,6 +335,8 @@ static const struct super_operations nfs_sops = {
335 335
336#ifdef CONFIG_NFS_V4 336#ifdef CONFIG_NFS_V4
337static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *); 337static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *);
338static int nfs4_validate_mount_data(void *options,
339 struct nfs_parsed_mount_data *args, const char *dev_name);
338static struct dentry *nfs4_try_mount(int flags, const char *dev_name, 340static struct dentry *nfs4_try_mount(int flags, const char *dev_name,
339 struct nfs_parsed_mount_data *data); 341 struct nfs_parsed_mount_data *data);
340static struct dentry *nfs4_mount(struct file_system_type *fs_type, 342static struct dentry *nfs4_mount(struct file_system_type *fs_type,
@@ -1857,10 +1859,10 @@ out_path:
1857 * + breaking back: trying proto=udp after proto=tcp, v2 after v3, 1859 * + breaking back: trying proto=udp after proto=tcp, v2 after v3,
1858 * mountproto=tcp after mountproto=udp, and so on 1860 * mountproto=tcp after mountproto=udp, and so on
1859 */ 1861 */
1860static int nfs_validate_mount_data(void *options, 1862static int nfs23_validate_mount_data(void *options,
1861 struct nfs_parsed_mount_data *args, 1863 struct nfs_parsed_mount_data *args,
1862 struct nfs_fh *mntfh, 1864 struct nfs_fh *mntfh,
1863 const char *dev_name) 1865 const char *dev_name)
1864{ 1866{
1865 struct nfs_mount_data *data = (struct nfs_mount_data *)options; 1867 struct nfs_mount_data *data = (struct nfs_mount_data *)options;
1866 struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; 1868 struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address;
@@ -2009,6 +2011,28 @@ out_invalid_fh:
2009 return -EINVAL; 2011 return -EINVAL;
2010} 2012}
2011 2013
2014#ifdef CONFIG_NFS_V4
2015static int nfs_validate_mount_data(struct file_system_type *fs_type,
2016 void *options,
2017 struct nfs_parsed_mount_data *args,
2018 struct nfs_fh *mntfh,
2019 const char *dev_name)
2020{
2021 if (fs_type == &nfs_fs_type)
2022 return nfs23_validate_mount_data(options, args, mntfh, dev_name);
2023 return nfs4_validate_mount_data(options, args, dev_name);
2024}
2025#else
2026static int nfs_validate_mount_data(struct file_system_type *fs_type,
2027 void *options,
2028 struct nfs_parsed_mount_data *args,
2029 struct nfs_fh *mntfh,
2030 const char *dev_name)
2031{
2032 return nfs23_validate_mount_data(options, args, mntfh, dev_name);
2033}
2034#endif
2035
2012static int nfs_validate_text_mount_data(void *options, 2036static int nfs_validate_text_mount_data(void *options,
2013 struct nfs_parsed_mount_data *args, 2037 struct nfs_parsed_mount_data *args,
2014 const char *dev_name) 2038 const char *dev_name)
@@ -2459,7 +2483,7 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
2459 goto out; 2483 goto out;
2460 2484
2461 /* Validate the mount data */ 2485 /* Validate the mount data */
2462 error = nfs_validate_mount_data(raw_data, data, mntfh, dev_name); 2486 error = nfs_validate_mount_data(fs_type, raw_data, data, mntfh, dev_name);
2463 if (error == NFS_TEXT_DATA) 2487 if (error == NFS_TEXT_DATA)
2464 error = nfs_validate_text_mount_data(raw_data, data, dev_name); 2488 error = nfs_validate_text_mount_data(raw_data, data, dev_name);
2465 if (error < 0) { 2489 if (error < 0) {
@@ -2866,7 +2890,7 @@ static struct dentry *nfs4_mount(struct file_system_type *fs_type,
2866 goto out; 2890 goto out;
2867 2891
2868 /* Validate the mount data */ 2892 /* Validate the mount data */
2869 error = nfs4_validate_mount_data(raw_data, data, dev_name); 2893 error = nfs_validate_mount_data(fs_type, raw_data, data, NULL, dev_name);
2870 if (error == NFS_TEXT_DATA) 2894 if (error == NFS_TEXT_DATA)
2871 error = nfs_validate_text_mount_data(raw_data, data, dev_name); 2895 error = nfs_validate_text_mount_data(raw_data, data, dev_name);
2872 if (error < 0) { 2896 if (error < 0) {