diff options
author | Jakub Kicinski <kuba@kernel.org> | 2023-10-04 01:57:35 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-10-06 13:35:36 +0300 |
commit | 71ce60d375f5be15ef6db19aa63ebd2d72f1457c (patch) | |
tree | 7aac52d00c242bad1ee3e72af4193dd2503983f4 /tools/net/ynl/ynl-gen-c.py | |
parent | f739d7555212a945361a54659cdea937219dd8c5 (diff) | |
download | linux-71ce60d375f5be15ef6db19aa63ebd2d72f1457c.tar.xz |
tools: ynl-gen: use uapi header name for the header guard
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>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/net/ynl/ynl-gen-c.py')
-rwxr-xr-x | tools/net/ynl/ynl-gen-c.py | 6 |
1 files changed, 5 insertions, 1 deletions
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 @@ class Family(SpecFamily): 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 @@ def uapi_enum_start(family, cw, obj, ckey='', enum_name='enum-name'): 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() |