From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Jakub Kicinski <kuba@kernel.org>, <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <edumazet@google.com>,
<pabeni@redhat.com>, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH net-next] tools: ynl-gen: use uapi header name for the header guard
Date: Wed, 4 Oct 2023 12:50:42 +0200 [thread overview]
Message-ID: <07c52946-fac0-4e32-bd9d-883d05997f93@intel.com> (raw)
In-Reply-To: <20231003225735.2659459-1-kuba@kernel.org>
On 10/4/23 00:57, Jakub Kicinski wrote:
> Chuck points out that we should use the uapi-header property
> when generating the guard. Otherwise we may generate the same
> guard as another file in the tree.
>
> Tested-by: Chuck Lever <chuck.lever@oracle.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> tools/net/ynl/ynl-gen-c.py | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
> index 897af958cee8..168fe612b029 100755
> --- a/tools/net/ynl/ynl-gen-c.py
> +++ b/tools/net/ynl/ynl-gen-c.py
> @@ -805,6 +805,10 @@ from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnumSet, S
> self.uapi_header = self.yaml['uapi-header']
> else:
> self.uapi_header = f"linux/{self.name}.h"
> + if self.uapi_header.startswith("linux/") and self.uapi_header.endswith('.h'):
> + self.uapi_header_name = self.uapi_header[6:-2]
> + else:
> + self.uapi_header_name = self.name
>
> def resolve(self):
> self.resolve_up(super())
> @@ -2124,7 +2128,7 @@ _C_KW = {
>
>
> def render_uapi(family, cw):
> - hdr_prot = f"_UAPI_LINUX_{family.name.upper()}_H"
> + hdr_prot = f"_UAPI_LINUX_{c_upper(family.uapi_header_name)}_H"
> cw.p('#ifndef ' + hdr_prot)
> cw.p('#define ' + hdr_prot)
> cw.nl()
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
next prev parent reply other threads:[~2023-10-04 10:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 22:57 [PATCH net-next] tools: ynl-gen: use uapi header name for the header guard Jakub Kicinski
2023-10-04 10:50 ` Przemek Kitszel [this message]
2023-10-06 10:40 ` patchwork-bot+netdevbpf
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=07c52946-fac0-4e32-bd9d-883d05997f93@intel.com \
--to=przemyslaw.kitszel@intel.com \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.