]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mountd: Support TI-RPC mountd listener
authorChuck Lever <chuck.lever@oracle.com>
Mon, 27 Sep 2010 14:09:10 +0000 (10:09 -0400)
committerSteve Dickson <steved@redhat.com>
Mon, 27 Sep 2010 15:28:10 +0000 (11:28 -0400)
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@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mountd/mountd.c

index 753fd377331598946ade574fc0ae785b334d360f..a4fdcc8a98082decf805e826b2a039ecfb962b83 100644 (file)
@@ -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);