diff options
| author | Chuck Lever <cel@kernel.org> | 2026-09-08 09:42:25 -0400 |
|---|---|---|
| committer | Chuck Lever <cel@kernel.org> | 2026-10-04 21:15:29 -0400 |
| commit | de7c581708a749f037f8a620ed04b0d03e1ac75f (patch) | |
| tree | a43c90ae1fc39d2ff4df8708cd9c5ee93ebf264e /include | |
| parent | e7a8721b7edb54a157623f9e31d71345333b5fb9 (diff) | |
SUNRPC: Carry a generated-codec context pointer in struct xdr_stream
A generated XDR codec function receives only an xdr_stream, yet
some codecs need state that the stream does not carry. Passing
that state as an additional argument changes the signature of
every function on the path from the program entry point down to
the one that consumes it, and for generated code it makes each
function's argument list depend on an analysis of the entire
specification.
Add xdrgen_ctx to struct xdr_stream, a pointer that the layer
initializing the stream sets aside for generated codecs to find,
following the precedent of seq_file->private and
netlink_callback->data. Every xdr_stream initializer clears it, so
a codec never reads a residual value left in a stream that was
allocated on the stack or taken from a transport's free pool.
Acked-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Link: https://patch.msgid.link/20260908134234.512312-2-cel@kernel.org
Signed-off-by: Chuck Lever <cel@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/sunrpc/svc.h | 1 | ||||
| -rw-r--r-- | include/linux/sunrpc/xdr.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 5fa9417e034d..b80161b849ce 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -567,6 +567,7 @@ static inline void svcxdr_init_encode(struct svc_rqst *rqstp) xdr->page_ptr = buf->pages - 1; buf->buflen = PAGE_SIZE * (rqstp->rq_page_end - buf->pages); xdr->rqst = NULL; + xdr->xdrgen_ctx = NULL; } /** diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index b102b4f21e6b..2b33fc64be17 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -244,6 +244,7 @@ struct xdr_stream { unsigned int nwords; /* Remaining decode buffer length */ struct rpc_rqst *rqst; /* For debugging */ + void *xdrgen_ctx; /* Context for generated codecs */ }; /* |
