patch-2.1.34 linux/net/sunrpc/pmap_clnt.c
Next file: linux/net/sunrpc/svcsock.c
Previous file: linux/net/rose/rose_timer.c
Back to the patch index
Back to the overall index
- Lines: 45
- Date:
Mon Apr 14 09:31:10 1997
- Orig file:
v2.1.33/linux/net/sunrpc/pmap_clnt.c
- Orig date:
Mon Apr 7 11:35:33 1997
diff -u --recursive --new-file v2.1.33/linux/net/sunrpc/pmap_clnt.c linux/net/sunrpc/pmap_clnt.c
@@ -32,7 +32,8 @@
extern struct rpc_program pmap_program;
/*
- * Obtain the port for a given RPC service on a given host
+ * Obtain the port for a given RPC service on a given host. This one can
+ * be called for an ongoing RPC request.
*/
void
rpc_getport(struct rpc_task *task, struct rpc_clnt *clnt)
@@ -75,6 +76,34 @@
task->tk_status = -EIO;
task->tk_action = NULL;
}
+
+#ifdef CONFIG_ROOT_NFS
+int
+rpc_getport_external(struct sockaddr_in *sin, __u32 prog, __u32 vers, int prot)
+{
+ struct rpc_portmap map = { prog, vers, prot, 0 };
+ struct rpc_clnt *pmap_clnt;
+ char hostname[32];
+ int status;
+
+ dprintk("RPC: rpc_getport_external(%s, %d, %d, %d)\n",
+ in_ntoa(sin->sin_addr.s_addr), prog, vers, prot);
+
+ strcpy(hostname, in_ntoa(sin->sin_addr.s_addr));
+ if (!(pmap_clnt = pmap_create(hostname, sin, prot)))
+ return -EACCES;
+
+ /* Setup the call info struct */
+ status = rpc_call(pmap_clnt, PMAP_GETPORT, &map, &map.pm_port, 0);
+
+ if (status >= 0) {
+ if (map.pm_port != 0)
+ return map.pm_port;
+ status = -EACCES;
+ }
+ return status;
+}
+#endif
static void
pmap_getport_done(struct rpc_task *task)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov