@@ -104,6 +104,19 @@ enum rpc_auth_stat {
#define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT)
#define RPC_MAX_FRAGMENT_SIZE ((1U << 31) - 1)
+/**
+ * rpc_stream_record_marker - Construct a 4-octet stream record marker
+ * @size: number of octets in the RPC message to send
+ *
+ * Returns the stream record marker field for a record of length < 2^31-1
+ */
+static inline rpc_fraghdr rpc_stream_record_marker(u32 size)
+{
+ if (!size)
+ return 0;
+ return cpu_to_be32(RPC_LAST_STREAM_FRAGMENT | size);
+}
+
/*
* RPC call and reply header size as number of 32bit words (verifier
* size computed separately, see below)
@@ -11,7 +11,6 @@
#define _LINUX_SUNRPC_SVCAUTH_H_
#include <linux/string.h>
-#include <linux/sunrpc/msg_prot.h>
#include <linux/sunrpc/cache.h>
#include <linux/sunrpc/gss_api.h>
#include <linux/hash.h>
@@ -929,17 +929,6 @@ static int xs_nospace(struct rpc_rqst *req)
return transport->xmit.offset != 0 && req->rq_bytes_sent == 0;
}
-/*
- * Return the stream record marker field for a record of length < 2^31-1
- */
-static rpc_fraghdr
-xs_stream_record_marker(struct xdr_buf *xdr)
-{
- if (!xdr->len)
- return 0;
- return cpu_to_be32(RPC_LAST_STREAM_FRAGMENT | (u32)xdr->len);
-}
-
/**
* xs_local_send_request - write an RPC request to an AF_LOCAL socket
* @req: pointer to RPC request
@@ -957,7 +946,7 @@ static int xs_local_send_request(struct rpc_rqst *req)
struct sock_xprt *transport =
container_of(xprt, struct sock_xprt, xprt);
struct xdr_buf *xdr = &req->rq_snd_buf;
- rpc_fraghdr rm = xs_stream_record_marker(xdr);
+ rpc_fraghdr rm = rpc_stream_record_marker(xdr->len);
unsigned int msglen = rm ? req->rq_slen + sizeof(rm) : req->rq_slen;
int status;
int sent = 0;
@@ -1104,7 +1093,7 @@ static int xs_tcp_send_request(struct rpc_rqst *req)
struct rpc_xprt *xprt = req->rq_xprt;
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
struct xdr_buf *xdr = &req->rq_snd_buf;
- rpc_fraghdr rm = xs_stream_record_marker(xdr);
+ rpc_fraghdr rm = rpc_stream_record_marker(xdr->len);
unsigned int msglen = rm ? req->rq_slen + sizeof(rm) : req->rq_slen;
bool vm_wait = false;
int status;
@@ -2652,8 +2641,7 @@ static int bc_sendto(struct rpc_rqst *req)
struct msghdr msg = {
.msg_flags = MSG_MORE
};
- rpc_fraghdr marker = cpu_to_be32(RPC_LAST_STREAM_FRAGMENT |
- (u32)xbufp->len);
+ rpc_fraghdr marker = rpc_stream_record_marker(xbufp->len);
struct kvec iov = {
.iov_base = &marker,
.iov_len = sizeof(marker),
Refactor: Allow the client and server to share this helper function. msg_prot.h now needs linux/kernel.h for cpu_to_be32. #include <msg_prot.h> is removed anywhere it is not required and causes a compilation failure due to the new header dependency. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- include/linux/sunrpc/msg_prot.h | 13 +++++++++++++ include/linux/sunrpc/svcauth.h | 1 - net/sunrpc/xprtsock.c | 18 +++--------------- 3 files changed, 16 insertions(+), 16 deletions(-)