Linux NFS development
 help / color / mirror / Atom feed
From: cel@kernel.org
To: Neil Brown <neilb@suse.de>, Jeff Layton <jlayton@kernel.org>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: <linux-nfs@vger.kernel.org>, Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH 0/6] Continued work on xdrgen
Date: Sun, 29 Sep 2024 20:50:09 -0400	[thread overview]
Message-ID: <20240930005016.13374-1-cel@kernel.org> (raw)

From: Chuck Lever <chuck.lever@oracle.com>

This series (intended for v6.13) contains some clean-ups and new
features for the xdrgen tool.

The "Exit status should be zero ..." patch is needed so that "make"
co-operates properly with xdrgen. I've prototyped some Makefile
stanzas that can generate encoder and decoder functions to ensure
this is working correctly (to appear in a later series).

"enum" types are now generated as C typedefs, without the "enum"
classifier. This is to enable the same type name to be used to
represent either an enum (CPU-endian) or a __be32 (network-endian).

So, instead of generating, say, "enum nfsstat3 {};" xdrgen now
generates "nfsstat3" which can be either an enum or a __be32,
depending on a new pragma directive. The goal is to handle the
special case where the upper layer prefers to use __be32
discriminant values for XDR union types.

Comments are welcome.


Chuck Lever (6):
  xdrgen: Exit status should be zero on success
  xdrgen: Clean up type_specifier
  xdrgen: Rename "variable-length strings"
  xdrgen: Rename enum's declaration Jinja2 template
  xdrgen: Rename "enum yada" types as just "yada"
  xdrgen: Implement big-endian enums

 include/linux/sunrpc/xdr.h                    | 21 ++++++++++++
 tools/net/sunrpc/xdrgen/README                | 17 ++++++++++
 tools/net/sunrpc/xdrgen/generators/enum.py    | 19 ++++++++---
 tools/net/sunrpc/xdrgen/generators/pointer.py |  8 ++---
 tools/net/sunrpc/xdrgen/generators/struct.py  |  8 ++---
 tools/net/sunrpc/xdrgen/generators/typedef.py | 10 +++---
 tools/net/sunrpc/xdrgen/generators/union.py   | 34 ++++++++++++++-----
 tools/net/sunrpc/xdrgen/grammars/xdr.lark     |  6 ++--
 .../templates/C/enum/declaration/close.j2     |  4 ---
 .../templates/C/enum/declaration/enum.j2      |  4 +++
 .../xdrgen/templates/C/enum/decoder/enum.j2   |  2 +-
 .../{encoder/enum.j2 => decoder/enum_be.j2}   |  6 ++--
 .../templates/C/enum/definition/close.j2      |  1 +
 .../enum/definition/{close.j2 => close_be.j2} |  1 +
 .../xdrgen/templates/C/enum/encoder/enum.j2   |  2 +-
 .../C/enum/encoder/{enum.j2 => enum_be.j2}    |  6 ++--
 .../{variable_length_string.j2 => string.j2}  |  0
 .../{variable_length_string.j2 => string.j2}  |  0
 .../{variable_length_string.j2 => string.j2}  |  0
 .../{variable_length_string.j2 => string.j2}  |  0
 .../{variable_length_string.j2 => string.j2}  |  0
 .../{variable_length_string.j2 => string.j2}  |  0
 .../{variable_length_string.j2 => string.j2}  |  0
 .../{variable_length_string.j2 => string.j2}  |  0
 .../{variable_length_string.j2 => string.j2}  |  0
 .../{variable_length_string.j2 => string.j2}  |  0
 .../templates/C/union/decoder/case_spec_be.j2 |  2 ++
 .../{variable_length_string.j2 => string.j2}  |  0
 .../templates/C/union/encoder/case_spec_be.j2 |  2 ++
 tools/net/sunrpc/xdrgen/xdr_ast.py            | 21 ++++++------
 tools/net/sunrpc/xdrgen/xdrgen                |  4 ++-
 31 files changed, 125 insertions(+), 53 deletions(-)
 delete mode 100644 tools/net/sunrpc/xdrgen/templates/C/enum/declaration/close.j2
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/enum/declaration/enum.j2
 copy tools/net/sunrpc/xdrgen/templates/C/enum/{encoder/enum.j2 => decoder/enum_be.j2} (51%)
 copy tools/net/sunrpc/xdrgen/templates/C/enum/definition/{close.j2 => close_be.j2} (60%)
 copy tools/net/sunrpc/xdrgen/templates/C/enum/encoder/{enum.j2 => enum_be.j2} (50%)
 rename tools/net/sunrpc/xdrgen/templates/C/pointer/decoder/{variable_length_string.j2 => string.j2} (100%)
 rename tools/net/sunrpc/xdrgen/templates/C/pointer/definition/{variable_length_string.j2 => string.j2} (100%)
 rename tools/net/sunrpc/xdrgen/templates/C/pointer/encoder/{variable_length_string.j2 => string.j2} (100%)
 rename tools/net/sunrpc/xdrgen/templates/C/struct/decoder/{variable_length_string.j2 => string.j2} (100%)
 rename tools/net/sunrpc/xdrgen/templates/C/struct/definition/{variable_length_string.j2 => string.j2} (100%)
 rename tools/net/sunrpc/xdrgen/templates/C/struct/encoder/{variable_length_string.j2 => string.j2} (100%)
 rename tools/net/sunrpc/xdrgen/templates/C/typedef/declaration/{variable_length_string.j2 => string.j2} (100%)
 rename tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/{variable_length_string.j2 => string.j2} (100%)
 rename tools/net/sunrpc/xdrgen/templates/C/typedef/definition/{variable_length_string.j2 => string.j2} (100%)
 rename tools/net/sunrpc/xdrgen/templates/C/typedef/encoder/{variable_length_string.j2 => string.j2} (100%)
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/union/decoder/case_spec_be.j2
 rename tools/net/sunrpc/xdrgen/templates/C/union/decoder/{variable_length_string.j2 => string.j2} (100%)
 create mode 100644 tools/net/sunrpc/xdrgen/templates/C/union/encoder/case_spec_be.j2

-- 
2.46.2


             reply	other threads:[~2024-09-30  0:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30  0:50 cel [this message]
2024-09-30  0:50 ` [PATCH] NFSD: Remove unused function parameter cel
2024-09-30  0:50 ` [PATCH 1/6] xdrgen: Exit status should be zero on success cel
2024-09-30  0:50 ` [PATCH 2/6] xdrgen: Clean up type_specifier cel
2024-09-30  0:50 ` [PATCH 3/6] xdrgen: Rename "variable-length strings" cel
2024-09-30  0:50 ` [PATCH 4/6] xdrgen: Rename enum's declaration Jinja2 template cel
2024-09-30  0:50 ` [PATCH 5/6] xdrgen: Rename "enum yada" types as just "yada" cel
2024-09-30  0:50 ` [PATCH 6/6] xdrgen: Implement big-endian enums cel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240930005016.13374-1-cel@kernel.org \
    --to=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox