]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
xdrgen: Emit a max_arg_sz macro
authorChuck Lever <chuck.lever@oracle.com>
Fri, 26 Dec 2025 15:19:34 +0000 (10:19 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 26 Jan 2026 15:10:58 +0000 (10:10 -0500)
commit4c53b89032f14577e94d747a3ca0aee63f18d856
treec7e56e251d535293f51982363ceb723753367249
parent63a5425ff5e077c54eb2719c735108e2aa1f9eb6
xdrgen: Emit a max_arg_sz macro

struct svc_service has a .vs_xdrsize field that is filled in by
servers for each of their RPC programs. This field is supposed to
contain the size of the largest procedure argument in the RPC
program. This value is also sometimes used to size network
transport buffers.

Currently, server implementations must manually calculate and
hard-code this value, which is error-prone and requires updates
when procedure arguments change.

Update xdrgen to determine which procedure argument structure is
largest, and emit a macro with a well-known name that contains
the size of that structure. Server code then uses this macro when
initializing the .vs_xdrsize field.

For NLM version 4, xdrgen now emits:

    #define NLM4_MAX_ARGS_SZ (NLM4_nlm4_lockargs_sz)

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
tools/net/sunrpc/xdrgen/generators/program.py
tools/net/sunrpc/xdrgen/subcmds/definitions.py
tools/net/sunrpc/xdrgen/templates/C/program/maxsize/max_args.j2 [new file with mode: 0644]