xdrgen: Fix struct prefix for typedef types in program wrappersThe program templates for decoder/argument.j2 and encoder/result.j2unconditionally add 'struct' prefix to all types. This is incorrec
xdrgen: Fix struct prefix for typedef types in program wrappersThe program templates for decoder/argument.j2 and encoder/result.j2unconditionally add 'struct' prefix to all types. This is incorrectwhen an RPC protocol specification lists a typedef'd basic type oran enum as a procedure argument or result (e.g., NFSv2's fhandle orstat), resulting in compiler errors when building generated C code.Fixes: 4b132aacb076 ("tools: Add xdrgen")Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
show more ...
tools: Add xdrgenAdd a Python-based tool for translating XDR specifications into XDRencoder and decoder functions written in the Linux kernel's C codingstyle. The generator attempts to match the
tools: Add xdrgenAdd a Python-based tool for translating XDR specifications into XDRencoder and decoder functions written in the Linux kernel's C codingstyle. The generator attempts to match the usual C coding style ofthe Linux kernel's SunRPC consumers.This approach is similar to the netlink code generator intools/net/ynl .The maintainability benefits of machine-generated XDR code include:- Stronger type checking- Reduces the number of bugs introduced by human error- Makes the XDR code easier to audit and analyze- Enables rapid prototyping of new RPC-based protocols- Hardens the layering between protocol logic and marshaling- Makes it easier to add observability on demand- Unit tests might be built for both the tool and (automatically) for the generated codeIn addition, converting the XDR layer to use memory-safe languagessuch as Rust will be easier if much of the code can be convertedautomatically.Tested-by: Jeff Layton <jlayton@kernel.org>Signed-off-by: Chuck Lever <chuck.lever@oracle.com>