[PATCH 2/7] mountd: Support TI-RPC mountd listener

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

 



If TI-RPC is available, use it to create mountd's svc listener.  If
not, use the old function, rpc_init(), to create mountd's listener.

IPv6 can be supported if TI-RPC is available.  In this case,
/etc/netconfig is searched to determine which transports to advertise.

Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---

 utils/mountd/mountd.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 753fd37..a4fdcc8 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -86,6 +86,11 @@ static int version3(void)
 	return nfs_version & NFSVERSBIT(3);
 }
 
+static int version23(void)
+{
+	return nfs_version & (NFSVERSBIT(2) | NFSVERSBIT(3));
+}
+
 static int version_any(void)
 {
 	return nfs_version & NFSVERSBIT_ALL;
@@ -95,11 +100,11 @@ static void
 unregister_services (void)
 {
 	if (version2()) {
-		pmap_unset (MOUNTPROG, MOUNTVERS);
-		pmap_unset (MOUNTPROG, MOUNTVERS_POSIX);
+		nfs_svc_unregister(MOUNTPROG, MOUNTVERS);
+		nfs_svc_unregister(MOUNTPROG, MOUNTVERS_POSIX);
 	}
 	if (version3())
-		pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3);
+		nfs_svc_unregister(MOUNTPROG, MOUNTVERS_NFSV3);
 }
 
 static void
@@ -687,6 +692,7 @@ main(int argc, char **argv)
 {
 	char	*export_file = _PATH_EXPORTS;
 	char    *state_dir = NFS_STATEDIR;
+	unsigned int listeners = 0;
 	int	foreground = 0;
 	int	port = 0;
 	int	descriptors = 0;
@@ -830,14 +836,16 @@ main(int argc, char **argv)
 		cache_open();
 
 	if (version2()) {
-		rpc_init("mountd", MOUNTPROG, MOUNTVERS,
-			 mount_dispatch, port);
-		rpc_init("mountd", MOUNTPROG, MOUNTVERS_POSIX,
-			 mount_dispatch, port);
+		listeners += nfs_svc_create("mountd", MOUNTPROG,
+					MOUNTVERS, mount_dispatch, port);
+		listeners += nfs_svc_create("mountd", MOUNTPROG,
+					MOUNTVERS_POSIX, mount_dispatch, port);
 	}
 	if (version3())
-		rpc_init("mountd", MOUNTPROG, MOUNTVERS_NFSV3,
-			 mount_dispatch, port);
+		listeners += nfs_svc_create("mountd", MOUNTPROG,
+					MOUNTVERS_NFSV3, mount_dispatch, port);
+	if (version23() && listeners == 0)
+		xlog(L_FATAL, "mountd: could not create listeners\n");
 
 	sa.sa_handler = killer;
 	sigaction(SIGINT, &sa, NULL);

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