Commit 49b5699b3fc22b363534c509c1b7dba06bc677bf

Authored by Chuck Lever
Committed by J. Bruce Fields
1 parent b7ba597fb9

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>

Showing 1 changed file with 20 additions and 31 deletions Side-by-side Diff

... ... @@ -44,8 +44,6 @@
44 44 u32 state;
45 45 };
46 46  
47   -static struct rpc_clnt * nsm_create(void);
48   -
49 47 static struct rpc_program nsm_program;
50 48 static LIST_HEAD(nsm_handles);
51 49 static DEFINE_SPINLOCK(nsm_lock);
52 50  
... ... @@ -98,12 +96,27 @@
98 96 }
99 97 }
100 98  
101   -/*
102   - * Common procedure for NSMPROC_MON/NSMPROC_UNMON calls
103   - */
104   -static int
105   -nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
  99 +static struct rpc_clnt *nsm_create(void)
106 100 {
  101 + struct sockaddr_in sin = {
  102 + .sin_family = AF_INET,
  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)
  119 +{
107 120 struct rpc_clnt *clnt;
108 121 int status;
109 122 struct nsm_args args = {
... ... @@ -406,30 +419,6 @@
406 419 nsm->sm_name, nsm->sm_addrbuf);
407 420 kfree(nsm);
408 421 }
409   -}
410   -
411   -/*
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 422 }
434 423  
435 424 /*