linux/tools/net/sunrpc/xdrgen/templates/C/program
Chuck Lever 4c53b89032 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>
2026-01-26 10:10:58 -05:00
..
declaration
decoder xdrgen: Fix struct prefix for typedef types in program wrappers 2026-01-26 10:10:58 -05:00
definition xdrgen: Emit the program number definition 2026-01-26 10:10:58 -05:00
encoder xdrgen: Fix struct prefix for typedef types in program wrappers 2026-01-26 10:10:58 -05:00
maxsize xdrgen: Emit a max_arg_sz macro 2026-01-26 10:10:58 -05:00