diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2008-12-05 19:03:16 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-01-06 11:53:53 -0500 |
commit | 7e44d3bea21fbb9494930d1cd35ca92a9a4a3279 (patch) | |
tree | 377fe5801ab1108aee2bc7f72d1b32618aa35e7f /fs/lockd | |
parent | 05f3a9af58180d24a9decedd71d4587935782d70 (diff) |
NSM: Generate NSMPROC_MON's "priv" argument when nsm_handle is created
Introduce a new data type, used by both the in-kernel NLM and NSM
implementations, that is used to manage the opaque "priv" argument
for the NSMPROC_MON and NLMPROC_SM_NOTIFY calls.
Construct the "priv" cookie when the nsm_handle is created.
The nsm_init_private() function may look a little strange, but it is
roughly equivalent to how the XDR encoder formed the "priv" argument.
It's going to go away soon.
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.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index 0792900b6281..c8d18cd22b8a 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -201,6 +201,21 @@ void nsm_unmonitor(const struct nlm_host *host) | |||
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | /* | ||
205 | * Construct a unique cookie to match this nsm_handle to this monitored | ||
206 | * host. It is passed to the local rpc.statd via NSMPROC_MON, and | ||
207 | * returned via NLMPROC_SM_NOTIFY, in the "priv" field of these | ||
208 | * requests. | ||
209 | * | ||
210 | * Linux provides the raw IP address of the monitored host, | ||
211 | * left in network byte order. | ||
212 | */ | ||
213 | static void nsm_init_private(struct nsm_handle *nsm) | ||
214 | { | ||
215 | __be32 *p = (__be32 *)&nsm->sm_priv.data; | ||
216 | *p = nsm_addr_in(nsm)->sin_addr.s_addr; | ||
217 | } | ||
218 | |||
204 | /** | 219 | /** |
205 | * nsm_find - Find or create a cached nsm_handle | 220 | * nsm_find - Find or create a cached nsm_handle |
206 | * @sap: pointer to socket address of handle to find | 221 | * @sap: pointer to socket address of handle to find |
@@ -271,6 +286,7 @@ retry: | |||
271 | nsm->sm_name = (char *) (nsm + 1); | 286 | nsm->sm_name = (char *) (nsm + 1); |
272 | memcpy(nsm->sm_name, hostname, hostname_len); | 287 | memcpy(nsm->sm_name, hostname, hostname_len); |
273 | nsm->sm_name[hostname_len] = '\0'; | 288 | nsm->sm_name[hostname_len] = '\0'; |
289 | nsm_init_private(nsm); | ||
274 | nsm_display_address((struct sockaddr *)&nsm->sm_addr, | 290 | nsm_display_address((struct sockaddr *)&nsm->sm_addr, |
275 | nsm->sm_addrbuf, sizeof(nsm->sm_addrbuf)); | 291 | nsm->sm_addrbuf, sizeof(nsm->sm_addrbuf)); |
276 | atomic_set(&nsm->sm_count, 1); | 292 | atomic_set(&nsm->sm_count, 1); |