Commit 71ce60d3 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

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: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f739d755
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment