diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-06-21 17:14:46 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-06-28 17:20:44 -0400 |
commit | 4517d526c8aa31b5c14165ef180cc19518ff0a35 (patch) | |
tree | 51201ff494ab5615034046a093e242795af794bb /net/sunrpc | |
parent | 64bd577ea0021f5903505de061b3b7d8a785ee94 (diff) |
SUNRPC: Add the helper xdr_stream_pos
Add a helper to report the current offset from the start of the
xdr_stream.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/xdr.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 80d518644cf8..95980a5cd0a8 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c | |||
@@ -455,6 +455,16 @@ xdr_shift_buf(struct xdr_buf *buf, size_t len) | |||
455 | EXPORT_SYMBOL_GPL(xdr_shift_buf); | 455 | EXPORT_SYMBOL_GPL(xdr_shift_buf); |
456 | 456 | ||
457 | /** | 457 | /** |
458 | * xdr_stream_pos - Return the current offset from the start of the xdr_stream | ||
459 | * @xdr: pointer to struct xdr_stream | ||
460 | */ | ||
461 | unsigned int xdr_stream_pos(const struct xdr_stream *xdr) | ||
462 | { | ||
463 | return (unsigned int)(XDR_QUADLEN(xdr->buf->len) - xdr->nwords) << 2; | ||
464 | } | ||
465 | EXPORT_SYMBOL_GPL(xdr_stream_pos); | ||
466 | |||
467 | /** | ||
458 | * xdr_init_encode - Initialize a struct xdr_stream for sending data. | 468 | * xdr_init_encode - Initialize a struct xdr_stream for sending data. |
459 | * @xdr: pointer to xdr_stream struct | 469 | * @xdr: pointer to xdr_stream struct |
460 | * @buf: pointer to XDR buffer in which to encode data | 470 | * @buf: pointer to XDR buffer in which to encode data |