提交 fc200e79 编写于 作者: C Chuck Lever 提交者: Trond Myklebust

SUNRPC: Document some naked integers in rpcbind client

Clean up: Replace naked integers that represent rpcbind protocol versions.
Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 877fcf10
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
#define RPCBIND_PROGRAM (100000u) #define RPCBIND_PROGRAM (100000u)
#define RPCBIND_PORT (111u) #define RPCBIND_PORT (111u)
#define RPCBVERS_2 (2u)
#define RPCBVERS_3 (3u)
#define RPCBVERS_4 (4u)
enum { enum {
RPCBPROC_NULL, RPCBPROC_NULL,
RPCBPROC_SET, RPCBPROC_SET,
...@@ -82,7 +86,7 @@ static struct rpc_procinfo rpcb_procedures2[]; ...@@ -82,7 +86,7 @@ static struct rpc_procinfo rpcb_procedures2[];
static struct rpc_procinfo rpcb_procedures3[]; static struct rpc_procinfo rpcb_procedures3[];
struct rpcb_info { struct rpcb_info {
int rpc_vers; u32 rpc_vers;
struct rpc_procinfo * rpc_proc; struct rpc_procinfo * rpc_proc;
}; };
...@@ -177,7 +181,7 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) ...@@ -177,7 +181,7 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay)
prog, vers, prot, port); prog, vers, prot, port);
rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin, rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin,
sizeof(sin), XPRT_TRANSPORT_UDP, 2, 1); sizeof(sin), XPRT_TRANSPORT_UDP, RPCBVERS_2, 1);
if (IS_ERR(rpcb_clnt)) if (IS_ERR(rpcb_clnt))
return PTR_ERR(rpcb_clnt); return PTR_ERR(rpcb_clnt);
...@@ -227,7 +231,7 @@ int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot) ...@@ -227,7 +231,7 @@ int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot)
__func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin, rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin,
sizeof(*sin), prot, 2, 0); sizeof(*sin), prot, RPCBVERS_2, 0);
if (IS_ERR(rpcb_clnt)) if (IS_ERR(rpcb_clnt))
return PTR_ERR(rpcb_clnt); return PTR_ERR(rpcb_clnt);
...@@ -588,35 +592,54 @@ static struct rpc_procinfo rpcb_procedures4[] = { ...@@ -588,35 +592,54 @@ static struct rpc_procinfo rpcb_procedures4[] = {
static struct rpcb_info rpcb_next_version[] = { static struct rpcb_info rpcb_next_version[] = {
#ifdef CONFIG_SUNRPC_BIND34 #ifdef CONFIG_SUNRPC_BIND34
{ 4, &rpcb_procedures4[RPCBPROC_GETVERSADDR] }, {
{ 3, &rpcb_procedures3[RPCBPROC_GETADDR] }, .rpc_vers = RPCBVERS_4,
.rpc_proc = &rpcb_procedures4[RPCBPROC_GETVERSADDR],
},
{
.rpc_vers = RPCBVERS_3,
.rpc_proc = &rpcb_procedures3[RPCBPROC_GETADDR],
},
#endif #endif
{ 2, &rpcb_procedures2[RPCBPROC_GETPORT] }, {
{ 0, NULL }, .rpc_vers = RPCBVERS_2,
.rpc_proc = &rpcb_procedures2[RPCBPROC_GETPORT],
},
{
.rpc_proc = NULL,
},
}; };
static struct rpcb_info rpcb_next_version6[] = { static struct rpcb_info rpcb_next_version6[] = {
#ifdef CONFIG_SUNRPC_BIND34 #ifdef CONFIG_SUNRPC_BIND34
{ 4, &rpcb_procedures4[RPCBPROC_GETVERSADDR] }, {
{ 3, &rpcb_procedures3[RPCBPROC_GETADDR] }, .rpc_vers = RPCBVERS_4,
.rpc_proc = &rpcb_procedures4[RPCBPROC_GETVERSADDR],
},
{
.rpc_vers = RPCBVERS_3,
.rpc_proc = &rpcb_procedures3[RPCBPROC_GETADDR],
},
#endif #endif
{ 0, NULL }, {
.rpc_proc = NULL,
},
}; };
static struct rpc_version rpcb_version2 = { static struct rpc_version rpcb_version2 = {
.number = 2, .number = RPCBVERS_2,
.nrprocs = RPCB_HIGHPROC_2, .nrprocs = RPCB_HIGHPROC_2,
.procs = rpcb_procedures2 .procs = rpcb_procedures2
}; };
static struct rpc_version rpcb_version3 = { static struct rpc_version rpcb_version3 = {
.number = 3, .number = RPCBVERS_3,
.nrprocs = RPCB_HIGHPROC_3, .nrprocs = RPCB_HIGHPROC_3,
.procs = rpcb_procedures3 .procs = rpcb_procedures3
}; };
static struct rpc_version rpcb_version4 = { static struct rpc_version rpcb_version4 = {
.number = 4, .number = RPCBVERS_4,
.nrprocs = RPCB_HIGHPROC_4, .nrprocs = RPCB_HIGHPROC_4,
.procs = rpcb_procedures4 .procs = rpcb_procedures4
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册