Lines Matching full:family

45     def __init__(self, family, attr_set, attr, value):  argument
46 super().__init__(family, attr_set, attr, value)
61 if self.nested_attrs == family.name:
62 self.nested_render_name = c_lower(f"{family.ident_name}")
64 self.nested_render_name = c_lower(f"{family.ident_name}_{self.nested_attrs}")
66 if self.nested_attrs in self.family.consts:
83 elif value in self.family.consts:
84 return c_upper(f"{self.family['name']}-{value}")
297 def __init__(self, family, attr_set, attr, value): argument
298 super().__init__(family, attr_set, attr, value)
305 enum = self.family.consts[self.attr['enum']]
337 self.is_bitfield = self.family.consts[self.attr['enum']]['type'] == 'flags'
342 self.type_name = self.family.consts[self.attr['enum']].user_type
351 enum = self.family.consts[self.attr['enum']]
354 flags = self.family.consts[self.checks['flags-mask']]
509 enum = self.family.consts[self.attr['enum']]
526 return self.family.pure_nested_structs[self.nested_attrs].recursive
559 for _, attr in ri.family.pure_nested_structs[self.nested_attrs].member_list():
566 def __init__(self, family, attr_set, attr, value, base_type): argument
567 super().__init__(family, attr_set, attr, value)
686 def __init__(self, family, space_name, type_list=None, inherited=None): argument
687 self.family = family
689 self.attr_set = family.attr_sets[space_name]
695 if family.name == c_lower(space_name):
696 self.render_name = c_lower(family.ident_name)
698 self.render_name = c_lower(family.ident_name + '-' + space_name)
700 if self.nested and space_name in family.consts:
763 def __init__(self, family, yaml): argument
764 self.render_name = c_lower(family.ident_name + '-' + yaml['name'])
780 self.value_pfx = yaml.get('name-prefix', f"{family.ident_name}-{yaml['name']}-")
782 super().__init__(family, yaml)
798 def __init__(self, family, yaml): argument
799 super().__init__(family, yaml)
804 elif self.name == family.name:
805 pfx = family.ident_name + '-a-'
807 pfx = f"{family.ident_name}-a-{self.name}-"
812 self.name_prefix = family.attr_sets[self.subset_of].name_prefix
813 self.max_name = family.attr_sets[self.subset_of].max_name
814 self.cnt_name = family.attr_sets[self.subset_of].cnt_name
824 if self.c_name == self.family.c_name:
829 t = TypeScalar(self.family, self, elem, value)
831 t = TypeUnused(self.family, self, elem, value)
833 t = TypePad(self.family, self, elem, value)
835 t = TypeFlag(self.family, self, elem, value)
837 t = TypeString(self.family, self, elem, value)
839 t = TypeBinary(self.family, self, elem, value)
841 t = TypeBitfield32(self.family, self, elem, value)
843 t = TypeNest(self.family, self, elem, value)
846 t = TypeArrayNest(self.family, self, elem, value)
850 t = TypeNestTypeValue(self.family, self, elem, value)
855 t = TypeMultiAttr(self.family, self, elem, value, t)
861 def __init__(self, family, yaml, req_value, rsp_value): argument
862 super().__init__(family, yaml, req_value, rsp_value)
864 self.render_name = c_lower(family.ident_name + '_' + self.name)
879 self.enum_name = self.family.op_prefix + c_upper(self.name)
881 self.enum_name = self.family.async_op_prefix + c_upper(self.name)
887 class Family(SpecFamily): class
905 self.fam_key = c_upper(self.yaml.get('c-family-name', self.yaml["name"] + '_FAMILY_NAME'))
1151 def __init__(self, cw, family, ku_space, op, op_mode, attr_set=None): argument
1152 self.family = family
1182 if attr_set in family.consts:
1195 self.struct[op_dir] = Struct(family, self.attr_set, type_list=type_list)
1197 … self.struct['reply'] = Struct(family, self.attr_set, type_list=op['event']['attributes'])
1476 return f"{ri.family.c_name}{suffix}"
1545 def put_op_name_fwd(family, cw): argument
1546 cw.write_func_prot('const char *', f'{family.c_name}_op_str', ['int op'], suffix=';')
1549 def put_op_name(family, cw): argument
1550 map_name = f'{family.c_name}_op_strmap'
1552 for op_name, op in family.msgs.items():
1556 if family.rsp_by_value[op.rsp_value] != op:
1567 _put_enum_to_str_helper(cw, family.c_name + '_op', map_name, 'op')
1570 def put_enum_to_str_fwd(family, cw, enum): argument
1575 def put_enum_to_str(family, cw, enum): argument
1619 iter_line = "ynl_attr_for_each(attr, nlh, yarg->ys->family->hdr_len)"
1922 ri.cw.block_start(line=f"struct {ri.family.c_name}{suffix}")
2019 ri.cw.p('__u16 family;')
2101 if terminate and ri and policy_should_be_static(struct.family):
2107 if ri and policy_should_be_static(struct.family):
2135 def kernel_can_gen_family_struct(family): argument
2136 return family.proto == 'genetlink'
2139 def policy_should_be_static(family): argument
2140 return family.kernel_policy == 'split' or kernel_can_gen_family_struct(family)
2143 def print_kernel_policy_ranges(family, cw): argument
2145 for _, attr_set in family.attr_sets.items():
2172 def print_kernel_op_table_fwd(family, cw, terminate): argument
2173 exported = not kernel_can_gen_family_struct(family)
2176 cw.p(f"/* Ops table for {family.ident_name} */")
2181 struct_type = pol_to_struct[family.kernel_policy]
2185 elif family.kernel_policy == 'split':
2187 for op in family.ops.values():
2193 cnt = len(family.ops)
2196 line = f"{qual} struct {struct_type} {family.c_name}_nl_ops[{cnt}]"
2206 for name in family.hooks['pre']['do']['list']:
2210 for name in family.hooks['post']['do']['list']:
2214 for name in family.hooks['pre']['dump']['list']:
2217 for name in family.hooks['post']['dump']['list']:
2223 for op_name, op in family.ops.items():
2228 name = c_lower(f"{family.ident_name}-nl-{op_name}-doit")
2233 name = c_lower(f"{family.ident_name}-nl-{op_name}-dumpit")
2239 def print_kernel_op_table_hdr(family, cw): argument
2240 print_kernel_op_table_fwd(family, cw, terminate=True)
2243 def print_kernel_op_table(family, cw): argument
2244 print_kernel_op_table_fwd(family, cw, terminate=False)
2245 if family.kernel_policy == 'global' or family.kernel_policy == 'per-op':
2246 for op_name, op in family.ops.items():
2259 name = c_lower(f"{family.ident_name}-nl-{op_name}-{op_mode}it")
2261 if family.kernel_policy == 'per-op':
2262 struct = Struct(family, op['attribute-set'],
2265 name = c_lower(f"{family.ident_name}-{op_name}-nl-policy")
2272 elif family.kernel_policy == 'split':
2276 for op_name, op in family.ops.items():
2297 name = c_lower(f"{family.ident_name}-nl-{op_name}-{op_mode}it")
2304 struct = Struct(family, op['attribute-set'],
2308 name = c_lower(f"{family.ident_name}-{op_name}-{op_mode}-nl-policy")
2310 name = c_lower(f"{family.ident_name}-{op_name}-nl-policy")
2323 def print_kernel_mcgrp_hdr(family, cw): argument
2324 if not family.mcgrps['list']:
2328 for grp in family.mcgrps['list']:
2329 grp_id = c_upper(f"{family.ident_name}-nlgrp-{grp['name']},")
2335 def print_kernel_mcgrp_src(family, cw): argument
2336 if not family.mcgrps['list']:
2339 cw.block_start('static const struct genl_multicast_group ' + family.c_name + '_nl_mcgrps[] =')
2340 for grp in family.mcgrps['list']:
2342 grp_id = c_upper(f"{family.ident_name}-nlgrp-{name}")
2348 def print_kernel_family_struct_hdr(family, cw): argument
2349 if not kernel_can_gen_family_struct(family):
2352 cw.p(f"extern struct genl_family {family.c_name}_nl_family;")
2354 if 'sock-priv' in family.kernel_family:
2355 cw.p(f'void {family.c_name}_nl_sock_priv_init({family.kernel_family["sock-priv"]} *priv);')
2356 … cw.p(f'void {family.c_name}_nl_sock_priv_destroy({family.kernel_family["sock-priv"]} *priv);')
2360 def print_kernel_family_struct_src(family, cw): argument
2361 if not kernel_can_gen_family_struct(family):
2364 cw.block_start(f"struct genl_family {family.ident_name}_nl_family __ro_after_init =")
2365 cw.p('.name\t\t= ' + family.fam_key + ',')
2366 cw.p('.version\t= ' + family.ver_key + ',')
2370 if family.kernel_policy == 'per-op':
2371 cw.p(f'.ops\t\t= {family.c_name}_nl_ops,')
2372 cw.p(f'.n_ops\t\t= ARRAY_SIZE({family.c_name}_nl_ops),')
2373 elif family.kernel_policy == 'split':
2374 cw.p(f'.split_ops\t= {family.c_name}_nl_ops,')
2375 cw.p(f'.n_split_ops\t= ARRAY_SIZE({family.c_name}_nl_ops),')
2376 if family.mcgrps['list']:
2377 cw.p(f'.mcgrps\t\t= {family.c_name}_nl_mcgrps,')
2378 cw.p(f'.n_mcgrps\t= ARRAY_SIZE({family.c_name}_nl_mcgrps),')
2379 if 'sock-priv' in family.kernel_family:
2380 cw.p(f'.sock_priv_size\t= sizeof({family.kernel_family["sock-priv"]}),')
2382 cw.p(f'.sock_priv_init\t= (void *){family.c_name}_nl_sock_priv_init,')
2383 cw.p(f'.sock_priv_destroy = (void *){family.c_name}_nl_sock_priv_destroy,')
2387 def uapi_enum_start(family, cw, obj, ckey='', enum_name='enum-name'): argument
2393 start_line = 'enum ' + family.c_name + '_' + c_lower(obj[ckey])
2397 def render_uapi(family, cw): argument
2398 hdr_prot = f"_UAPI_LINUX_{c_upper(family.uapi_header_name)}_H"
2403 defines = [(family.fam_key, family["name"]),
2404 (family.ver_key, family.get('version', 1))]
2409 for const in family['definitions']:
2417 enum = family.consts[const['name']]
2431 uapi_enum_start(family, cw, const, 'name')
2432 name_pfx = const.get('name-prefix', f"{family.ident_name}-{const['name']}-")
2453 defines.append([c_upper(family.get('c-define-name',
2454 f"{family.ident_name}-{const['name']}")),
2461 max_by_define = family.get('max-by-define', False)
2463 for _, attr_set in family.attr_sets.items():
2470 uapi_enum_start(family, cw, attr_set.yaml, 'enum-name')
2488 separate_ntf = 'async-prefix' in family['operations']
2490 max_name = c_upper(family.get('cmd-max-name', f"{family.op_prefix}MAX"))
2491 cnt_name = c_upper(family.get('cmd-cnt-name', f"__{family.op_prefix}MAX"))
2494 uapi_enum_start(family, cw, family['operations'], 'enum-name')
2496 for op in family.msgs.values():
2516 uapi_enum_start(family, cw, family['operations'], enum_name='async-enum')
2517 for op in family.msgs.values():
2530 for grp in family.mcgrps['list']:
2532 defines.append([c_upper(grp.get('c-define-name', f"{family.ident_name}-mcgrp-{name}")),
2551 def render_user_family(family, cw, prototype): argument
2552 symbol = f'const struct ynl_family ynl_{family.c_name}_family'
2557 if family.ntfs:
2558 cw.block_start(line=f"static const struct ynl_ntf_info {family['name']}_ntf_info[] = ")
2559 for ntf_op_name, ntf_op in family.ntfs.items():
2561 op = family.ops[ntf_op['notify']]
2562 ri = RenderInfo(cw, family, "user", op, "notify")
2564 ri = RenderInfo(cw, family, "user", ntf_op, "event")
2568 for op_name, op in family.ops.items():
2571 ri = RenderInfo(cw, family, "user", op, "event")
2577 cw.p(f'.name\t\t= "{family.c_name}",')
2578 if family.fixed_header:
2579 … cw.p(f'.hdr_len\t= sizeof(struct genlmsghdr) + sizeof(struct {c_lower(family.fixed_header)}),')
2582 if family.ntfs:
2583 cw.p(f".ntf_info\t= {family['name']}_ntf_info,")
2584 cw.p(f".ntf_info_size\t= YNL_ARRAY_SIZE({family['name']}_ntf_info),")
2588 def family_contains_bitfield32(family): argument
2589 for _, attr_set in family.attr_sets.items():
2627 parsed = Family(args.spec, exclude_ops)