]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/network.c
mount.nfs: Support an "rdma" mount option
[nfs-utils.git] / utils / mount / network.c
index d9903ed44c492cc3fccedfa04ea2b38ab5a3b83f..d61242798f6a7153472cb132fb54927a602cb4d1 100644 (file)
@@ -53,6 +53,7 @@
 #include "parse_opt.h"
 #include "network.h"
 #include "conffile.h"
+#include "nfslib.h"
 
 #define PMAP_TIMEOUT   (10)
 #define CONNECT_TIMEOUT        (20)
@@ -82,6 +83,7 @@ static const char *nfs_nfs_pgmtbl[] = {
 static const char *nfs_transport_opttbl[] = {
        "udp",
        "tcp",
+       "rdma",
        "proto",
        NULL,
 };
@@ -1306,11 +1308,16 @@ nfs_nfs_protocol(struct mount_options *options, unsigned long *protocol)
        case 1: /* tcp */
                *protocol = IPPROTO_TCP;
                return 1;
-       case 2: /* proto */
+       case 2: /* rdma */
+               *protocol = NFSPROTO_RDMA;
+               return 1;
+       case 3: /* proto */
                option = po_get(options, "proto");
                if (option != NULL) {
                        if (!nfs_get_proto(option, &family, protocol)) {
                                errno = EPROTONOSUPPORT;
+                               nfs_error(_("%s: Failed to find '%s' protocol"), 
+                                       progname, option);
                                return 0;
                        }
                        return 1;
@@ -1361,7 +1368,7 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port)
 sa_family_t    config_default_family = AF_UNSPEC;
 
 static int
-nfs_verify_family(sa_family_t family)
+nfs_verify_family(sa_family_t UNUSED(family))
 {
        return 1;
 }
@@ -1393,14 +1400,20 @@ int nfs_nfs_proto_family(struct mount_options *options,
        switch (po_rightmost(options, nfs_transport_opttbl)) {
        case 0: /* udp */
        case 1: /* tcp */
+       case 2: /* rdma */
                /* for compatibility; these are always AF_INET */
                *family = AF_INET;
                return 1;
-       case 2: /* proto */
+       case 3: /* proto */
                option = po_get(options, "proto");
                if (option != NULL &&
-                   !nfs_get_proto(option, &tmp_family, &protocol))
-                       goto out_err;
+                   !nfs_get_proto(option, &tmp_family, &protocol)) {
+
+                       nfs_error(_("%s: Failed to find '%s' protocol"), 
+                               progname, option);
+                       errno = EPROTONOSUPPORT;
+                       return 0;
+               }
        }
 
        if (!nfs_verify_family(tmp_family))
@@ -1492,6 +1505,8 @@ nfs_mount_protocol(struct mount_options *options, unsigned long *protocol)
        if (option != NULL) {
                if (!nfs_get_proto(option, &family, protocol)) {
                        errno = EPROTONOSUPPORT;
+                       nfs_error(_("%s: Failed to find '%s' protocol"), 
+                               progname, option);
                        return 0;
                }
                return 1;
@@ -1551,8 +1566,12 @@ int nfs_mount_proto_family(struct mount_options *options,
 
        option = po_get(options, "mountproto");
        if (option != NULL) {
-               if (!nfs_get_proto(option, &tmp_family, &protocol))
+               if (!nfs_get_proto(option, &tmp_family, &protocol)) {
+                       nfs_error(_("%s: Failed to find '%s' protocol"), 
+                               progname, option);
+                       errno = EPROTONOSUPPORT;
                        goto out_err;
+               }
                if (!nfs_verify_family(tmp_family))
                        goto out_err;
                *family = tmp_family;