[PATCH 24/44] NFS: Create a separate valadet_text_mount_data() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Bryan Schumaker <bjschuma@xxxxxxxxxx>

This allows for a separate function in the v4 case, which can evenutally
be called from a pointer in the struct nfs_subversion.

Signed-off-by: Bryan Schumaker <bjschuma@xxxxxxxxxx>
---
 fs/nfs/super.c |   46 ++++++++++++++++++++++++++--------------------
 1 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 861d31e..b5ffc6a 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1744,6 +1744,30 @@ out_path:
 	return -ENAMETOOLONG;
 }
 
+int nfs_validate_text_mount_data(void *options,
+				 struct nfs_parsed_mount_data *args,
+				 struct nfs_fh *mntfh,
+				 const char *dev_name)
+{
+	int status;
+	struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address;
+
+	nfs_set_port(sap, &args->nfs_server.port, 0);
+	nfs_set_mount_transport_protocol(args);
+	status = nfs_parse_devname(dev_name,
+				   &args->nfs_server.hostname,
+				   PAGE_SIZE,
+				   &args->nfs_server.export_path,
+				   NFS_MAXPATHLEN);
+	if (!status)
+		status = nfs_try_mount(args, mntfh);
+
+	kfree(args->nfs_server.export_path);
+	args->nfs_server.export_path = NULL;
+
+	return status;
+}
+
 /*
  * Validate the NFS2/NFS3 mount data
  * - fills in the mount root filehandle
@@ -1869,8 +1893,6 @@ static int nfs_validate_mount_data(void *options,
 
 		break;
 	default: {
-		int status;
-
 		if (nfs_parse_mount_options((char *)options, args) == 0)
 			return -EINVAL;
 
@@ -1884,24 +1906,8 @@ static int nfs_validate_mount_data(void *options,
 #else
 			goto out_v4_not_compiled;
 #endif
-
-		nfs_set_port(sap, &args->nfs_server.port, 0);
-
-		nfs_set_mount_transport_protocol(args);
-
-		status = nfs_parse_devname(dev_name,
-					   &args->nfs_server.hostname,
-					   PAGE_SIZE,
-					   &args->nfs_server.export_path,
-					   NFS_MAXPATHLEN);
-		if (!status)
-			status = nfs_try_mount(args, mntfh);
-
-		kfree(args->nfs_server.export_path);
-		args->nfs_server.export_path = NULL;
-
-		if (status)
-			return status;
+		else
+			return nfs_validate_text_mount_data(options, args, mntfh, dev_name);
 
 		break;
 		}
-- 
1.7.8.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux