提交 49b5699b 编写于 作者: C Chuck Lever 提交者: J. Bruce Fields

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: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
上级 b7ba597f
...@@ -44,8 +44,6 @@ struct nsm_res { ...@@ -44,8 +44,6 @@ struct nsm_res {
u32 state; u32 state;
}; };
static struct rpc_clnt * nsm_create(void);
static struct rpc_program nsm_program; static struct rpc_program nsm_program;
static LIST_HEAD(nsm_handles); static LIST_HEAD(nsm_handles);
static DEFINE_SPINLOCK(nsm_lock); static DEFINE_SPINLOCK(nsm_lock);
...@@ -98,11 +96,26 @@ static void nsm_display_address(const struct sockaddr *sap, ...@@ -98,11 +96,26 @@ static void nsm_display_address(const struct sockaddr *sap,
} }
} }
/* static struct rpc_clnt *nsm_create(void)
* Common procedure for NSMPROC_MON/NSMPROC_UNMON calls {
*/ struct sockaddr_in sin = {
static int .sin_family = AF_INET,
nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res) .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
};
struct rpc_create_args args = {
.protocol = XPRT_TRANSPORT_UDP,
.address = (struct sockaddr *)&sin,
.addrsize = sizeof(sin),
.servername = "rpc.statd",
.program = &nsm_program,
.version = NSM_VERSION,
.authflavor = RPC_AUTH_NULL,
};
return rpc_create(&args);
}
static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
{ {
struct rpc_clnt *clnt; struct rpc_clnt *clnt;
int status; int status;
...@@ -408,30 +421,6 @@ void nsm_release(struct nsm_handle *nsm) ...@@ -408,30 +421,6 @@ void nsm_release(struct nsm_handle *nsm)
} }
} }
/*
* Create NSM client for the local host
*/
static struct rpc_clnt *
nsm_create(void)
{
struct sockaddr_in sin = {
.sin_family = AF_INET,
.sin_addr.s_addr = htonl(INADDR_LOOPBACK),
.sin_port = 0,
};
struct rpc_create_args args = {
.protocol = XPRT_TRANSPORT_UDP,
.address = (struct sockaddr *)&sin,
.addrsize = sizeof(sin),
.servername = "localhost",
.program = &nsm_program,
.version = NSM_VERSION,
.authflavor = RPC_AUTH_NULL,
};
return rpc_create(&args);
}
/* /*
* XDR functions for NSM. * XDR functions for NSM.
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册