diff options
author | Tom Tucker <tom@opengridcomputing.com> | 2007-12-30 21:07:29 -0600 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2008-02-01 16:42:08 -0500 |
commit | e831fe65b10199e1e301a7316c66d6ced133712d (patch) | |
tree | 33436ef94e099e854c4824e78cd62f341e5f357a /net/sunrpc | |
parent | 755cceaba7555027e61dfa79f1e55bdfc6906633 (diff) | |
download | op-kernel-dev-e831fe65b10199e1e301a7316c66d6ced133712d.zip op-kernel-dev-e831fe65b10199e1e301a7316c66d6ced133712d.tar.gz |
svc: Add xpo_prep_reply_hdr
Some transports add fields to the RPC header for replies, e.g. the TCP
record length. This function is called when preparing the reply header
to allow each transport to add whatever fields it requires.
Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Acked-by: Neil Brown <neilb@suse.de>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Greg Banks <gnb@sgi.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/svc.c | 6 | ||||
-rw-r--r-- | net/sunrpc/svcsock.c | 17 |
2 files changed, 20 insertions, 3 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 94eed9b..8281a04 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -840,9 +840,9 @@ svc_process(struct svc_rqst *rqstp) rqstp->rq_res.tail[0].iov_len = 0; /* Will be turned off only in gss privacy case: */ rqstp->rq_splice_ok = 1; - /* tcp needs a space for the record length... */ - if (rqstp->rq_prot == IPPROTO_TCP) - svc_putnl(resv, 0); + + /* Setup reply header */ + rqstp->rq_xprt->xpt_ops->xpo_prep_reply_hdr(rqstp); rqstp->rq_xid = svc_getu32(argv); svc_putu32(resv, rqstp->rq_xid); diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 44a729d..492a1dc 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -893,12 +893,17 @@ svc_udp_sendto(struct svc_rqst *rqstp) return error; } +static void svc_udp_prep_reply_hdr(struct svc_rqst *rqstp) +{ +} + static struct svc_xprt_ops svc_udp_ops = { .xpo_recvfrom = svc_udp_recvfrom, .xpo_sendto = svc_udp_sendto, .xpo_release_rqst = svc_release_skb, .xpo_detach = svc_sock_detach, .xpo_free = svc_sock_free, + .xpo_prep_reply_hdr = svc_udp_prep_reply_hdr, }; static struct svc_xprt_class svc_udp_class = { @@ -1350,12 +1355,24 @@ svc_tcp_sendto(struct svc_rqst *rqstp) return sent; } +/* + * Setup response header. TCP has a 4B record length field. + */ +static void svc_tcp_prep_reply_hdr(struct svc_rqst *rqstp) +{ + struct kvec *resv = &rqstp->rq_res.head[0]; + + /* tcp needs a space for the record length... */ + svc_putnl(resv, 0); +} + static struct svc_xprt_ops svc_tcp_ops = { .xpo_recvfrom = svc_tcp_recvfrom, .xpo_sendto = svc_tcp_sendto, .xpo_release_rqst = svc_release_skb, .xpo_detach = svc_sock_detach, .xpo_free = svc_sock_free, + .xpo_prep_reply_hdr = svc_tcp_prep_reply_hdr, }; static struct svc_xprt_class svc_tcp_class = { |