* [PATCH net-next] tools: ynl-gen: use uapi header name for the header guard
@ 2023-10-03 22:57 Jakub Kicinski
2023-10-04 10:50 ` Przemek Kitszel
2023-10-06 10:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2023-10-03 22:57 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, Jakub Kicinski, Chuck Lever
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()
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tools: ynl-gen: use uapi header name for the header guard
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
2023-10-06 10:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Przemek Kitszel @ 2023-10-04 10:50 UTC (permalink / raw)
To: Jakub Kicinski, davem; +Cc: netdev, edumazet, pabeni, Chuck Lever
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tools: ynl-gen: use uapi header name for the header guard
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
@ 2023-10-06 10:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-06 10:40 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, chuck.lever
Hello:
This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Tue, 3 Oct 2023 15:57:35 -0700 you 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>
>
> [...]
Here is the summary with links:
- [net-next] tools: ynl-gen: use uapi header name for the header guard
https://git.kernel.org/netdev/net-next/c/71ce60d375f5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-06 10:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-10-06 10:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).