Skip to contentSkip to conversation

umount.nfs: move nfs_call_umount to network.c

PATCH In review Chuck Lever 1 participant 1 message Jul 28, 2007

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

PATCH 7/23 umount.nfs: move nfs_call_umount to network.c

nfs_call_umount() is shared by nfsmount.c and nfsumount.c, and manages a network function (building the RPC umount call to the server's MNT daemon). So move it to network.c with other network-related functions.

---

 utils/mount/network.c   |   35 +++++++++++++++++++++++++++++++++--
 utils/mount/network.h   |    7 +++----
 utils/mount/nfsumount.c |   37 -------------------------------------
 utils/mount/nfsumount.h |    1 -
 4 files changed, 36 insertions(+), 44 deletions(-)
utils/mount/network.c +33 -2
index ab8cfb7..b04491c 100644
@@ -245,7 +245,7 @@ out_ok:
 	return 1;
 }
 
-int probe_nfsport(clnt_addr_t *nfs_server)
+static int probe_nfsport(clnt_addr_t *nfs_server)
 {
 	struct pmap *pmap = &nfs_server->pmap;
 
@@ -258,7 +258,7 @@ int probe_nfsport(clnt_addr_t *nfs_server)
 		return probe_port(nfs_server, probe_nfs2_only, probe_udp_only);
 }
 
-int probe_mntport(clnt_addr_t *mnt_server)
+static int probe_mntport(clnt_addr_t *mnt_server)
 {
 	struct pmap *pmap = &mnt_server->pmap;
 
@@ -362,3 +362,34 @@ int start_statd(void)
 
 	return 0;
 }
+
+int nfs_call_umount(clnt_addr_t *mnt_server, dirpath *argp)
+{
+	CLIENT *clnt;
+	enum clnt_stat res = 0;
+	int msock;
+
+	switch (mnt_server->pmap.pm_vers) {
+	case 3:
+	case 2:
+	case 1:
+		if (!probe_mntport(mnt_server))
+			goto out_bad;
+		clnt = mnt_openclnt(mnt_server, &msock);
+		if (!clnt)
+			goto out_bad;
+		res = clnt_call(clnt, MOUNTPROC_UMNT,
+				(xdrproc_t) xdr_dirpath, (caddr_t)argp,
+				(xdrproc_t) xdr_void, NULL,
+				TIMEOUT);
+		mnt_closeclnt(clnt, msock);
+		if (res == RPC_SUCCESS)
+			return 1;
+		break;
+	default:
+		res = 1;
+		break;
+	}
+ out_bad:
+	return res;
+}
utils/mount/network.h +3 -4
index bb5b4da..83375f0 100644
@@ -22,11 +22,10 @@
  */
 
 #include "conn.h"
+#include "mount.h"
 
-int nfs_gethostbyname(const char *, struct sockaddr_in *);
-
-int probe_mntport(clnt_addr_t *);
-int probe_nfsport(clnt_addr_t *);
 int probe_bothports(clnt_addr_t *, clnt_addr_t *);
+int nfs_gethostbyname(const char *, struct sockaddr_in *);
+int nfs_call_umount(clnt_addr_t *, dirpath *);
 
 int start_statd(void);
utils/mount/nfsumount.c +0 -37
index 477f262..2d68e7e 100644
@@ -53,43 +53,6 @@ int force;
 int lazy;
 int remount;
 
-static inline enum clnt_stat
-nfs_umount(dirpath *argp, CLIENT *clnt)
-{
-	return clnt_call(clnt, MOUNTPROC_UMNT,
-			 (xdrproc_t) xdr_dirpath, (caddr_t)argp,
-			 (xdrproc_t) xdr_void, NULL,
-			 TIMEOUT);
-}
-
-int nfs_call_umount(clnt_addr_t *mnt_server, dirpath *argp)
-{
-	CLIENT *clnt;
-	enum clnt_stat res = 0;
-	int msock;
-
-	switch (mnt_server->pmap.pm_vers) {
-	case 3:
-	case 2:
-	case 1:
-		if (!probe_mntport(mnt_server))
-			goto out_bad;
-		clnt = mnt_openclnt(mnt_server, &msock);
-		if (!clnt)
-			goto out_bad;
-		res = nfs_umount(argp, clnt);
-		mnt_closeclnt(clnt, msock);
-		if (res == RPC_SUCCESS)
-			return 1;
-		break;
-	default:
-		res = 1;
-		break;
-	}
- out_bad:
-	return res;
-}
-
 int del_mtab(const char *spec, const char *node)
 {
 	int umnt_err, res;
utils/mount/nfsumount.h +0 -1
index 191118d..0d67d27 100644
@@ -5,6 +5,5 @@
 #include "mount.h"
 
 int nfsumount(int, char **);
-int nfs_call_umount(clnt_addr_t *, dirpath *);
 
 #endif

-------------------------------------------------------------------------
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