mbox series

[v2,00/16] xdrgen: Emit maxsize macros

Message ID 20241003185446.82984-1-cel@kernel.org (mailing list archive)
Headers show
Series xdrgen: Emit maxsize macros | expand

Message

Chuck Lever Oct. 3, 2024, 6:54 p.m. UTC
From: Chuck Lever <chuck.lever@oracle.com>

This series implements the generation of "maxsize" values for each
XDR data type defined in a specification. These are emitted as C
pre-processor macros, following the lead of existing XDR functions
in the kernel. The macros are added to the header file containing
C type definitions.

This facility takes xdrgen a step closer to the generation of all
XDR code needed for each RPC protocol implementation in the kernel.

Changes since v1:
- Resend including all 16 patches (d'oh)

Chuck Lever (16):
  xdrgen: Refactor transformer arms
  xdrgen: Track constant values
  xdrgen: Keep track of on-the-wire data type widths
  xdrgen: XDR widths for enum types
  xdrgen: XDR width for fixed-length opaque
  xdrgen: XDR width for variable-length opaque
  xdrgen: XDR width for a string
  xdrgen: XDR width for fixed-length array
  xdrgen: XDR width for variable-length array
  xdrgen: XDR width for optional_data type
  xdrgen: XDR width for typedef
  xdrgen: XDR width for struct types
  xdrgen: XDR width for pointer types
  xdrgen: XDR width for union types
  xdrgen: Add generator code for XDR width macros
  xdrgen: emit maxsize macros

 include/linux/sunrpc/xdrgen/_defs.h           |   9 +
 .../net/sunrpc/xdrgen/generators/__init__.py  |   4 +
 tools/net/sunrpc/xdrgen/generators/enum.py    |  13 +-
 tools/net/sunrpc/xdrgen/generators/pointer.py |  18 +-
 tools/net/sunrpc/xdrgen/generators/struct.py  |  18 +-
 tools/net/sunrpc/xdrgen/generators/typedef.py |  18 +-
 tools/net/sunrpc/xdrgen/generators/union.py   |  20 +-
 .../net/sunrpc/xdrgen/subcmds/definitions.py  |  24 +-
 tools/net/sunrpc/xdrgen/subcmds/source.py     |   3 +-
 .../xdrgen/templates/C/enum/maxsize/enum.j2   |   2 +
 .../templates/C/pointer/maxsize/pointer.j2    |   3 +
 .../templates/C/struct/maxsize/struct.j2      |   3 +
 .../templates/C/typedef/maxsize/basic.j2      |   3 +
 .../C/typedef/maxsize/fixed_length_opaque.j2  |   2 +
 .../templates/C/typedef/maxsize/string.j2     |   2 +
 .../typedef/maxsize/variable_length_array.j2  |   2 +
 .../typedef/maxsize/variable_length_opaque.j2 |   2 +
 .../xdrgen/templates/C/union/maxsize/union.j2 |   3 +
 tools/net/sunrpc/xdrgen/xdr_ast.py            | 292 ++++++++++++++++--
 19 files changed, 406 insertions(+), 35 deletions(-)
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/enum/maxsize/enum.j2
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/pointer/maxsize/pointer.j2
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/struct/maxsize/struct.j2
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/typedef/maxsize/basic.j2
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/typedef/maxsize/fixed_length_opaque.j2
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/typedef/maxsize/string.j2
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/typedef/maxsize/variable_length_array.j2
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/typedef/maxsize/variable_length_opaque.j2
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/union/maxsize/union.j2