aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-06-25 17:24:31 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-07-09 12:09:34 -0400
commitfc200e794d723bc88c39859e8f096b717532f9c9 (patch)
tree8d87aa1d23936137902d1f5dbdad7ea48601b8c3
parent877fcf103982e52a59a1035378b4c0b8c63fe004 (diff)
SUNRPC: Document some naked integers in rpcbind client
Clean up: Replace naked integers that represent rpcbind protocol versions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--net/sunrpc/rpcb_clnt.c49
1 files changed, 36 insertions, 13 deletions
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index cf2b91613ac6..b23a719aca30 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -32,6 +32,10 @@
32#define RPCBIND_PROGRAM (100000u) 32#define RPCBIND_PROGRAM (100000u)
33#define RPCBIND_PORT (111u) 33#define RPCBIND_PORT (111u)
34 34
35#define RPCBVERS_2 (2u)
36#define RPCBVERS_3 (3u)
37#define RPCBVERS_4 (4u)
38
35enum { 39enum {
36 RPCBPROC_NULL, 40 RPCBPROC_NULL,
37 RPCBPROC_SET, 41 RPCBPROC_SET,
@@ -82,7 +86,7 @@ static struct rpc_procinfo rpcb_procedures2[];
82static struct rpc_procinfo rpcb_procedures3[]; 86static struct rpc_procinfo rpcb_procedures3[];
83 87
84struct rpcb_info { 88struct rpcb_info {
85 int rpc_vers; 89 u32 rpc_vers;
86 struct rpc_procinfo * rpc_proc; 90 struct rpc_procinfo * rpc_proc;
87}; 91};
88 92
@@ -177,7 +181,7 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay)
177 prog, vers, prot, port); 181 prog, vers, prot, port);
178 182
179 rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin, 183 rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin,
180 sizeof(sin), XPRT_TRANSPORT_UDP, 2, 1); 184 sizeof(sin), XPRT_TRANSPORT_UDP, RPCBVERS_2, 1);
181 if (IS_ERR(rpcb_clnt)) 185 if (IS_ERR(rpcb_clnt))
182 return PTR_ERR(rpcb_clnt); 186 return PTR_ERR(rpcb_clnt);
183 187
@@ -227,7 +231,7 @@ int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot)
227 __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); 231 __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
228 232
229 rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin, 233 rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin,
230 sizeof(*sin), prot, 2, 0); 234 sizeof(*sin), prot, RPCBVERS_2, 0);
231 if (IS_ERR(rpcb_clnt)) 235 if (IS_ERR(rpcb_clnt))
232 return PTR_ERR(rpcb_clnt); 236 return PTR_ERR(rpcb_clnt);
233 237
@@ -588,35 +592,54 @@ static struct rpc_procinfo rpcb_procedures4[] = {
588 592
589static struct rpcb_info rpcb_next_version[] = { 593static struct rpcb_info rpcb_next_version[] = {
590#ifdef CONFIG_SUNRPC_BIND34 594#ifdef CONFIG_SUNRPC_BIND34
591 { 4, &rpcb_procedures4[RPCBPROC_GETVERSADDR] }, 595 {
592 { 3, &rpcb_procedures3[RPCBPROC_GETADDR] }, 596 .rpc_vers = RPCBVERS_4,
597 .rpc_proc = &rpcb_procedures4[RPCBPROC_GETVERSADDR],
598 },
599 {
600 .rpc_vers = RPCBVERS_3,
601 .rpc_proc = &rpcb_procedures3[RPCBPROC_GETADDR],
602 },
593#endif 603#endif
594 { 2, &rpcb_procedures2[RPCBPROC_GETPORT] }, 604 {
595 { 0, NULL }, 605 .rpc_vers = RPCBVERS_2,
606 .rpc_proc = &rpcb_procedures2[RPCBPROC_GETPORT],
607 },
608 {
609 .rpc_proc = NULL,
610 },
596}; 611};
597 612
598static struct rpcb_info rpcb_next_version6[] = { 613static struct rpcb_info rpcb_next_version6[] = {
599#ifdef CONFIG_SUNRPC_BIND34 614#ifdef CONFIG_SUNRPC_BIND34
600 { 4, &rpcb_procedures4[RPCBPROC_GETVERSADDR] }, 615 {
601 { 3, &rpcb_procedures3[RPCBPROC_GETADDR] }, 616 .rpc_vers = RPCBVERS_4,
617 .rpc_proc = &rpcb_procedures4[RPCBPROC_GETVERSADDR],
618 },
619 {
620 .rpc_vers = RPCBVERS_3,
621 .rpc_proc = &rpcb_procedures3[RPCBPROC_GETADDR],
622 },
602#endif 623#endif
603 { 0, NULL }, 624 {
625 .rpc_proc = NULL,
626 },
604}; 627};
605 628
606static struct rpc_version rpcb_version2 = { 629static struct rpc_version rpcb_version2 = {
607 .number = 2, 630 .number = RPCBVERS_2,
608 .nrprocs = RPCB_HIGHPROC_2, 631 .nrprocs = RPCB_HIGHPROC_2,
609 .procs = rpcb_procedures2 632 .procs = rpcb_procedures2
610}; 633};
611 634
612static struct rpc_version rpcb_version3 = { 635static struct rpc_version rpcb_version3 = {
613 .number = 3, 636 .number = RPCBVERS_3,
614 .nrprocs = RPCB_HIGHPROC_3, 637 .nrprocs = RPCB_HIGHPROC_3,
615 .procs = rpcb_procedures3 638 .procs = rpcb_procedures3
616}; 639};
617 640
618static struct rpc_version rpcb_version4 = { 641static struct rpc_version rpcb_version4 = {
619 .number = 4, 642 .number = RPCBVERS_4,
620 .nrprocs = RPCB_HIGHPROC_4, 643 .nrprocs = RPCB_HIGHPROC_4,
621 .procs = rpcb_procedures4 644 .procs = rpcb_procedures4
622}; 645};