Skip to contentSkip to conversation

libnfs.a: move mnt_{open, close}clnt calls to utils/mount/network.c

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

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

PATCH 16/23 libnfs.a: move mnt_{open, close}clnt calls to utils/mount/network.c

It turns out that get_socket() accesses a global variable, "verbose," that is only available in the mount command; yet it's in libnfs.a. This creates an undocumented API dependency that will bite someone someday. This mount-specific functionality doesn't really belong in libnfs.a anyway.

The simplest way to resolve this is to move all of the functions in support/nfs/conn.c into utils/mount. network.c seems like the logical place to put these. An added benefit is we eventually get to make get_socket() static.

Let's start with the mnt_{open,close}clnt functions.

---

 support/include/conn.h |    5 -----
 support/nfs/conn.c     |   48 ------------------------------------------------
 utils/mount/network.c  |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 utils/mount/network.h  |    6 ++++++
 4 files changed, 53 insertions(+), 53 deletions(-)
support/include/conn.h +0 -5
index 11f16ab..f21c10e 100644
@@ -18,9 +18,6 @@
 #include <rpc/pmap_prot.h>
 #include <rpc/clnt.h>
 
-#define MNT_SENDBUFSIZE ((u_int)2048)
-#define MNT_RECVBUFSIZE ((u_int)1024)
-
 typedef struct {
 	char **hostname;
 	struct sockaddr_in saddr;
@@ -36,8 +33,6 @@ int clnt_ping(struct sockaddr_in *, const u_long, const u_long, const u_int,
 u_long nfsvers_to_mnt(const u_long);
 u_long mntvers_to_nfs(const u_long);
 int get_socket(struct sockaddr_in *, u_int, int, int);
-CLIENT * mnt_openclnt(clnt_addr_t *, int *);
-void mnt_closeclnt(CLIENT *, int);
 
 #endif /* _CONN_H */
 
support/nfs/conn.c +0 -48

51 lines not on this page · raw message

utils/mount/network.c +47 -0

50 lines not on this page · raw message

utils/mount/network.h +6 -0
index 83375f0..81a59da 100644
@@ -24,8 +24,14 @@
 #include "conn.h"
 #include "mount.h"
 
+#define MNT_SENDBUFSIZE (2048U)
+#define MNT_RECVBUFSIZE (1024U)
+
 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);
+
+CLIENT *mnt_openclnt(clnt_addr_t *, int *);
+void mnt_closeclnt(CLIENT *, 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