diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2008-12-11 17:56:37 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-01-06 11:53:56 -0500 |
commit | 49b5699b3fc22b363534c509c1b7dba06bc677bf (patch) | |
tree | e5c1e0d74918a902f1830dddf170d8c07155204e /fs/lockd | |
parent | b7ba597fb964dfa44284904b3b3d74d44b8e1c42 (diff) |
NSM: Move nsm_create()
Clean up: one last thing... relocate nsm_create() to eliminate the forward
declaration and group it near the only function that actually uses it.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/mon.c | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index fafa0ea71938..5e2c4d5ac827 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -44,8 +44,6 @@ struct nsm_res { | |||
44 | u32 state; | 44 | u32 state; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static struct rpc_clnt * nsm_create(void); | ||
48 | |||
49 | static struct rpc_program nsm_program; | 47 | static struct rpc_program nsm_program; |
50 | static LIST_HEAD(nsm_handles); | 48 | static LIST_HEAD(nsm_handles); |
51 | static DEFINE_SPINLOCK(nsm_lock); | 49 | static DEFINE_SPINLOCK(nsm_lock); |
@@ -98,11 +96,26 @@ static void nsm_display_address(const struct sockaddr *sap, | |||
98 | } | 96 | } |
99 | } | 97 | } |
100 | 98 | ||
101 | /* | 99 | static struct rpc_clnt *nsm_create(void) |
102 | * Common procedure for NSMPROC_MON/NSMPROC_UNMON calls | 100 | { |
103 | */ | 101 | struct sockaddr_in sin = { |
104 | static int | 102 | .sin_family = AF_INET, |
105 | nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res) | 103 | .sin_addr.s_addr = htonl(INADDR_LOOPBACK), |
104 | }; | ||
105 | struct rpc_create_args args = { | ||
106 | .protocol = XPRT_TRANSPORT_UDP, | ||
107 | .address = (struct sockaddr *)&sin, | ||
108 | .addrsize = sizeof(sin), | ||
109 | .servername = "rpc.statd", | ||
110 | .program = &nsm_program, | ||
111 | .version = NSM_VERSION, | ||
112 | .authflavor = RPC_AUTH_NULL, | ||
113 | }; | ||
114 | |||
115 | return rpc_create(&args); | ||
116 | } | ||
117 | |||
118 | static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res) | ||
106 | { | 119 | { |
107 | struct rpc_clnt *clnt; | 120 | struct rpc_clnt *clnt; |
108 | int status; | 121 | int status; |
@@ -409,30 +422,6 @@ void nsm_release(struct nsm_handle *nsm) | |||
409 | } | 422 | } |
410 | 423 | ||
411 | /* | 424 | /* |
412 | * Create NSM client for the local host | ||
413 | */ | ||
414 | static struct rpc_clnt * | ||
415 | nsm_create(void) | ||
416 | { | ||
417 | struct sockaddr_in sin = { | ||
418 | .sin_family = AF_INET, | ||
419 | .sin_addr.s_addr = htonl(INADDR_LOOPBACK), | ||
420 | .sin_port = 0, | ||
421 | }; | ||
422 | struct rpc_create_args args = { | ||
423 | .protocol = XPRT_TRANSPORT_UDP, | ||
424 | .address = (struct sockaddr *)&sin, | ||
425 | .addrsize = sizeof(sin), | ||
426 | .servername = "localhost", | ||
427 | .program = &nsm_program, | ||
428 | .version = NSM_VERSION, | ||
429 | .authflavor = RPC_AUTH_NULL, | ||
430 | }; | ||
431 | |||
432 | return rpc_create(&args); | ||
433 | } | ||
434 | |||
435 | /* | ||
436 | * XDR functions for NSM. | 425 | * XDR functions for NSM. |
437 | * | 426 | * |
438 | * See http://www.opengroup.org/ for details on the Network | 427 | * See http://www.opengroup.org/ for details on the Network |