aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-03-14 14:26:08 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-03-19 18:01:10 -0400
commit0490a54a00c14212f22c5948c8c13a4553d745bd (patch)
treeeec4ea250a228c37c46255395724aa0c3390e838
parent2ca7754d4c96d68e1475690422a202ba5f0443d8 (diff)
lockd: introduce new function to encode private argument in SM_MON requests
Clean up: refactor the encoding of the opaque 16-byte private argument in xdr_encode_mon(). This will be updated later to support IPv6 addresses. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/lockd/mon.c30
-rw-r--r--include/linux/lockd/sm_inter.h1
2 files changed, 25 insertions, 6 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index f2507fec7c6f..e4d563543b11 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -218,6 +218,24 @@ static __be32 *xdr_encode_mon_id(__be32 *p, struct nsm_args *argp)
218 return xdr_encode_my_id(p, argp); 218 return xdr_encode_my_id(p, argp);
219} 219}
220 220
221/*
222 * The "priv" argument may contain private information required
223 * by the SM_MON call. This information will be supplied in the
224 * SM_NOTIFY call.
225 *
226 * Linux provides the raw IP address of the monitored host,
227 * left in network byte order.
228 */
229static __be32 *xdr_encode_priv(__be32 *p, struct nsm_args *argp)
230{
231 *p++ = argp->addr;
232 *p++ = 0;
233 *p++ = 0;
234 *p++ = 0;
235
236 return p;
237}
238
221static int 239static int
222xdr_encode_mon(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp) 240xdr_encode_mon(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
223{ 241{
@@ -225,11 +243,10 @@ xdr_encode_mon(struct rpc_rqst *rqstp, __be32 *p, struct nsm_args *argp)
225 if (IS_ERR(p)) 243 if (IS_ERR(p))
226 return PTR_ERR(p); 244 return PTR_ERR(p);
227 245
228 /* Surprise - there may even be room for an IPv6 address now */ 246 p = xdr_encode_priv(p, argp);
229 *p++ = argp->addr; 247 if (IS_ERR(p))
230 *p++ = 0; 248 return PTR_ERR(p);
231 *p++ = 0; 249
232 *p++ = 0;
233 rqstp->rq_slen = xdr_adjust_iovec(rqstp->rq_svec, p); 250 rqstp->rq_slen = xdr_adjust_iovec(rqstp->rq_svec, p);
234 return 0; 251 return 0;
235} 252}
@@ -265,7 +282,8 @@ xdr_decode_stat(struct rpc_rqst *rqstp, __be32 *p, struct nsm_res *resp)
265#define SM_my_id_sz (SM_my_name_sz+3) 282#define SM_my_id_sz (SM_my_name_sz+3)
266#define SM_mon_name_sz (1+XDR_QUADLEN(SM_MAXSTRLEN)) 283#define SM_mon_name_sz (1+XDR_QUADLEN(SM_MAXSTRLEN))
267#define SM_mon_id_sz (SM_mon_name_sz+SM_my_id_sz) 284#define SM_mon_id_sz (SM_mon_name_sz+SM_my_id_sz)
268#define SM_mon_sz (SM_mon_id_sz+4) 285#define SM_priv_sz (XDR_QUADLEN(SM_PRIV_SIZE))
286#define SM_mon_sz (SM_mon_id_sz+SM_priv_sz)
269#define SM_monres_sz 2 287#define SM_monres_sz 2
270#define SM_unmonres_sz 1 288#define SM_unmonres_sz 1
271 289
diff --git a/include/linux/lockd/sm_inter.h b/include/linux/lockd/sm_inter.h
index 22a645828f26..5a5448bdb17d 100644
--- a/include/linux/lockd/sm_inter.h
+++ b/include/linux/lockd/sm_inter.h
@@ -19,6 +19,7 @@
19#define SM_NOTIFY 6 19#define SM_NOTIFY 6
20 20
21#define SM_MAXSTRLEN 1024 21#define SM_MAXSTRLEN 1024
22#define SM_PRIV_SIZE 16
22 23
23/* 24/*
24 * Arguments for all calls to statd 25 * Arguments for all calls to statd