diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2011-05-09 15:22:34 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-05-27 17:42:47 -0400 |
commit | 61677eeec29e87edc03a1061ae0a04b92507450d (patch) | |
tree | a305e0359d5c2b3cd611f9989bf18f4202c48cb2 /net/sunrpc/xprtsock.c | |
parent | 26f04dde681c6a48b2bacfc5fe01fef204419b0c (diff) |
SUNRPC: Rename xs_encode_tcp_fragment_header()
Clean up: Use a more generic name for xs_encode_tcp_fragment_header();
it's appropriate to use for all stream transport types. We're about
to add new stream transport.
Also, move it to a place where it is more easily shared amongst the
various send_request methods. And finally, replace the "htonl" macro
invocation with its modern equivalent.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index f34f5ab341a3..079366974e1f 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -495,6 +495,16 @@ static int xs_nospace(struct rpc_task *task) | |||
495 | return ret; | 495 | return ret; |
496 | } | 496 | } |
497 | 497 | ||
498 | /* | ||
499 | * Construct a stream transport record marker in @buf. | ||
500 | */ | ||
501 | static inline void xs_encode_stream_record_marker(struct xdr_buf *buf) | ||
502 | { | ||
503 | u32 reclen = buf->len - sizeof(rpc_fraghdr); | ||
504 | rpc_fraghdr *base = buf->head[0].iov_base; | ||
505 | *base = cpu_to_be32(RPC_LAST_STREAM_FRAGMENT | reclen); | ||
506 | } | ||
507 | |||
498 | /** | 508 | /** |
499 | * xs_udp_send_request - write an RPC request to a UDP socket | 509 | * xs_udp_send_request - write an RPC request to a UDP socket |
500 | * @task: address of RPC task that manages the state of an RPC request | 510 | * @task: address of RPC task that manages the state of an RPC request |
@@ -574,13 +584,6 @@ static void xs_tcp_shutdown(struct rpc_xprt *xprt) | |||
574 | kernel_sock_shutdown(sock, SHUT_WR); | 584 | kernel_sock_shutdown(sock, SHUT_WR); |
575 | } | 585 | } |
576 | 586 | ||
577 | static inline void xs_encode_tcp_record_marker(struct xdr_buf *buf) | ||
578 | { | ||
579 | u32 reclen = buf->len - sizeof(rpc_fraghdr); | ||
580 | rpc_fraghdr *base = buf->head[0].iov_base; | ||
581 | *base = htonl(RPC_LAST_STREAM_FRAGMENT | reclen); | ||
582 | } | ||
583 | |||
584 | /** | 587 | /** |
585 | * xs_tcp_send_request - write an RPC request to a TCP socket | 588 | * xs_tcp_send_request - write an RPC request to a TCP socket |
586 | * @task: address of RPC task that manages the state of an RPC request | 589 | * @task: address of RPC task that manages the state of an RPC request |
@@ -603,7 +606,7 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
603 | struct xdr_buf *xdr = &req->rq_snd_buf; | 606 | struct xdr_buf *xdr = &req->rq_snd_buf; |
604 | int status; | 607 | int status; |
605 | 608 | ||
606 | xs_encode_tcp_record_marker(&req->rq_snd_buf); | 609 | xs_encode_stream_record_marker(&req->rq_snd_buf); |
607 | 610 | ||
608 | xs_pktdump("packet data:", | 611 | xs_pktdump("packet data:", |
609 | req->rq_svec->iov_base, | 612 | req->rq_svec->iov_base, |
@@ -2024,10 +2027,7 @@ static int bc_sendto(struct rpc_rqst *req) | |||
2024 | unsigned long headoff; | 2027 | unsigned long headoff; |
2025 | unsigned long tailoff; | 2028 | unsigned long tailoff; |
2026 | 2029 | ||
2027 | /* | 2030 | xs_encode_stream_record_marker(xbufp); |
2028 | * Set up the rpc header and record marker stuff | ||
2029 | */ | ||
2030 | xs_encode_tcp_record_marker(xbufp); | ||
2031 | 2031 | ||
2032 | tailoff = (unsigned long)xbufp->tail[0].iov_base & ~PAGE_MASK; | 2032 | tailoff = (unsigned long)xbufp->tail[0].iov_base & ~PAGE_MASK; |
2033 | headoff = (unsigned long)xbufp->head[0].iov_base & ~PAGE_MASK; | 2033 | headoff = (unsigned long)xbufp->head[0].iov_base & ~PAGE_MASK; |