mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
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>
This commit is contained in:
parent
f739d75552
commit
71ce60d375
@ -805,6 +805,10 @@ class Family(SpecFamily):
|
|||||||
self.uapi_header = self.yaml['uapi-header']
|
self.uapi_header = self.yaml['uapi-header']
|
||||||
else:
|
else:
|
||||||
self.uapi_header = f"linux/{self.name}.h"
|
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):
|
def resolve(self):
|
||||||
self.resolve_up(super())
|
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):
|
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('#ifndef ' + hdr_prot)
|
||||||
cw.p('#define ' + hdr_prot)
|
cw.p('#define ' + hdr_prot)
|
||||||
cw.nl()
|
cw.nl()
|
||||||
|
Loading…
Reference in New Issue
Block a user