Skip to content

Commit 36e8e66

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
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>
1 parent 9c1bfd0 commit 36e8e66

2 files changed

Lines changed: 27 additions & 24 deletions

File tree

‎fs/lockd/mon.c‎

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717

1818

1919
#define NLMDBG_FACILITY NLMDBG_MONITOR
20+
#define NSM_PROGRAM 100024
21+
#define NSM_VERSION 1
22+
23+
enum {
24+
NSMPROC_NULL,
25+
NSMPROC_STAT,
26+
NSMPROC_MON,
27+
NSMPROC_UNMON,
28+
NSMPROC_UNMON_ALL,
29+
NSMPROC_SIMU_CRASH,
30+
NSMPROC_NOTIFY,
31+
};
2032

2133
struct nsm_args {
2234
__be32 addr; /* remote address */
@@ -42,7 +54,7 @@ static struct rpc_program nsm_program;
4254
int nsm_local_state;
4355

4456
/*
45-
* Common procedure for SM_MON/SM_UNMON calls
57+
* Common procedure for NSMPROC_MON/NSMPROC_UNMON calls
4658
*/
4759
static int
4860
nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
@@ -111,7 +123,7 @@ int nsm_monitor(const struct nlm_host *host)
111123
*/
112124
nsm->sm_mon_name = nsm_use_hostnames ? nsm->sm_name : nsm->sm_addrbuf;
113125

114-
status = nsm_mon_unmon(nsm, SM_MON, &res);
126+
status = nsm_mon_unmon(nsm, NSMPROC_MON, &res);
115127
if (res.status != 0)
116128
status = -EIO;
117129
if (status < 0)
@@ -139,7 +151,7 @@ void nsm_unmonitor(const struct nlm_host *host)
139151
&& nsm->sm_monitored && !nsm->sm_sticky) {
140152
dprintk("lockd: nsm_unmonitor(%s)\n", nsm->sm_name);
141153

142-
status = nsm_mon_unmon(nsm, SM_UNMON, &res);
154+
status = nsm_mon_unmon(nsm, NSMPROC_UNMON, &res);
143155
if (res.status != 0)
144156
status = -EIO;
145157
if (status < 0)
@@ -167,7 +179,7 @@ nsm_create(void)
167179
.addrsize = sizeof(sin),
168180
.servername = "localhost",
169181
.program = &nsm_program,
170-
.version = SM_VERSION,
182+
.version = NSM_VERSION,
171183
.authflavor = RPC_AUTH_NULL,
172184
};
173185

@@ -201,7 +213,7 @@ static __be32 *xdr_encode_mon_name(__be32 *p, struct nsm_args *argp)
201213
/*
202214
* The "my_id" argument specifies the hostname and RPC procedure
203215
* 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"
205217
* has changed.
206218
*/
207219
static __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)
219231

220232
/*
221233
* 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.
223235
*/
224236
static __be32 *xdr_encode_mon_id(__be32 *p, struct nsm_args *argp)
225237
{
@@ -232,8 +244,8 @@ static __be32 *xdr_encode_mon_id(__be32 *p, struct nsm_args *argp)
232244

233245
/*
234246
* The "priv" argument may contain private information required
235-
* by the SM_MON call. This information will be supplied in the
236-
* SM_NOTIFY call.
247+
* by the NSMPROC_MON call. This information will be supplied in the
248+
* NLMPROC_SM_NOTIFY call.
237249
*
238250
* Linux provides the raw IP address of the monitored host,
239251
* left in network byte order.
@@ -300,22 +312,22 @@ xdr_decode_stat(struct rpc_rqst *rqstp, __be32 *p, struct nsm_res *resp)
300312
#define SM_unmonres_sz 1
301313

302314
static struct rpc_procinfo nsm_procedures[] = {
303-
[SM_MON] = {
304-
.p_proc = SM_MON,
315+
[NSMPROC_MON] = {
316+
.p_proc = NSMPROC_MON,
305317
.p_encode = (kxdrproc_t) xdr_encode_mon,
306318
.p_decode = (kxdrproc_t) xdr_decode_stat_res,
307319
.p_arglen = SM_mon_sz,
308320
.p_replen = SM_monres_sz,
309-
.p_statidx = SM_MON,
321+
.p_statidx = NSMPROC_MON,
310322
.p_name = "MONITOR",
311323
},
312-
[SM_UNMON] = {
313-
.p_proc = SM_UNMON,
324+
[NSMPROC_UNMON] = {
325+
.p_proc = NSMPROC_UNMON,
314326
.p_encode = (kxdrproc_t) xdr_encode_unmon,
315327
.p_decode = (kxdrproc_t) xdr_decode_stat,
316328
.p_arglen = SM_mon_id_sz,
317329
.p_replen = SM_unmonres_sz,
318-
.p_statidx = SM_UNMON,
330+
.p_statidx = NSMPROC_UNMON,
319331
.p_name = "UNMONITOR",
320332
},
321333
};
@@ -334,7 +346,7 @@ static struct rpc_stat nsm_stats;
334346

335347
static struct rpc_program nsm_program = {
336348
.name = "statd",
337-
.number = SM_PROGRAM,
349+
.number = NSM_PROGRAM,
338350
.nrvers = ARRAY_SIZE(nsm_version),
339351
.version = nsm_version,
340352
.stats = &nsm_stats

‎include/linux/lockd/sm_inter.h‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@
99
#ifndef LINUX_LOCKD_SM_INTER_H
1010
#define LINUX_LOCKD_SM_INTER_H
1111

12-
#define SM_PROGRAM 100024
13-
#define SM_VERSION 1
14-
#define SM_STAT 1
15-
#define SM_MON 2
16-
#define SM_UNMON 3
17-
#define SM_UNMON_ALL 4
18-
#define SM_SIMU_CRASH 5
19-
#define SM_NOTIFY 6
20-
2112
#define SM_MAXSTRLEN 1024
2213
#define SM_PRIV_SIZE 16
2314

0 commit comments

Comments
 (0)