]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
umount.nfs: move nfs_call_umount to network.c
authorChuck Lever <chuck.lever@oracle.com>
Sat, 28 Jul 2007 21:49:43 +0000 (17:49 -0400)
committerNeil Brown <neilb@suse.de>
Mon, 30 Jul 2007 06:12:53 +0000 (16:12 +1000)
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.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
utils/mount/network.c
utils/mount/network.h
utils/mount/nfsumount.c
utils/mount/nfsumount.h

index ab8cfb751a021989721074486f8c87791415e280..b04491c7e38605c8a0056803eb4bea962d4eccef 100644 (file)
@@ -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;
+}
index bb5b4dac374baeedeabee5b6238cd4cc05cf967a..83375f052a4be117db0d5dee05560b9e57a16318 100644 (file)
  */
 
 #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);
index 3d387c11e8c3a01b32fbab9004dcbe20f94c9b7a..9b7c44d167688d072347643edf15d36db06c7e88 100644 (file)
@@ -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;
index 191118d8431f3d73f42e418de31e634ab77314f9..0d67d27f596a7e49acad08f12e998f7610389554 100644 (file)
@@ -5,6 +5,5 @@
 #include "mount.h"
 
 int nfsumount(int, char **);
-int nfs_call_umount(clnt_addr_t *, dirpath *);
 
 #endif