aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-12-05 19:02:07 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-01-06 11:53:52 -0500
commit36e8e668d3e6a61848a8921ddeb663b417299fa5 (patch)
treec5ad964c566341f24ecf7d67f4b34173205e9143 /fs/lockd
parent9c1bfd037f7ff8badaecb47418f109148d88bf45 (diff)
NSM: Move NSM program and procedure numbers to fs/lockd/mon.c
Clean up: Move the RPC program and procedure numbers for NSM into the one source file that needs them: fs/lockd/mon.c. And, as with NLM, NFS, and rpcbind calls, use NSMPROC_FOO instead of SM_FOO for NSM procedure numbers. Finally, make a couple of comments more precise: what is referred to here as SM_NOTIFY is really the NLM (lockd) NLMPROC_SM_NOTIFY downcall, not NSMPROC_NOTIFY. 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.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 81308832e994..0fc9836db4e7 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -17,6 +17,18 @@
17 17
18 18
19#define NLMDBG_FACILITY NLMDBG_MONITOR 19#define NLMDBG_FACILITY NLMDBG_MONITOR
20#define NSM_PROGRAM 100024
21#define NSM_VERSION 1
22
23enum {
24 NSMPROC_NULL,
25 NSMPROC_STAT,
26 NSMPROC_MON,
27 NSMPROC_UNMON,
28 NSMPROC_UNMON_ALL,
29 NSMPROC_SIMU_CRASH,
30 NSMPROC_NOTIFY,
31};
20 32
21struct nsm_args { 33struct nsm_args {
22 __be32 addr; /* remote address */ 34 __be32 addr; /* remote address */
@@ -42,7 +54,7 @@ static struct rpc_program nsm_program;
42int nsm_local_state; 54int nsm_local_state;
43 55
44/* 56/*
45 * Common procedure for SM_MON/SM_UNMON calls 57 * Common procedure for NSMPROC_MON/NSMPROC_UNMON calls
46 */ 58 */
47static int 59static int
48nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res) 60nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
@@ -111,7 +123,7 @@ int nsm_monitor(const struct nlm_host *host)
111 */ 123 */
112 nsm->sm_mon_name = nsm_use_hostnames ? nsm->sm_name : nsm->sm_addrbuf; 124 nsm->sm_mon_name = nsm_use_hostnames ? nsm->sm_name : nsm->sm_addrbuf;
113 125
114 status = nsm_mon_unmon(nsm, SM_MON, &res); 126 status = nsm_mon_unmon(nsm, NSMPROC_MON, &res);
115 if (res.status != 0) 127 if (res.status != 0)
116 status = -EIO; 128 status = -EIO;
117 if (status < 0) 129 if (status < 0)
@@ -139,7 +151,7 @@ void nsm_unmonitor(const struct nlm_host *host)
139 && nsm->sm_monitored && !nsm->sm_sticky) { 151 && nsm->sm_monitored && !nsm->sm_sticky) {
140 dprintk("lockd: nsm_unmonitor(%s)\n", nsm->sm_name); 152 dprintk("lockd: nsm_unmonitor(%s)\n", nsm->sm_name);
141 153
142 status = nsm_mon_unmon(nsm, SM_UNMON, &res); 154 status = nsm_mon_unmon(nsm, NSMPROC_UNMON, &res);
143 if (res.status != 0) 155 if (res.status != 0)
144 status = -EIO; 156 status = -EIO;
145 if (status < 0) 157 if (status < 0)
@@ -167,7 +179,7 @@ nsm_create(void)
167 .addrsize = sizeof(sin), 179 .addrsize = sizeof(sin),
168 .servername = "localhost", 180 .servername = "localhost",
169 .program = &nsm_program, 181 .program = &nsm_program,
170 .version = SM_VERSION, 182 .version = NSM_VERSION,
171 .authflavor = RPC_AUTH_NULL, 183 .authflavor = RPC_AUTH_NULL,
172 }; 184 };
173 185
@@ -201,7 +213,7 @@ static __be32 *xdr_encode_mon_name(__be32 *p, struct nsm_args *argp)
201/* 213/*
202 * The "my_id" argument specifies the hostname and RPC procedure 214 * The "my_id" argument specifies the hostname and RPC procedure
203 * to be called when the status manager receives notification 215 * to be called when the status manager receives notification
204 * (via the SM_NOTIFY call) that the state of host "mon_name" 216 * (via the NLMPROC_SM_NOTIFY call) that the state of host "mon_name"
205 * has changed. 217 * has changed.
206 */ 218 */
207static __be32 *xdr_encode_my_id(__be32 *p, struct nsm_args *argp) 219static __be32 *xdr_encode_my_id(__be32 *p, struct nsm_args *argp)
@@ -219,7 +231,7 @@ static __be32 *xdr_encode_my_id(__be32 *p, struct nsm_args *argp)
219 231
220/* 232/*
221 * The "mon_id" argument specifies the non-private arguments 233 * The "mon_id" argument specifies the non-private arguments
222 * of an SM_MON or SM_UNMON call. 234 * of an NSMPROC_MON or NSMPROC_UNMON call.
223 */ 235 */
224static __be32 *xdr_encode_mon_id(__be32 *p, struct nsm_args *argp) 236static __be32 *xdr_encode_mon_id(__be32 *p, struct nsm_args *argp)
225{ 237{
@@ -232,8 +244,8 @@ static __be32 *xdr_encode_mon_id(__be32 *p, struct nsm_args *argp)
232 244
233/* 245/*
234 * The "priv" argument may contain private information required 246 * The "priv" argument may contain private information required
235 * by the SM_MON call. This information will be supplied in the 247 * by the NSMPROC_MON call. This information will be supplied in the
236 * SM_NOTIFY call. 248 * NLMPROC_SM_NOTIFY call.
237 * 249 *
238 * Linux provides the raw IP address of the monitored host, 250 * Linux provides the raw IP address of the monitored host,
239 * left in network byte order. 251 * left in network byte order.
@@ -300,22 +312,22 @@ xdr_decode_stat(struct rpc_rqst *rqstp, __be32 *p, struct nsm_res *resp)
300#define SM_unmonres_sz 1 312#define SM_unmonres_sz 1
301 313
302static struct rpc_procinfo nsm_procedures[] = { 314static struct rpc_procinfo nsm_procedures[] = {
303[SM_MON] = { 315[NSMPROC_MON] = {
304 .p_proc = SM_MON, 316 .p_proc = NSMPROC_MON,
305 .p_encode = (kxdrproc_t) xdr_encode_mon, 317 .p_encode = (kxdrproc_t) xdr_encode_mon,
306 .p_decode = (kxdrproc_t) xdr_decode_stat_res, 318 .p_decode = (kxdrproc_t) xdr_decode_stat_res,
307 .p_arglen = SM_mon_sz, 319 .p_arglen = SM_mon_sz,
308 .p_replen = SM_monres_sz, 320 .p_replen = SM_monres_sz,
309 .p_statidx = SM_MON, 321 .p_statidx = NSMPROC_MON,
310 .p_name = "MONITOR", 322 .p_name = "MONITOR",
311 }, 323 },
312[SM_UNMON] = { 324[NSMPROC_UNMON] = {
313 .p_proc = SM_UNMON, 325 .p_proc = NSMPROC_UNMON,
314 .p_encode = (kxdrproc_t) xdr_encode_unmon, 326 .p_encode = (kxdrproc_t) xdr_encode_unmon,
315 .p_decode = (kxdrproc_t) xdr_decode_stat, 327 .p_decode = (kxdrproc_t) xdr_decode_stat,
316 .p_arglen = SM_mon_id_sz, 328 .p_arglen = SM_mon_id_sz,
317 .p_replen = SM_unmonres_sz, 329 .p_replen = SM_unmonres_sz,
318 .p_statidx = SM_UNMON, 330 .p_statidx = NSMPROC_UNMON,
319 .p_name = "UNMONITOR", 331 .p_name = "UNMONITOR",
320 }, 332 },
321}; 333};
@@ -334,7 +346,7 @@ static struct rpc_stat nsm_stats;
334 346
335static struct rpc_program nsm_program = { 347static struct rpc_program nsm_program = {
336 .name = "statd", 348 .name = "statd",
337 .number = SM_PROGRAM, 349 .number = NSM_PROGRAM,
338 .nrvers = ARRAY_SIZE(nsm_version), 350 .nrvers = ARRAY_SIZE(nsm_version),
339 .version = nsm_version, 351 .version = nsm_version,
340 .stats = &nsm_stats 352 .stats = &nsm_stats