Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 92903
b: refs/heads/master
c: 2ca7754
h: refs/heads/master
i:
  92901: d0e338b
  92899: ea9d186
  92895: 13179e3
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Mar 19, 2008
1 parent 42deea6 commit 8231efb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ea72a7f170e686baf00ceee57b6197bef686889c
refs/heads/master: 2ca7754d4c96d68e1475690422a202ba5f0443d8
39 changes: 8 additions & 31 deletions trunk/fs/lockd/mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ nsm_create(void)

/*
* XDR functions for NSM.
*
* See http://www.opengroup.org/ for details on the Network
* Status Monitor wire protocol.
*/

static __be32 *xdr_encode_nsm_string(__be32 *p, char *string)
Expand Down Expand Up @@ -215,37 +218,10 @@ static __be32 *xdr_encode_mon_id(__be32 *p, struct nsm_args *argp)
return xdr_encode_my_id(p, argp);
}

static __be32 *
xdr_encode_common(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
{
char buffer[20], *name;

/*
* Use the dotted-quad IP address of the remote host as
* identifier. Linux statd always looks up the canonical
* hostname first for whatever remote hostname it receives,
* so this works alright.
*/
if (nsm_use_hostnames) {
name = argp->mon_name;
} else {
sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->addr));
name = buffer;
}
if (!(p = xdr_encode_string(p, name))
|| !(p = xdr_encode_string(p, utsname()->nodename)))
return ERR_PTR(-EIO);
*p++ = htonl(argp->prog);
*p++ = htonl(argp->vers);
*p++ = htonl(argp->proc);

return p;
}

static int
xdr_encode_mon(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
{
p = xdr_encode_common(rqstp, p, argp);
p = xdr_encode_mon_id(p, argp);
if (IS_ERR(p))
return PTR_ERR(p);

Expand All @@ -261,7 +237,7 @@ xdr_encode_mon(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
static int
xdr_encode_unmon(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
{
p = xdr_encode_common(rqstp, p, argp);
p = xdr_encode_mon_id(p, argp);
if (IS_ERR(p))
return PTR_ERR(p);
rqstp->rq_slen = xdr_adjust_iovec(rqstp->rq_svec, p);
Expand All @@ -286,8 +262,9 @@ xdr_decode_stat(struct rpc_rqst *rqstp, __be32 *p, struct nsm_res *resp)
}

#define SM_my_name_sz (1+XDR_QUADLEN(SM_MAXSTRLEN))
#define SM_my_id_sz (3+1+SM_my_name_sz)
#define SM_mon_id_sz (1+XDR_QUADLEN(20)+SM_my_id_sz)
#define SM_my_id_sz (SM_my_name_sz+3)
#define SM_mon_name_sz (1+XDR_QUADLEN(SM_MAXSTRLEN))
#define SM_mon_id_sz (SM_mon_name_sz+SM_my_id_sz)
#define SM_mon_sz (SM_mon_id_sz+4)
#define SM_monres_sz 2
#define SM_unmonres_sz 1
Expand Down

0 comments on commit 8231efb

Please sign in to comment.