Commit 850c95fd07b63704d06909c9a081c51272d32db1

Authored by Chuck Lever
Committed by Trond Myklebust
1 parent 4969517431

lockd: refactor SM_MON my_id argument encoder

Clean up: introduce a new XDR encoder specifically for the my_id
argument of SM_MON requests.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 1 changed file with 19 additions and 0 deletions Side-by-side Diff

... ... @@ -183,6 +183,25 @@
183 183 return xdr_encode_nsm_string(p, name);
184 184 }
185 185  
  186 +/*
  187 + * The "my_id" argument specifies the hostname and RPC procedure
  188 + * to be called when the status manager receives notification
  189 + * (via the SM_NOTIFY call) that the state of host "mon_name"
  190 + * has changed.
  191 + */
  192 +static __be32 *xdr_encode_my_id(__be32 *p, struct nsm_args *argp)
  193 +{
  194 + p = xdr_encode_nsm_string(p, utsname()->nodename);
  195 + if (!p)
  196 + return ERR_PTR(-EIO);
  197 +
  198 + *p++ = htonl(argp->prog);
  199 + *p++ = htonl(argp->vers);
  200 + *p++ = htonl(argp->proc);
  201 +
  202 + return p;
  203 +}
  204 +
186 205 static __be32 *
187 206 xdr_encode_common(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
188 207 {