Create a new function rpc_set_context_args where we parse and set the context
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 26 Dec 2013 00:57:52 +0000 (16:57 -0800)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 26 Dec 2013 00:57:52 +0000 (16:57 -0800)
arguments.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
lib/libnfs.c

index b6bd822ebabf2eda89eef9b04ecee4a845055c91..b90205d7778907141051e673e5312ef63ead3c1f 100644 (file)
@@ -173,6 +173,18 @@ char *nfs_get_error(struct nfs_context *nfs)
        return rpc_get_error(nfs->rpc);
 };
 
+int rpc_set_context_args(struct rpc_context *rpc, char *arg, char *val)
+{
+       if (!strncmp(arg, "tcp-syncnt", 10)) {
+               rpc_set_tcp_syncnt(rpc, atoi(val));
+       } else if (!strncmp(arg, "uid", 3)) {
+               rpc_set_uid(rpc, atoi(val));
+       } else if (!strncmp(arg, "gid", 3)) {
+               rpc_set_gid(rpc, atoi(val));
+       }
+       return 0;
+}
+
 static struct nfs_url *nfs_parse_url(struct nfs_context *nfs, const char *url, int dir, int incomplete)
 {
        struct nfs_url *urls;
@@ -280,13 +292,8 @@ flags:
                if (strp2) {
                        *strp2 = 0;
                        strp2++;
-                       if (!strncmp(strp, "tcp-syncnt", 10)) {
-                               rpc_set_tcp_syncnt(nfs->rpc, atoi(strp2));
-                       } else if (!strncmp(strp, "uid", 3)) {
-                               rpc_set_uid(nfs->rpc, atoi(strp2));
-                       } else if (!strncmp(strp, "gid", 3)) {
-                               rpc_set_gid(nfs->rpc, atoi(strp2));
-                       }
+                       rpc_set_context_args(nfs_get_rpc_context(nfs),
+                                       strp, strp2);
                }
        }