Skip to contentSkip to conversation

text-based mount.nfs: combine nfsmount_s() and nfs4mount_s() paths

PATCH In review Chuck Lever 1 participant 1 message Oct 8, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/12 text-based mount.nfs: combine nfsmount_s() and nfs4mount_s() paths

The top-level logic that handles text-based mount options is mostly the same for NFS and NFSv4 mounts. To improve maintainability, let's combine the nfsmount_s() and nfs4mount_s() functions.

---

 utils/mount/mount.c   |   12 +++-------
 utils/mount/stropts.c |   59 +++++++++++++++++++++++++++++++++++++++++++++++++
 utils/mount/stropts.h |    4 ++-
 3 files changed, 65 insertions(+), 10 deletions(-)
utils/mount/mount.c +4 -8
index e622231..21946f7 100644
@@ -376,14 +376,10 @@ static int try_mount(char *spec, char *mount_point, int flags,
 {
 	int ret;
 
-	if (string) {
-		if (strcmp(fs_type, "nfs4") == 0)
-			ret = nfs4mount_s(spec, mount_point, flags,
-						extra_opts, fake, bg);
-		else
-			ret = nfsmount_s(spec, mount_point, flags,
-						extra_opts, fake, bg);
-	} else {
+	if (string)
+		ret = nfsmount_string(spec, mount_point, fs_type, flags,
+					extra_opts, fake, bg);
+	else {
 		if (strcmp(fs_type, "nfs4") == 0)
 			ret = nfs4mount(spec, mount_point, flags,
 					extra_opts, fake, bg);
utils/mount/stropts.c +59 -0

62 lines not on this page · raw message

utils/mount/stropts.h +2 -2
index a2a0604..b926d68 100644
@@ -21,5 +21,5 @@
  *
  */
 
-int nfsmount_s(const char *, const char *, int , char **, int, int);
-int nfs4mount_s(const char *, const char *, int, char **, int, int);
+int nfsmount_string(const char *, const char *, const char *, int,
+			char **, int, int);

-------------------------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs