Lines Matching +full:c +full:- +full:family +full:- +full:name
1 # SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
26 family back reference to the full family
28 name name of the entity as listed in the spec (optional)
29 ident_name name which can be safely used as identifier in code (optional)
31 def __init__(self, family, yaml): argument
33 self.family = family
35 if 'name' in self.yaml:
36 self.name = self.yaml['name']
37 self.ident_name = self.name.replace('-', '_')
40 family.add_unresolved(self)
74 yaml = {'name': yaml}
75 super().__init__(enum_set.family, yaml)
108 entries entries by name
113 def __init__(self, family, yaml): argument
114 super().__init__(family, yaml)
119 value_start = self.yaml.get('value-start', 0)
124 self.entries[e.name] = e
159 struct_name string, name of struct definition
160 sub_type string, name of sub type
164 sub_message string, name of sub message type
165 selector string, name of attribute used to select
166 sub-message type
168 is_auto_scalar bool, attr is a variable-size scalar
170 def __init__(self, family, attr_set, yaml, value): argument
171 super().__init__(family, yaml)
176 self.is_multi = yaml.get('multi-attr', False)
178 self.sub_type = yaml.get('sub-type')
179 self.byte_order = yaml.get('byte-order')
181 self.display_hint = yaml.get('display-hint')
182 self.sub_message = yaml.get('sub-message')
194 via the dictionary interface Attribute Set exposes attributes by name.
197 attrs ordered dict of all attributes (indexed by name)
201 def __init__(self, family, yaml): argument
202 super().__init__(family, yaml)
204 self.subset_of = self.yaml.get('subset-of', None)
216 self.attrs[attr.name] = attr
220 real_set = family.attr_sets[self.subset_of]
222 real_attr = real_set[elem['name']]
226 self.attrs[attr.name] = attr
230 return SpecAttr(self.family, self, elem, value)
253 enum string, name of the enum definition
257 struct string, name of nested struct type
259 def __init__(self, family, yaml): argument
260 super().__init__(family, yaml)
262 self.byte_order = yaml.get('byte-order')
265 self.display_hint = yaml.get('display-hint')
272 Represents a C struct definition.
277 def __init__(self, family, yaml): argument
278 super().__init__(family, yaml)
282 self.members.append(self.new_member(family, member))
284 def new_member(self, family, elem): argument
285 return SpecStructMember(family, elem)
295 """ Netlink sub-message definition
297 Represents a set of sub-message formats for polymorphic nlattrs
298 that contain type-specific sub messages.
301 name string, name of sub-message definition
302 formats dict of sub-message formats indexed by match value
304 def __init__(self, family, yaml): argument
305 super().__init__(family, yaml)
309 format = self.new_format(family, elem)
312 def new_format(self, family, format): argument
313 return SpecSubMessageFormat(family, format)
317 """ Netlink sub-message format definition
319 Represents a single format for a sub-message.
323 fixed_header string, name of fixed header, or None
324 attr_set string, name of attribute set, or None
326 def __init__(self, family, yaml): argument
327 super().__init__(family, yaml)
330 self.fixed_header = yaml.get('fixed-header')
331 self.attr_set = yaml.get('attribute-set')
342 req_value numerical ID when serialized, user -> kernel
343 rsp_value numerical ID when serialized, user <- kernel
348 attr_set attribute set name
349 fixed_header string, optional name of fixed header struct
353 def __init__(self, family, yaml, req_value, rsp_value): argument
354 super().__init__(family, yaml)
364 self.fixed_header = self.yaml.get('fixed-header', family.fixed_header)
373 if 'attribute-set' in self.yaml:
374 attr_set_name = self.yaml['attribute-set']
376 msg = self.family.msgs[self.yaml['notify']]
377 attr_set_name = msg['attribute-set']
381 raise Exception(f"Can't resolve attribute set for op '{self.name}'")
383 self.attr_set = self.family.attr_sets[attr_set_name]
392 netlink-raw schema. Genetlink families use dynamic ID allocation
397 name name of the mulitcast group
398 value integer id of this multicast group for netlink-raw or None
401 def __init__(self, family, yaml): argument
402 super().__init__(family, yaml)
407 """ Netlink Family Spec class.
409 Netlink family information loaded from a spec (e.g. in YAML).
418 msg_id_model enum-model for operations (unified, directional etc.)
422 msgs dict of all messages (index by name)
423 sub_msgs dict of all sub messages (index by name)
427 fixed_header string, optional name of family default fixed header struct
428 mcast_groups dict of all multicast groups (index by name)
429 kernel_family dict of kernel family attributes
433 prefix = '# SPDX-License-Identifier: '
449 self.msg_id_model = self.yaml['operations'].get('enum-model', 'unified')
473 self.kernel_family = collections.OrderedDict(self.yaml.get('kernel-family', {}))
516 self.fixed_header = self.yaml['operations'].get('fixed-header')
525 self.msgs[op.name] = op
528 self.fixed_header = self.yaml['operations'].get('fixed-header')
560 skip |= bool(exclude.match(elem['name']))
567 self.msgs[op.name] = op
569 def find_operation(self, name): argument
571 For a given operation name, find and return operation spec.
574 if name == op['name']:
584 self.consts[elem['name']] = self.new_enum(elem)
586 self.consts[elem['name']] = self.new_struct(elem)
588 self.consts[elem['name']] = elem
590 for elem in self.yaml['attribute-sets']:
592 self.attr_sets[elem['name']] = attr_set
594 for elem in self.yaml.get('sub-messages', []):
596 self.sub_msgs[sub_message.name] = sub_message
608 if not op.is_async and 'attribute-set' in op:
609 self.ops[op.name] = op
611 self.ntfs[op.name] = op
613 mcgs = self.yaml.get('mcast-groups')
617 self.mcast_groups[elem['name']] = mcg