Skip to content

Commit

Permalink
ynl-gen-c.py: render netlink policies static for split ops
Browse files Browse the repository at this point in the history
When policies are rendered for split ops, they are consumed in the same
file. No need to expose them for user outside, make them static.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20230803111340.1074067-5-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jiri Pirko authored and Jakub Kicinski committed Aug 4, 2023
1 parent eab7be6 commit fa8ba35
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/net/ynl/ynl-gen-c.py
Original file line number Diff line number Diff line change
Expand Up @@ -1843,13 +1843,13 @@ def print_ntf_type_free(ri):


def print_req_policy_fwd(cw, struct, ri=None, terminate=True):
if terminate and ri and kernel_can_gen_family_struct(struct.family):
if terminate and ri and policy_should_be_static(struct.family):
return

if terminate:
prefix = 'extern '
else:
if kernel_can_gen_family_struct(struct.family) and ri:
if ri and policy_should_be_static(struct.family):
prefix = 'static '
else:
prefix = ''
Expand Down Expand Up @@ -1877,6 +1877,10 @@ def kernel_can_gen_family_struct(family):
return family.proto == 'genetlink'


def policy_should_be_static(family):
return family.kernel_policy == 'split' or kernel_can_gen_family_struct(family)


def print_kernel_op_table_fwd(family, cw, terminate):
exported = not kernel_can_gen_family_struct(family)

Expand Down

0 comments on commit fa8ba35

Please sign in to comment.