diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-07-01 12:13:12 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:46 -0400 |
commit | cce63cd6374e6f1b4ea897ece1454feb13993d7c (patch) | |
tree | 7e85088b49d36e8860fb3d5845e55bc8785efc3c | |
parent | f7fb558e503dc80e100acaf116f7261cdd97f0ca (diff) |
SUNRPC: Rename rpcb_getport_external routine
In preparation for handling NFS mount option parsing in the kernel,
rename rpcb_getport_external as rpcb_get_port_sync, and make it available
always (instead of only when CONFIG_ROOT_NFS is enabled).
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfsroot.c | 2 | ||||
-rw-r--r-- | include/linux/sunrpc/clnt.h | 7 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 21 |
3 files changed, 14 insertions, 16 deletions
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c index 49d1008ce1d7..f0db4703b1c9 100644 --- a/fs/nfs/nfsroot.c +++ b/fs/nfs/nfsroot.c | |||
@@ -428,7 +428,7 @@ static int __init root_nfs_getport(int program, int version, int proto) | |||
428 | printk(KERN_NOTICE "Looking up port of RPC %d/%d on %u.%u.%u.%u\n", | 428 | printk(KERN_NOTICE "Looking up port of RPC %d/%d on %u.%u.%u.%u\n", |
429 | program, version, NIPQUAD(servaddr)); | 429 | program, version, NIPQUAD(servaddr)); |
430 | set_sockaddr(&sin, servaddr, 0); | 430 | set_sockaddr(&sin, servaddr, 0); |
431 | return rpcb_getport_external(&sin, program, version, proto); | 431 | return rpcb_getport_sync(&sin, program, version, proto); |
432 | } | 432 | } |
433 | 433 | ||
434 | 434 | ||
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 097984b03857..b28d919c7758 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -120,8 +120,10 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | |||
120 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | 120 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
121 | void rpc_shutdown_client(struct rpc_clnt *); | 121 | void rpc_shutdown_client(struct rpc_clnt *); |
122 | void rpc_release_client(struct rpc_clnt *); | 122 | void rpc_release_client(struct rpc_clnt *); |
123 | |||
123 | int rpcb_register(u32, u32, int, unsigned short, int *); | 124 | int rpcb_register(u32, u32, int, unsigned short, int *); |
124 | void rpcb_getport(struct rpc_task *); | 125 | void rpcb_getport(struct rpc_task *); |
126 | int rpcb_getport_sync(struct sockaddr_in *, __u32, __u32, int); | ||
125 | 127 | ||
126 | void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); | 128 | void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); |
127 | 129 | ||
@@ -141,10 +143,5 @@ void rpc_force_rebind(struct rpc_clnt *); | |||
141 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); | 143 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); |
142 | char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); | 144 | char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); |
143 | 145 | ||
144 | /* | ||
145 | * Helper function for NFSroot support | ||
146 | */ | ||
147 | int rpcb_getport_external(struct sockaddr_in *, __u32, __u32, int); | ||
148 | |||
149 | #endif /* __KERNEL__ */ | 146 | #endif /* __KERNEL__ */ |
150 | #endif /* _LINUX_SUNRPC_CLNT_H */ | 147 | #endif /* _LINUX_SUNRPC_CLNT_H */ |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 9a20f380ab09..fc881a675eb9 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -12,6 +12,8 @@ | |||
12 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | 12 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | ||
16 | |||
15 | #include <linux/types.h> | 17 | #include <linux/types.h> |
16 | #include <linux/socket.h> | 18 | #include <linux/socket.h> |
17 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
@@ -247,21 +249,20 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) | |||
247 | return error; | 249 | return error; |
248 | } | 250 | } |
249 | 251 | ||
250 | #ifdef CONFIG_ROOT_NFS | ||
251 | /** | 252 | /** |
252 | * rpcb_getport_external - obtain the port for an RPC service on a given host | 253 | * rpcb_getport_sync - obtain the port for an RPC service on a given host |
253 | * @sin: address of remote peer | 254 | * @sin: address of remote peer |
254 | * @prog: RPC program number to bind | 255 | * @prog: RPC program number to bind |
255 | * @vers: RPC version number to bind | 256 | * @vers: RPC version number to bind |
256 | * @prot: transport protocol to use to make this request | 257 | * @prot: transport protocol to use to make this request |
257 | * | 258 | * |
258 | * Called from outside the RPC client in a synchronous task context. | 259 | * Called from outside the RPC client in a synchronous task context. |
260 | * Uses default timeout parameters specified by underlying transport. | ||
259 | * | 261 | * |
260 | * For now, this supports only version 2 queries, but is used only by | 262 | * XXX: Needs to support IPv6, and rpcbind versions 3 and 4 |
261 | * mount_clnt for NFS_ROOT. | ||
262 | */ | 263 | */ |
263 | int rpcb_getport_external(struct sockaddr_in *sin, __u32 prog, | 264 | int rpcb_getport_sync(struct sockaddr_in *sin, __u32 prog, |
264 | __u32 vers, int prot) | 265 | __u32 vers, int prot) |
265 | { | 266 | { |
266 | struct rpcbind_args map = { | 267 | struct rpcbind_args map = { |
267 | .r_prog = prog, | 268 | .r_prog = prog, |
@@ -278,10 +279,10 @@ int rpcb_getport_external(struct sockaddr_in *sin, __u32 prog, | |||
278 | char hostname[40]; | 279 | char hostname[40]; |
279 | int status; | 280 | int status; |
280 | 281 | ||
281 | dprintk("RPC: rpcb_getport_external(%u.%u.%u.%u, %u, %u, %d)\n", | 282 | dprintk("RPC: %s(" NIPQUAD_FMT ", %u, %u, %d)\n", |
282 | NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); | 283 | __FUNCTION__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); |
283 | 284 | ||
284 | sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(sin->sin_addr.s_addr)); | 285 | sprintf(hostname, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr)); |
285 | rpcb_clnt = rpcb_create(hostname, (struct sockaddr *)sin, prot, 2, 0); | 286 | rpcb_clnt = rpcb_create(hostname, (struct sockaddr *)sin, prot, 2, 0); |
286 | if (IS_ERR(rpcb_clnt)) | 287 | if (IS_ERR(rpcb_clnt)) |
287 | return PTR_ERR(rpcb_clnt); | 288 | return PTR_ERR(rpcb_clnt); |
@@ -296,7 +297,7 @@ int rpcb_getport_external(struct sockaddr_in *sin, __u32 prog, | |||
296 | } | 297 | } |
297 | return status; | 298 | return status; |
298 | } | 299 | } |
299 | #endif | 300 | EXPORT_SYMBOL_GPL(rpcb_getport_sync); |
300 | 301 | ||
301 | /** | 302 | /** |
302 | * rpcb_getport - obtain the port for a given RPC service on a given host | 303 | * rpcb_getport - obtain the port for a given RPC service on a given host |